From 62e1fa1243ba2167ddb23034a7bf5a221e9e7475 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Fri, 9 Feb 2018 00:45:08 +0000 Subject: [PATCH 1/6] Remove docker_cli_secret_ls_test.go from integration-cli Signed-off-by: Yong Tang Upstream-commit: 42465784dcc61aa69b8fcefe4669d20422471fea Component: engine --- .../docker_cli_secret_ls_test.go | 125 ------------------ 1 file changed, 125 deletions(-) delete mode 100644 components/engine/integration-cli/docker_cli_secret_ls_test.go diff --git a/components/engine/integration-cli/docker_cli_secret_ls_test.go b/components/engine/integration-cli/docker_cli_secret_ls_test.go deleted file mode 100644 index f3201f7d7d..0000000000 --- a/components/engine/integration-cli/docker_cli_secret_ls_test.go +++ /dev/null @@ -1,125 +0,0 @@ -// +build !windows - -package main - -import ( - "strings" - - "github.com/docker/docker/api/types/swarm" - "github.com/docker/docker/integration-cli/checker" - "github.com/go-check/check" -) - -func (s *DockerSwarmSuite) TestSecretList(c *check.C) { - d := s.AddDaemon(c, true, true) - - testName0 := "test0" - testName1 := "test1" - - // create secret test0 - id0 := d.CreateSecret(c, swarm.SecretSpec{ - Annotations: swarm.Annotations{ - Name: testName0, - Labels: map[string]string{"type": "test"}, - }, - Data: []byte("TESTINGDATA0"), - }) - c.Assert(id0, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id0)) - - secret := d.GetSecret(c, id0) - c.Assert(secret.Spec.Name, checker.Equals, testName0) - - // create secret test1 - id1 := d.CreateSecret(c, swarm.SecretSpec{ - Annotations: swarm.Annotations{ - Name: testName1, - Labels: map[string]string{"type": "production"}, - }, - Data: []byte("TESTINGDATA1"), - }) - c.Assert(id1, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id1)) - - secret = d.GetSecret(c, id1) - c.Assert(secret.Spec.Name, checker.Equals, testName1) - - // test by command `docker secret ls` - out, err := d.Cmd("secret", "ls") - c.Assert(err, checker.IsNil, check.Commentf(out)) - c.Assert(strings.TrimSpace(out), checker.Contains, testName0) - c.Assert(strings.TrimSpace(out), checker.Contains, testName1) - - // test filter by name `docker secret ls --filter name=xxx` - args := []string{ - "secret", - "ls", - "--filter", - "name=test0", - } - out, err = d.Cmd(args...) - c.Assert(err, checker.IsNil, check.Commentf(out)) - - c.Assert(strings.TrimSpace(out), checker.Contains, testName0) - c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), testName1) - - // test filter by id `docker secret ls --filter id=xxx` - args = []string{ - "secret", - "ls", - "--filter", - "id=" + id1, - } - out, err = d.Cmd(args...) - c.Assert(err, checker.IsNil, check.Commentf(out)) - - c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), testName0) - c.Assert(strings.TrimSpace(out), checker.Contains, testName1) - - // test filter by label `docker secret ls --filter label=xxx` - args = []string{ - "secret", - "ls", - "--filter", - "label=type", - } - out, err = d.Cmd(args...) - c.Assert(err, checker.IsNil, check.Commentf(out)) - - c.Assert(strings.TrimSpace(out), checker.Contains, testName0) - c.Assert(strings.TrimSpace(out), checker.Contains, testName1) - - args = []string{ - "secret", - "ls", - "--filter", - "label=type=test", - } - out, err = d.Cmd(args...) - c.Assert(err, checker.IsNil, check.Commentf(out)) - - c.Assert(strings.TrimSpace(out), checker.Contains, testName0) - c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), testName1) - - args = []string{ - "secret", - "ls", - "--filter", - "label=type=production", - } - out, err = d.Cmd(args...) - c.Assert(err, checker.IsNil, check.Commentf(out)) - - c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), testName0) - c.Assert(strings.TrimSpace(out), checker.Contains, testName1) - - // test invalid filter `docker secret ls --filter noexisttype=xxx` - args = []string{ - "secret", - "ls", - "--filter", - "noexisttype=test0", - } - out, err = d.Cmd(args...) - c.Assert(err, checker.NotNil, check.Commentf(out)) - - c.Assert(strings.TrimSpace(out), checker.Contains, "Error response from daemon: Invalid filter 'noexisttype'") -} From 5072bc0df842973b32cf80035edb8bf0fc9b3f59 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Fri, 9 Feb 2018 00:45:22 +0000 Subject: [PATCH 2/6] Migrate secret list tests from integration-cli to api tests This fix migrates secret list tests from integration-cli to api tests Signed-off-by: Yong Tang Upstream-commit: 9349c035831e09057bd039b8f677fa19d3354f73 Component: engine --- .../engine/integration/secret/secret_test.go | 103 ++++++++++++++++-- 1 file changed, 93 insertions(+), 10 deletions(-) diff --git a/components/engine/integration/secret/secret_test.go b/components/engine/integration/secret/secret_test.go index 922fd33028..566598db97 100644 --- a/components/engine/integration/secret/secret_test.go +++ b/components/engine/integration/secret/secret_test.go @@ -1,8 +1,11 @@ package secret import ( + "sort" "testing" + "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/filters" swarmtypes "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" "github.com/docker/docker/integration/util/swarm" @@ -24,20 +27,100 @@ func TestSecretInspect(t *testing.T) { ctx := context.Background() testName := "test_secret" - secretResp, err := client.SecretCreate(ctx, swarmtypes.SecretSpec{ - Annotations: swarmtypes.Annotations{ - Name: testName, - }, - Data: []byte("TESTINGDATA"), - }) - require.NoError(t, err) - assert.NotEqual(t, secretResp.ID, "") + secretID := createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), nil) - secret, _, err := client.SecretInspectWithRaw(context.Background(), secretResp.ID) + secret, _, err := client.SecretInspectWithRaw(context.Background(), secretID) require.NoError(t, err) assert.Equal(t, secret.Spec.Name, testName) secret, _, err = client.SecretInspectWithRaw(context.Background(), testName) require.NoError(t, err) - assert.Equal(t, secret.ID, secretResp.ID) + assert.Equal(t, secret.ID, secretID) +} + +func TestSecretList(t *testing.T) { + skip.If(t, testEnv.DaemonInfo.OSType != "linux") + + defer setupTest(t)() + d := swarm.NewSwarm(t, testEnv) + defer d.Stop(t) + client, err := client.NewClientWithOpts(client.WithHost((d.Sock()))) + require.NoError(t, err) + + ctx := context.Background() + + testName0 := "test0" + testName1 := "test1" + testNames := []string{testName0, testName1} + sort.Strings(testNames) + + // create secret test0 + createSecret(ctx, t, client, testName0, []byte("TESTINGDATA0"), map[string]string{"type": "test"}) + + // create secret test1 + secret1ID := createSecret(ctx, t, client, testName1, []byte("TESTINGDATA1"), map[string]string{"type": "production"}) + + names := func(entries []swarmtypes.Secret) []string { + values := []string{} + for _, entry := range entries { + values = append(values, entry.Spec.Name) + } + sort.Strings(values) + return values + } + + // test by `secret ls` + entries, err := client.SecretList(ctx, types.SecretListOptions{}) + require.NoError(t, err) + assert.Equal(t, names(entries), testNames) + + testCases := []struct { + filters filters.Args + expected []string + }{ + // test filter by name `secret ls --filter name=xxx` + { + filters: filters.NewArgs(filters.Arg("name", testName0)), + expected: []string{testName0}, + }, + // test filter by id `secret ls --filter id=xxx` + { + filters: filters.NewArgs(filters.Arg("id", secret1ID)), + expected: []string{testName1}, + }, + // test filter by label `secret ls --filter label=xxx` + { + filters: filters.NewArgs(filters.Arg("label", "type")), + expected: testNames, + }, + { + filters: filters.NewArgs(filters.Arg("label", "type=test")), + expected: []string{testName0}, + }, + { + filters: filters.NewArgs(filters.Arg("label", "type=production")), + expected: []string{testName1}, + }, + } + for _, tc := range testCases { + entries, err = client.SecretList(ctx, types.SecretListOptions{ + Filters: tc.filters, + }) + require.NoError(t, err) + assert.Equal(t, names(entries), tc.expected) + + } +} + +func createSecret(ctx context.Context, t *testing.T, client client.APIClient, name string, data []byte, labels map[string]string) string { + secret, err := client.SecretCreate(ctx, swarmtypes.SecretSpec{ + Annotations: swarmtypes.Annotations{ + Name: name, + Labels: labels, + }, + Data: data, + }) + require.NoError(t, err) + assert.NotEqual(t, secret.ID, "") + return secret.ID } From a75949cd5f17ecf838981140f074cdcbbadc73a5 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Fri, 9 Feb 2018 02:35:51 +0000 Subject: [PATCH 3/6] Migrate docker_api_inspect_unix_test.go to integration api test This fix migrates docker_api_inspect_unix_test.go to integration api test Signed-off-by: Yong Tang Upstream-commit: 8197529ca2fabc95b9fc4a7e3ff643740b1f4388 Component: engine --- .../docker_api_inspect_unix_test.go | 36 -------------- .../integration/container/inspect_test.go | 47 +++++++++++++++++++ 2 files changed, 47 insertions(+), 36 deletions(-) delete mode 100644 components/engine/integration-cli/docker_api_inspect_unix_test.go create mode 100644 components/engine/integration/container/inspect_test.go diff --git a/components/engine/integration-cli/docker_api_inspect_unix_test.go b/components/engine/integration-cli/docker_api_inspect_unix_test.go deleted file mode 100644 index 17844e0bfc..0000000000 --- a/components/engine/integration-cli/docker_api_inspect_unix_test.go +++ /dev/null @@ -1,36 +0,0 @@ -// +build !windows - -package main - -import ( - "encoding/json" - - "github.com/docker/docker/client" - "github.com/docker/docker/integration-cli/checker" - "github.com/go-check/check" - "golang.org/x/net/context" -) - -// #16665 -func (s *DockerSuite) TestInspectAPICpusetInConfigPre120(c *check.C) { - testRequires(c, DaemonIsLinux) - testRequires(c, cgroupCpuset) - - name := "cpusetinconfig-pre120" - dockerCmd(c, "run", "--name", name, "--cpuset-cpus", "0", "busybox", "true") - cli, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("v1.19")) - c.Assert(err, checker.IsNil) - defer cli.Close() - _, body, err := cli.ContainerInspectWithRaw(context.Background(), name, false) - c.Assert(err, check.IsNil) - - var inspectJSON map[string]interface{} - err = json.Unmarshal(body, &inspectJSON) - c.Assert(err, checker.IsNil, check.Commentf("unable to unmarshal body for version 1.19")) - - config, ok := inspectJSON["Config"] - c.Assert(ok, checker.True, check.Commentf("Unable to find 'Config'")) - cfg := config.(map[string]interface{}) - _, ok = cfg["Cpuset"] - c.Assert(ok, checker.True, check.Commentf("API version 1.19 expected to include Cpuset in 'Config'")) -} diff --git a/components/engine/integration/container/inspect_test.go b/components/engine/integration/container/inspect_test.go new file mode 100644 index 0000000000..43df2a21df --- /dev/null +++ b/components/engine/integration/container/inspect_test.go @@ -0,0 +1,47 @@ +package container // import "github.com/docker/docker/integration/container" + +import ( + "context" + "encoding/json" + "testing" + "time" + + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/network" + "github.com/docker/docker/client" + "github.com/docker/docker/integration/util/request" + "github.com/gotestyourself/gotestyourself/poll" + "github.com/gotestyourself/gotestyourself/skip" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestInspectCpusetInConfigPre120(t *testing.T) { + skip.If(t, testEnv.DaemonInfo.OSType != "linux" || !testEnv.DaemonInfo.CPUSet) + + defer setupTest(t)() + client := request.NewAPIClient(t, client.WithVersion("1.19")) + ctx := context.Background() + + name := "cpusetinconfig-pre120" + // Create container with up to-date-API + runSimpleContainer(ctx, t, request.NewAPIClient(t), name, func(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig) { + config.Cmd = []string{"true"} + hostConfig.Resources.CpusetCpus = "0" + }) + poll.WaitOn(t, containerIsInState(ctx, client, name, "exited"), poll.WithDelay(100*time.Millisecond)) + + _, body, err := client.ContainerInspectWithRaw(ctx, name, false) + require.NoError(t, err) + + var inspectJSON map[string]interface{} + err = json.Unmarshal(body, &inspectJSON) + require.NoError(t, err, "unable to unmarshal body for version 1.19: %s", err) + + config, ok := inspectJSON["Config"] + assert.Equal(t, ok, true, "Unable to find 'Config'") + + cfg := config.(map[string]interface{}) + _, ok = cfg["Cpuset"] + assert.Equal(t, ok, true, "API version 1.19 expected to include Cpuset in 'Config'") +} From 20c1120c88a986d3a5482117b98a0bcb2fe90ddb Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Fri, 9 Feb 2018 12:46:38 +0000 Subject: [PATCH 4/6] Migrate TestKillDifferentUserContainer to api test This fix migrates TestKillDifferentUserContainer to api test Signed-off-by: Yong Tang Upstream-commit: 0855922cd3cd1e9d846fd85ef968653ff8649a44 Component: engine --- .../integration-cli/docker_cli_kill_test.go | 25 ------------------- .../engine/integration/container/kill_test.go | 18 +++++++++++++ 2 files changed, 18 insertions(+), 25 deletions(-) delete mode 100644 components/engine/integration-cli/docker_cli_kill_test.go diff --git a/components/engine/integration-cli/docker_cli_kill_test.go b/components/engine/integration-cli/docker_cli_kill_test.go deleted file mode 100644 index e2e510fcaa..0000000000 --- a/components/engine/integration-cli/docker_cli_kill_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "strings" - "time" - - "github.com/docker/docker/integration-cli/checker" - "github.com/docker/docker/integration-cli/cli" - "github.com/go-check/check" -) - -func (s *DockerSuite) TestKillDifferentUserContainer(c *check.C) { - // TODO Windows: Windows does not yet support -u (Feb 2016). - testRequires(c, DaemonIsLinux) - out := cli.DockerCmd(c, "run", "-u", "daemon", "-d", "busybox", "top").Combined() - cleanedContainerID := strings.TrimSpace(out) - cli.WaitRun(c, cleanedContainerID) - - cli.DockerCmd(c, "kill", cleanedContainerID) - cli.WaitExited(c, cleanedContainerID, 10*time.Second) - - out = cli.DockerCmd(c, "ps", "-q").Combined() - c.Assert(out, checker.Not(checker.Contains), cleanedContainerID, check.Commentf("killed container is still running")) - -} diff --git a/components/engine/integration/container/kill_test.go b/components/engine/integration/container/kill_test.go index 57343942da..2bef7e4e96 100644 --- a/components/engine/integration/container/kill_test.go +++ b/components/engine/integration/container/kill_test.go @@ -175,3 +175,21 @@ func TestKillStoppedContainerAPIPre120(t *testing.T) { err = client.ContainerKill(ctx, c.ID, "SIGKILL") require.NoError(t, err) } + +func TestKillDifferentUserContainer(t *testing.T) { + // TODO Windows: Windows does not yet support -u (Feb 2016). + skip.If(t, testEnv.OSType != "linux", "User containers (container.Config.User) are not yet supported on %q platform", testEnv.OSType) + + defer setupTest(t)() + ctx := context.Background() + client := request.NewAPIClient(t, client.WithVersion("1.19")) + + cID := runSimpleContainer(ctx, t, client, "", func(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig) { + config.User = "daemon" + }) + poll.WaitOn(t, containerIsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond)) + + err := client.ContainerKill(ctx, cID, "SIGKILL") + require.NoError(t, err) + poll.WaitOn(t, containerIsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond)) +} From 89a07f6033b3f31aef2aa08c0e80e3cc56c35bff Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 7 Feb 2018 15:25:50 -0800 Subject: [PATCH 5/6] c.RWLayer: check for nil before use Since commit e9b9e4ace294230c6b8eb has landed, there is a chance that container.RWLayer is nil (due to some half-removed container). Let's check the pointer before use to avoid any potential nil pointer dereferences, resulting in a daemon crash. Note that even without the abovementioned commit, it's better to perform an extra check (even it's totally redundant) rather than to have a possibility of a daemon crash. In other words, better be safe than sorry. [v2: add a test case for daemon.getInspectData] [v3: add a check for container.Dead and a special error for the case] Fixes: e9b9e4ace294230c6b8eb Signed-off-by: Kir Kolyshkin Upstream-commit: 195893d38160c0893e326b8674e05ef6714aeaa4 Component: engine --- components/engine/daemon/changes.go | 3 +++ components/engine/daemon/daemon.go | 6 +++++ components/engine/daemon/inspect.go | 17 +++++++++--- components/engine/daemon/inspect_test.go | 33 ++++++++++++++++++++++++ components/engine/daemon/oci_windows.go | 4 +++ 5 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 components/engine/daemon/inspect_test.go diff --git a/components/engine/daemon/changes.go b/components/engine/daemon/changes.go index 306790e888..70b3f6b943 100644 --- a/components/engine/daemon/changes.go +++ b/components/engine/daemon/changes.go @@ -22,6 +22,9 @@ func (daemon *Daemon) ContainerChanges(name string) ([]archive.Change, error) { container.Lock() defer container.Unlock() + if container.RWLayer == nil { + return nil, errors.New("RWLayer of container " + name + " is unexpectedly nil") + } c, err := container.RWLayer.Changes() if err != nil { return nil, err diff --git a/components/engine/daemon/daemon.go b/components/engine/daemon/daemon.go index 982cdf543d..ab28a56ebe 100644 --- a/components/engine/daemon/daemon.go +++ b/components/engine/daemon/daemon.go @@ -1051,6 +1051,9 @@ func (daemon *Daemon) Shutdown() error { // Mount sets container.BaseFS // (is it not set coming in? why is it unset?) func (daemon *Daemon) Mount(container *container.Container) error { + if container.RWLayer == nil { + return errors.New("RWLayer of container " + container.ID + " is unexpectedly nil") + } dir, err := container.RWLayer.Mount(container.GetMountLabel()) if err != nil { return err @@ -1073,6 +1076,9 @@ func (daemon *Daemon) Mount(container *container.Container) error { // Unmount unsets the container base filesystem func (daemon *Daemon) Unmount(container *container.Container) error { + if container.RWLayer == nil { + return errors.New("RWLayer of container " + container.ID + " is unexpectedly nil") + } if err := container.RWLayer.Unmount(); err != nil { logrus.Errorf("Error unmounting container %s: %s", container.ID, err) return err diff --git a/components/engine/daemon/inspect.go b/components/engine/daemon/inspect.go index c38cee5675..164e1aa2ae 100644 --- a/components/engine/daemon/inspect.go +++ b/components/engine/daemon/inspect.go @@ -1,6 +1,7 @@ package daemon // import "github.com/docker/docker/daemon" import ( + "errors" "fmt" "time" @@ -184,14 +185,24 @@ func (daemon *Daemon) getInspectData(container *container.Container) (*types.Con contJSONBase.GraphDriver.Name = container.Driver + if container.RWLayer == nil { + if container.Dead { + return contJSONBase, nil + } + return nil, errdefs.System(errors.New("RWLayer of container " + container.ID + " is unexpectedly nil")) + } + graphDriverData, err := container.RWLayer.Metadata() // If container is marked as Dead, the container's graphdriver metadata // could have been removed, it will cause error if we try to get the metadata, // we can ignore the error if the container is dead. - if err != nil && !container.Dead { - return nil, errdefs.System(err) + if err != nil { + if !container.Dead { + return nil, errdefs.System(err) + } + } else { + contJSONBase.GraphDriver.Data = graphDriverData } - contJSONBase.GraphDriver.Data = graphDriverData return contJSONBase, nil } diff --git a/components/engine/daemon/inspect_test.go b/components/engine/daemon/inspect_test.go new file mode 100644 index 0000000000..c10cc56796 --- /dev/null +++ b/components/engine/daemon/inspect_test.go @@ -0,0 +1,33 @@ +package daemon // import "github.com/docker/docker/daemon" + +import ( + "testing" + + containertypes "github.com/docker/docker/api/types/container" + "github.com/docker/docker/container" + "github.com/docker/docker/daemon/config" + "github.com/docker/docker/daemon/exec" + + "github.com/stretchr/testify/assert" +) + +func TestGetInspectData(t *testing.T) { + c := &container.Container{ + ID: "inspect-me", + HostConfig: &containertypes.HostConfig{}, + State: container.NewState(), + ExecCommands: exec.NewStore(), + } + + d := &Daemon{ + linkIndex: newLinkIndex(), + configStore: &config.Config{}, + } + + _, err := d.getInspectData(c) + assert.Error(t, err) + + c.Dead = true + _, err = d.getInspectData(c) + assert.NoError(t, err) +} diff --git a/components/engine/daemon/oci_windows.go b/components/engine/daemon/oci_windows.go index 74440531d7..47b1301eee 100644 --- a/components/engine/daemon/oci_windows.go +++ b/components/engine/daemon/oci_windows.go @@ -1,6 +1,7 @@ package daemon // import "github.com/docker/docker/daemon" import ( + "errors" "fmt" "io/ioutil" "path/filepath" @@ -156,6 +157,9 @@ func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) { // Reverse order, expecting parent most first s.Windows.LayerFolders = append([]string{layerPath}, s.Windows.LayerFolders...) } + if c.RWLayer == nil { + return nil, errors.New("RWLayer of container " + c.ID + " is unexpectedly nil") + } m, err := c.RWLayer.Metadata() if err != nil { return nil, fmt.Errorf("failed to get layer metadata - %s", err) From 1c3e1e8db6fe7fef1f1e76bf217931cb7f1e1116 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Fri, 9 Feb 2018 19:13:26 +0100 Subject: [PATCH 6/6] Rename integration/util to integration/internal Both names have no real sense, but one allows to make sure these packages aren't used outside of `integration`. Signed-off-by: Vincent Demeester Upstream-commit: af306d149e76b100e08972cda364647bd7bcfe1e Component: engine --- components/engine/hack/make/.integration-test-helpers | 2 +- components/engine/integration/build/build_test.go | 2 +- components/engine/integration/container/create_test.go | 2 +- components/engine/integration/container/exec_test.go | 2 +- components/engine/integration/container/health_test.go | 2 +- components/engine/integration/container/inspect_test.go | 2 +- components/engine/integration/container/kill_test.go | 2 +- components/engine/integration/container/links_linux_test.go | 2 +- components/engine/integration/container/nat_test.go | 2 +- components/engine/integration/container/ps_test.go | 2 +- components/engine/integration/container/rename_test.go | 2 +- components/engine/integration/container/resize_test.go | 2 +- components/engine/integration/container/stats_test.go | 2 +- components/engine/integration/container/stop_test.go | 2 +- components/engine/integration/container/update_linux_test.go | 2 +- components/engine/integration/image/commit_test.go | 2 +- components/engine/integration/image/import_test.go | 2 +- .../engine/integration/{util => internal}/request/client.go | 2 +- .../integration/{util => internal}/requirement/requirement.go | 2 +- .../engine/integration/{util => internal}/swarm/service.go | 0 components/engine/integration/network/delete_test.go | 2 +- .../engine/integration/plugin/authz/authz_plugin_test.go | 2 +- .../engine/integration/plugin/authz/authz_plugin_v2_test.go | 2 +- components/engine/integration/secret/secret_test.go | 2 +- components/engine/integration/service/create_test.go | 2 +- components/engine/integration/service/inspect_test.go | 2 +- components/engine/integration/service/network_test.go | 2 +- components/engine/integration/system/event_test.go | 2 +- components/engine/integration/system/info_linux_test.go | 2 +- components/engine/integration/system/info_test.go | 2 +- components/engine/integration/system/login_test.go | 4 ++-- components/engine/integration/system/version_test.go | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) rename components/engine/integration/{util => internal}/request/client.go (98%) rename components/engine/integration/{util => internal}/requirement/requirement.go (96%) rename components/engine/integration/{util => internal}/swarm/service.go (100%) diff --git a/components/engine/hack/make/.integration-test-helpers b/components/engine/hack/make/.integration-test-helpers index 3b1326dee0..bb34d45887 100644 --- a/components/engine/hack/make/.integration-test-helpers +++ b/components/engine/hack/make/.integration-test-helpers @@ -17,7 +17,7 @@ source "$MAKEDIR/.go-autogen" integration_api_dirs=${TEST_INTEGRATION_DIR:-"$( find ./integration -type d | - grep -vE '(^./integration($|/util)|/testdata)')"} + grep -vE '(^./integration($|/internal)|/testdata)')"} run_test_integration() { [[ "$TESTFLAGS" != *-check.f* ]] && run_test_integration_suites diff --git a/components/engine/integration/build/build_test.go b/components/engine/integration/build/build_test.go index 6b936ba774..2a87204113 100644 --- a/components/engine/integration/build/build_test.go +++ b/components/engine/integration/build/build_test.go @@ -13,7 +13,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/integration-cli/cli/build/fakecontext" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/docker/docker/pkg/jsonmessage" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/engine/integration/container/create_test.go b/components/engine/integration/container/create_test.go index ace90700e1..5bacd01e45 100644 --- a/components/engine/integration/container/create_test.go +++ b/components/engine/integration/container/create_test.go @@ -7,7 +7,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/docker/docker/internal/testutil" "github.com/gotestyourself/gotestyourself/skip" ) diff --git a/components/engine/integration/container/exec_test.go b/components/engine/integration/container/exec_test.go index 589f0aba86..a14284806d 100644 --- a/components/engine/integration/container/exec_test.go +++ b/components/engine/integration/container/exec_test.go @@ -9,7 +9,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/strslice" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/stretchr/testify/require" ) diff --git a/components/engine/integration/container/health_test.go b/components/engine/integration/container/health_test.go index 6185174e5d..a5c62edb57 100644 --- a/components/engine/integration/container/health_test.go +++ b/components/engine/integration/container/health_test.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/strslice" "github.com/docker/docker/client" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/gotestyourself/gotestyourself/poll" "github.com/stretchr/testify/require" ) diff --git a/components/engine/integration/container/inspect_test.go b/components/engine/integration/container/inspect_test.go index 43df2a21df..1123684126 100644 --- a/components/engine/integration/container/inspect_test.go +++ b/components/engine/integration/container/inspect_test.go @@ -9,7 +9,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" "github.com/docker/docker/client" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/gotestyourself/gotestyourself/poll" "github.com/gotestyourself/gotestyourself/skip" "github.com/stretchr/testify/assert" diff --git a/components/engine/integration/container/kill_test.go b/components/engine/integration/container/kill_test.go index 2bef7e4e96..caf2a55ab3 100644 --- a/components/engine/integration/container/kill_test.go +++ b/components/engine/integration/container/kill_test.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/strslice" "github.com/docker/docker/client" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/gotestyourself/gotestyourself/poll" "github.com/gotestyourself/gotestyourself/skip" "github.com/stretchr/testify/require" diff --git a/components/engine/integration/container/links_linux_test.go b/components/engine/integration/container/links_linux_test.go index 4959689ce5..b1dc654c20 100644 --- a/components/engine/integration/container/links_linux_test.go +++ b/components/engine/integration/container/links_linux_test.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/docker/docker/pkg/stdcopy" "github.com/gotestyourself/gotestyourself/poll" "github.com/gotestyourself/gotestyourself/skip" diff --git a/components/engine/integration/container/nat_test.go b/components/engine/integration/container/nat_test.go index 5ac838a2bd..0732e2d852 100644 --- a/components/engine/integration/container/nat_test.go +++ b/components/engine/integration/container/nat_test.go @@ -14,7 +14,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/docker/go-connections/nat" "github.com/gotestyourself/gotestyourself/poll" "github.com/gotestyourself/gotestyourself/skip" diff --git a/components/engine/integration/container/ps_test.go b/components/engine/integration/container/ps_test.go index 24113e5001..dfcb0e2efe 100644 --- a/components/engine/integration/container/ps_test.go +++ b/components/engine/integration/container/ps_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/network" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/components/engine/integration/container/rename_test.go b/components/engine/integration/container/rename_test.go index 965bfe17e3..e6af2ac9e9 100644 --- a/components/engine/integration/container/rename_test.go +++ b/components/engine/integration/container/rename_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/docker/docker/internal/testutil" "github.com/docker/docker/pkg/stringid" "github.com/gotestyourself/gotestyourself/poll" diff --git a/components/engine/integration/container/resize_test.go b/components/engine/integration/container/resize_test.go index b1422f88f7..887f1f6292 100644 --- a/components/engine/integration/container/resize_test.go +++ b/components/engine/integration/container/resize_test.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" req "github.com/docker/docker/integration-cli/request" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/docker/docker/internal/testutil" "github.com/gotestyourself/gotestyourself/poll" "github.com/stretchr/testify/assert" diff --git a/components/engine/integration/container/stats_test.go b/components/engine/integration/container/stats_test.go index f06407ec2d..577d446d15 100644 --- a/components/engine/integration/container/stats_test.go +++ b/components/engine/integration/container/stats_test.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/gotestyourself/gotestyourself/poll" "github.com/gotestyourself/gotestyourself/skip" "github.com/stretchr/testify/assert" diff --git a/components/engine/integration/container/stop_test.go b/components/engine/integration/container/stop_test.go index a66e70f071..0a9daff2bd 100644 --- a/components/engine/integration/container/stop_test.go +++ b/components/engine/integration/container/stop_test.go @@ -11,7 +11,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" "github.com/docker/docker/client" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/gotestyourself/gotestyourself/icmd" "github.com/gotestyourself/gotestyourself/poll" "github.com/gotestyourself/gotestyourself/skip" diff --git a/components/engine/integration/container/update_linux_test.go b/components/engine/integration/container/update_linux_test.go index d1238e724d..f8138624b9 100644 --- a/components/engine/integration/container/update_linux_test.go +++ b/components/engine/integration/container/update_linux_test.go @@ -14,7 +14,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/strslice" "github.com/docker/docker/client" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/docker/docker/pkg/stdcopy" "github.com/gotestyourself/gotestyourself/poll" "github.com/gotestyourself/gotestyourself/skip" diff --git a/components/engine/integration/image/commit_test.go b/components/engine/integration/image/commit_test.go index b5dd38a7e1..a515b706af 100644 --- a/components/engine/integration/image/commit_test.go +++ b/components/engine/integration/image/commit_test.go @@ -6,7 +6,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/components/engine/integration/image/import_test.go b/components/engine/integration/image/import_test.go index 4521a8a14e..b3a0c7c76c 100644 --- a/components/engine/integration/image/import_test.go +++ b/components/engine/integration/image/import_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/docker/docker/internal/testutil" ) diff --git a/components/engine/integration/util/request/client.go b/components/engine/integration/internal/request/client.go similarity index 98% rename from components/engine/integration/util/request/client.go rename to components/engine/integration/internal/request/client.go index 5c1ec08607..ca2486af4c 100644 --- a/components/engine/integration/util/request/client.go +++ b/components/engine/integration/internal/request/client.go @@ -1,4 +1,4 @@ -package request // import "github.com/docker/docker/integration/util/request" +package request // import "github.com/docker/docker/integration/internal/request" import ( "net" diff --git a/components/engine/integration/util/requirement/requirement.go b/components/engine/integration/internal/requirement/requirement.go similarity index 96% rename from components/engine/integration/util/requirement/requirement.go rename to components/engine/integration/internal/requirement/requirement.go index 07035dec87..f89eb03786 100644 --- a/components/engine/integration/util/requirement/requirement.go +++ b/components/engine/integration/internal/requirement/requirement.go @@ -1,4 +1,4 @@ -package requirement // import "github.com/docker/docker/integration/util/requirement" +package requirement // import "github.com/docker/docker/integration/internal/requirement" import ( "net/http" diff --git a/components/engine/integration/util/swarm/service.go b/components/engine/integration/internal/swarm/service.go similarity index 100% rename from components/engine/integration/util/swarm/service.go rename to components/engine/integration/internal/swarm/service.go diff --git a/components/engine/integration/network/delete_test.go b/components/engine/integration/network/delete_test.go index 25a42c9bd9..0877d8bc8c 100644 --- a/components/engine/integration/network/delete_test.go +++ b/components/engine/integration/network/delete_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/components/engine/integration/plugin/authz/authz_plugin_test.go b/components/engine/integration/plugin/authz/authz_plugin_test.go index 0d78d4c982..befebe4080 100644 --- a/components/engine/integration/plugin/authz/authz_plugin_test.go +++ b/components/engine/integration/plugin/authz/authz_plugin_test.go @@ -23,7 +23,7 @@ import ( eventtypes "github.com/docker/docker/api/types/events" networktypes "github.com/docker/docker/api/types/network" "github.com/docker/docker/client" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/docker/docker/internal/test/environment" "github.com/docker/docker/pkg/authorization" "github.com/gotestyourself/gotestyourself/skip" diff --git a/components/engine/integration/plugin/authz/authz_plugin_v2_test.go b/components/engine/integration/plugin/authz/authz_plugin_v2_test.go index 6b7a9df2ce..3f07f48f01 100644 --- a/components/engine/integration/plugin/authz/authz_plugin_v2_test.go +++ b/components/engine/integration/plugin/authz/authz_plugin_v2_test.go @@ -16,7 +16,7 @@ import ( networktypes "github.com/docker/docker/api/types/network" volumetypes "github.com/docker/docker/api/types/volume" "github.com/docker/docker/client" - "github.com/docker/docker/integration/util/requirement" + "github.com/docker/docker/integration/internal/requirement" "github.com/gotestyourself/gotestyourself/skip" "github.com/stretchr/testify/require" ) diff --git a/components/engine/integration/secret/secret_test.go b/components/engine/integration/secret/secret_test.go index 566598db97..3915bf5e82 100644 --- a/components/engine/integration/secret/secret_test.go +++ b/components/engine/integration/secret/secret_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/api/types/filters" swarmtypes "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" - "github.com/docker/docker/integration/util/swarm" + "github.com/docker/docker/integration/internal/swarm" "github.com/gotestyourself/gotestyourself/skip" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/engine/integration/service/create_test.go b/components/engine/integration/service/create_test.go index c74c8fb52e..eb66cfc2f1 100644 --- a/components/engine/integration/service/create_test.go +++ b/components/engine/integration/service/create_test.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/api/types/filters" swarmtypes "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" - "github.com/docker/docker/integration/util/swarm" + "github.com/docker/docker/integration/internal/swarm" "github.com/gotestyourself/gotestyourself/poll" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/engine/integration/service/inspect_test.go b/components/engine/integration/service/inspect_test.go index 8fe97d98ad..fdb22cf2f7 100644 --- a/components/engine/integration/service/inspect_test.go +++ b/components/engine/integration/service/inspect_test.go @@ -9,7 +9,7 @@ import ( "github.com/docker/docker/api/types/filters" swarmtypes "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" - "github.com/docker/docker/integration/util/swarm" + "github.com/docker/docker/integration/internal/swarm" "github.com/gotestyourself/gotestyourself/poll" "github.com/gotestyourself/gotestyourself/skip" "github.com/stretchr/testify/assert" diff --git a/components/engine/integration/service/network_test.go b/components/engine/integration/service/network_test.go index 1a9297c6b3..22b271c8c2 100644 --- a/components/engine/integration/service/network_test.go +++ b/components/engine/integration/service/network_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" "github.com/docker/docker/client" - "github.com/docker/docker/integration/util/swarm" + "github.com/docker/docker/integration/internal/swarm" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/components/engine/integration/system/event_test.go b/components/engine/integration/system/event_test.go index f9364cd232..5094e188ff 100644 --- a/components/engine/integration/system/event_test.go +++ b/components/engine/integration/system/event_test.go @@ -11,7 +11,7 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/strslice" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/stretchr/testify/require" ) diff --git a/components/engine/integration/system/info_linux_test.go b/components/engine/integration/system/info_linux_test.go index 513cef8676..8f0271e7a6 100644 --- a/components/engine/integration/system/info_linux_test.go +++ b/components/engine/integration/system/info_linux_test.go @@ -7,7 +7,7 @@ import ( "testing" req "github.com/docker/docker/integration-cli/request" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/net/context" diff --git a/components/engine/integration/system/info_test.go b/components/engine/integration/system/info_test.go index 4b90b5c61c..47c46cb871 100644 --- a/components/engine/integration/system/info_test.go +++ b/components/engine/integration/system/info_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/net/context" diff --git a/components/engine/integration/system/login_test.go b/components/engine/integration/system/login_test.go index 295f37cee1..c075109d2b 100644 --- a/components/engine/integration/system/login_test.go +++ b/components/engine/integration/system/login_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/docker/docker/integration/util/request" - "github.com/docker/docker/integration/util/requirement" + "github.com/docker/docker/integration/internal/request" + "github.com/docker/docker/integration/internal/requirement" "github.com/gotestyourself/gotestyourself/skip" "github.com/stretchr/testify/assert" "golang.org/x/net/context" diff --git a/components/engine/integration/system/version_test.go b/components/engine/integration/system/version_test.go index 605ab503da..04888a604a 100644 --- a/components/engine/integration/system/version_test.go +++ b/components/engine/integration/system/version_test.go @@ -3,7 +3,7 @@ package system // import "github.com/docker/docker/integration/system" import ( "testing" - "github.com/docker/docker/integration/util/request" + "github.com/docker/docker/integration/internal/request" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/net/context"