From 272a5bdcba56be87743f89bde45625f478748b5a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 22 May 2018 13:18:44 +0200 Subject: [PATCH 1/5] Set item-type for ExecIDs Arrays expect a type to be set for items in the array. This patch adds the "string" type, adds a short description, and some example values. Signed-off-by: Sebastiaan van Stijn Upstream-commit: 8b6b55986644c093564497bfef51733a8d598baf Component: engine --- components/engine/api/swagger.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/engine/api/swagger.yaml b/components/engine/api/swagger.yaml index 459ce9b186..2550a50b56 100644 --- a/components/engine/api/swagger.yaml +++ b/components/engine/api/swagger.yaml @@ -4663,7 +4663,11 @@ paths: AppArmorProfile: type: "string" ExecIDs: + description: "IDs of exec instances that are running in the container." type: "array" + items: + type: "string" + x-nullable: true HostConfig: $ref: "#/definitions/HostConfig" GraphDriver: @@ -4720,6 +4724,9 @@ paths: StopTimeout: 10 Created: "2015-01-06T15:47:31.485331387Z" Driver: "devicemapper" + ExecIDs: + - "b35395de42bc8abd327f9dd65d913b9ba28c74d2f0734eeeae84fa1c616a0fca" + - "3fc1232e5cd20c8de182ed81178503dc6437f4e7ef12b52cc5e8de020652f1c4" HostConfig: MaximumIOps: 0 MaximumIOBps: 0 From 717e3937b9d9bf0477932a6616ee18833f5525c1 Mon Sep 17 00:00:00 2001 From: Anda Xu Date: Fri, 18 May 2018 13:01:44 -0700 Subject: [PATCH 2/5] more fixes on integration Signed-off-by: Anda Xu Upstream-commit: b9b4f888703a20ddd7670c1b978dcb1621fa210f Component: engine --- .../engine/integration-cli/docker_cli_inspect_test.go | 7 ------- .../engine/integration/plugin/logging/logging_test.go | 2 ++ components/engine/internal/test/environment/environment.go | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/components/engine/integration-cli/docker_cli_inspect_test.go b/components/engine/integration-cli/docker_cli_inspect_test.go index 247721e616..a1130aebf5 100644 --- a/components/engine/integration-cli/docker_cli_inspect_test.go +++ b/components/engine/integration-cli/docker_cli_inspect_test.go @@ -458,10 +458,3 @@ func (s *DockerSuite) TestInspectUnknownObject(c *check.C) { c.Assert(out, checker.Contains, "Error: No such object: foobar") c.Assert(err.Error(), checker.Contains, "Error: No such object: foobar") } - -func (s *DockerSuite) TestInspectInvalidReference(c *check.C) { - // This test should work on both Windows and Linux - out, _, err := dockerCmdWithError("inspect", "FooBar") - c.Assert(err, checker.NotNil) - c.Assert(out, checker.Contains, "invalid reference format: repository name must be lowercase") -} diff --git a/components/engine/integration/plugin/logging/logging_test.go b/components/engine/integration/plugin/logging/logging_test.go index ad2336fc64..1b6f2962bb 100644 --- a/components/engine/integration/plugin/logging/logging_test.go +++ b/components/engine/integration/plugin/logging/logging_test.go @@ -12,9 +12,11 @@ import ( "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/daemon" "github.com/gotestyourself/gotestyourself/assert" + "github.com/gotestyourself/gotestyourself/skip" ) func TestContinueAfterPluginCrash(t *testing.T) { + skip.If(t, testEnv.IsRemoteDaemon(), "test requires daemon on the same host") t.Parallel() d := daemon.New(t) diff --git a/components/engine/internal/test/environment/environment.go b/components/engine/internal/test/environment/environment.go index 9aaabad7be..74c8e2ce0a 100644 --- a/components/engine/internal/test/environment/environment.go +++ b/components/engine/internal/test/environment/environment.go @@ -121,7 +121,7 @@ func (e *Execution) IsRemoteDaemon() bool { return !e.IsLocalDaemon() } -// DaemonAPIVersion returns the negociated daemon api version +// DaemonAPIVersion returns the negotiated daemon api version func (e *Execution) DaemonAPIVersion() string { version, err := e.APIClient().ServerVersion(context.TODO()) if err != nil { From 6280cae03acd65d331adaaf27f3745e592ce882e Mon Sep 17 00:00:00 2001 From: Anda Xu Date: Tue, 22 May 2018 17:42:41 -0700 Subject: [PATCH 3/5] skip feature/test added that is breaking ee Signed-off-by: Anda Xu Upstream-commit: 84598be35f200bd0ea28a615100c51dbaeb51898 Component: engine --- components/engine/integration/build/build_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/components/engine/integration/build/build_test.go b/components/engine/integration/build/build_test.go index c0aea0fe6b..352f7c152d 100644 --- a/components/engine/integration/build/build_test.go +++ b/components/engine/integration/build/build_test.go @@ -175,6 +175,7 @@ func TestBuildMultiStageParentConfig(t *testing.T) { // Test cases in #36996 func TestBuildLabelWithTargets(t *testing.T) { + skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.37"), "test added after 1.37") bldName := "build-a" testLabels := map[string]string{ "foo": "bar", From 66dfe0e94491334ff186668c08c5b57688cbb7eb Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 21 May 2018 10:51:37 -0700 Subject: [PATCH 4/5] TestContainerAPITop: fix flakyness The following failure is seen in CI from time to time: > FAIL: docker_api_containers_test.go:435: DockerSuite.TestContainerAPITop > > docker_api_containers_test.go:453: > c.Assert(top.Processes[0][10], checker.Equals, "/bin/sh -c top") > ... obtained string = "top" > ... expected string = "/bin/sh -c top" The test case expects two processes in the output: 1. /bin/sh -c top 2. top in the given order. Now, "ps aux" output is sorted by PID*, and so since the "top" is a child of "/bin/sh -c top" it has a higher PID and will come second as expected by the test... unless the PIDs on the system are exhausted and PID rollover happens, in which case PID of "top" will be lower than that of "/bin/sh". Fix: sort output by process name. * - in fact it is not sorted, but is being printed in the same order as the kernel list PID entries in /proc directory, which appears to be sorted by PID (see ls -1 -U /proc). Signed-off-by: Kir Kolyshkin Upstream-commit: 0823ab70990fa4cbf520726013e75c264e6c5231 Component: engine --- .../engine/integration-cli/docker_api_containers_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/engine/integration-cli/docker_api_containers_test.go b/components/engine/integration-cli/docker_api_containers_test.go index f980d87d82..31d6077880 100644 --- a/components/engine/integration-cli/docker_api_containers_test.go +++ b/components/engine/integration-cli/docker_api_containers_test.go @@ -442,7 +442,8 @@ func (s *DockerSuite) TestContainerAPITop(c *check.C) { c.Assert(err, checker.IsNil) defer cli.Close() - top, err := cli.ContainerTop(context.Background(), id, []string{"aux"}) + // sort by comm[andline] to make sure order stays the same in case of PID rollover + top, err := cli.ContainerTop(context.Background(), id, []string{"aux", "--sort=comm"}) c.Assert(err, checker.IsNil) c.Assert(top.Titles, checker.HasLen, 11, check.Commentf("expected 11 titles, found %d: %v", len(top.Titles), top.Titles)) From 4056a6dfa432f4b22e47edd8cf2b4b3c8f57c8cb Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 30 Mar 2018 12:32:10 -0700 Subject: [PATCH 5/5] pkg/mount/TestMount: fix wrt selinux Sometimes docker-master CI fails on rhel4+selinux configuration, like this: --- FAIL: TestMount (0.12s) --- FAIL: TestMount/none-remount,size=128k (0.01s) mounter_linux_test.go:209: unexpected mount option "seclabel" expected "rw,size=128k" --- FAIL: TestMount/none-remount,ro,size=128k (0.01s) mounter_linux_test.go:209: unexpected mount option "seclabel" expected "ro,size=128k" Earlier, commit 8bebd42df2 (PR #34965) fixed this failure, but not entirely (i.e. the test is now flaky). It looks like either selinux detection code is not always working (it won't work in d-in-d), or the kernel might or might not add 'seclabel' option). As the subject of this test case is definitely not selinux, it can just ignore the option added by it. While at it, fix error messages: - add missing commas; - fix a typo; - allow for clear distinction between mount and vfs (per-superblock) options. Signed-off-by: Kir Kolyshkin Signed-off-by: Kir Kolyshkin Upstream-commit: d78e885326213e8ef89919c3cc6d16e712e852a8 Component: engine --- .../engine/pkg/mount/mounter_linux_test.go | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/components/engine/pkg/mount/mounter_linux_test.go b/components/engine/pkg/mount/mounter_linux_test.go index 15f10593ac..336f3d5cdc 100644 --- a/components/engine/pkg/mount/mounter_linux_test.go +++ b/components/engine/pkg/mount/mounter_linux_test.go @@ -8,8 +8,6 @@ import ( "os" "strings" "testing" - - selinux "github.com/opencontainers/selinux/go-selinux" ) func TestMount(t *testing.T) { @@ -103,11 +101,7 @@ func TestMount(t *testing.T) { t.Fatal(err) } defer ensureUnmount(t, target) - expectedVFS := tc.expectedVFS - if selinux.GetEnabled() && expectedVFS != "" { - expectedVFS = expectedVFS + ",seclabel" - } - validateMount(t, target, tc.expectedOpts, tc.expectedOptional, expectedVFS) + validateMount(t, target, tc.expectedOpts, tc.expectedOptional, tc.expectedVFS) }) } } @@ -177,13 +171,13 @@ func validateMount(t *testing.T, mnt string, opts, optional, vfs string) { for _, opt := range strings.Split(mi.Opts, ",") { opt = clean(opt) if !has(wantedOpts, opt) && !has(pOpts, opt) { - t.Errorf("unexpected mount option %q expected %q", opt, opts) + t.Errorf("unexpected mount option %q, expected %q", opt, opts) } delete(wantedOpts, opt) } } for opt := range wantedOpts { - t.Errorf("missing mount option %q found %q", opt, mi.Opts) + t.Errorf("missing mount option %q, found %q", opt, mi.Opts) } // Validate Optional @@ -191,13 +185,13 @@ func validateMount(t *testing.T, mnt string, opts, optional, vfs string) { for _, field := range strings.Split(mi.Optional, ",") { field = clean(field) if !has(wantedOptional, field) && !has(pOptional, field) { - t.Errorf("unexpected optional failed %q expected %q", field, optional) + t.Errorf("unexpected optional field %q, expected %q", field, optional) } delete(wantedOptional, field) } } for field := range wantedOptional { - t.Errorf("missing optional field %q found %q", field, mi.Optional) + t.Errorf("missing optional field %q, found %q", field, mi.Optional) } // Validate VFS if set @@ -205,14 +199,14 @@ func validateMount(t *testing.T, mnt string, opts, optional, vfs string) { if mi.VfsOpts != "" { for _, opt := range strings.Split(mi.VfsOpts, ",") { opt = clean(opt) - if !has(wantedVFS, opt) { - t.Errorf("unexpected mount option %q expected %q", opt, vfs) + if !has(wantedVFS, opt) && opt != "seclabel" { // can be added by selinux + t.Errorf("unexpected vfs option %q, expected %q", opt, vfs) } delete(wantedVFS, opt) } } for opt := range wantedVFS { - t.Errorf("missing mount option %q found %q", opt, mi.VfsOpts) + t.Errorf("missing vfs option %q, found %q", opt, mi.VfsOpts) } }