diff --git a/integration-cli/check_test.go b/integration-cli/check_test.go index 38eb63579c..92f2c77228 100644 --- a/integration-cli/check_test.go +++ b/integration-cli/check_test.go @@ -83,7 +83,7 @@ func init() { type DockerSuite struct { } -func (s *DockerSuite) OnTimeout(c *check.C) { +func (s *DockerSuite) OnTimeout(c *testing.T) { if testEnv.IsRemoteDaemon() { return } @@ -104,7 +104,7 @@ func (s *DockerSuite) OnTimeout(c *check.C) { } } -func (s *DockerSuite) TearDownTest(c *check.C) { +func (s *DockerSuite) TearDownTest(c *testing.T) { testEnv.Clean(c) } @@ -120,18 +120,18 @@ type DockerRegistrySuite struct { d *daemon.Daemon } -func (s *DockerRegistrySuite) OnTimeout(c *check.C) { +func (s *DockerRegistrySuite) OnTimeout(c *testing.T) { s.d.DumpStackAndQuit() } -func (s *DockerRegistrySuite) SetUpTest(c *check.C) { +func (s *DockerRegistrySuite) SetUpTest(c *testing.T) { testRequires(c, DaemonIsLinux, RegistryHosting, testEnv.IsLocalDaemon) s.reg = registry.NewV2(c) s.reg.WaitReady(c) s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) } -func (s *DockerRegistrySuite) TearDownTest(c *check.C) { +func (s *DockerRegistrySuite) TearDownTest(c *testing.T) { if s.reg != nil { s.reg.Close() } @@ -153,18 +153,18 @@ type DockerSchema1RegistrySuite struct { d *daemon.Daemon } -func (s *DockerSchema1RegistrySuite) OnTimeout(c *check.C) { +func (s *DockerSchema1RegistrySuite) OnTimeout(c *testing.T) { s.d.DumpStackAndQuit() } -func (s *DockerSchema1RegistrySuite) SetUpTest(c *check.C) { +func (s *DockerSchema1RegistrySuite) SetUpTest(c *testing.T) { testRequires(c, DaemonIsLinux, RegistryHosting, NotArm64, testEnv.IsLocalDaemon) s.reg = registry.NewV2(c, registry.Schema1) s.reg.WaitReady(c) s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) } -func (s *DockerSchema1RegistrySuite) TearDownTest(c *check.C) { +func (s *DockerSchema1RegistrySuite) TearDownTest(c *testing.T) { if s.reg != nil { s.reg.Close() } @@ -186,18 +186,18 @@ type DockerRegistryAuthHtpasswdSuite struct { d *daemon.Daemon } -func (s *DockerRegistryAuthHtpasswdSuite) OnTimeout(c *check.C) { +func (s *DockerRegistryAuthHtpasswdSuite) OnTimeout(c *testing.T) { s.d.DumpStackAndQuit() } -func (s *DockerRegistryAuthHtpasswdSuite) SetUpTest(c *check.C) { +func (s *DockerRegistryAuthHtpasswdSuite) SetUpTest(c *testing.T) { testRequires(c, DaemonIsLinux, RegistryHosting, testEnv.IsLocalDaemon) s.reg = registry.NewV2(c, registry.Htpasswd) s.reg.WaitReady(c) s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) } -func (s *DockerRegistryAuthHtpasswdSuite) TearDownTest(c *check.C) { +func (s *DockerRegistryAuthHtpasswdSuite) TearDownTest(c *testing.T) { if s.reg != nil { out, err := s.d.Cmd("logout", privateRegistryURL) assert.NilError(c, err, out) @@ -221,16 +221,16 @@ type DockerRegistryAuthTokenSuite struct { d *daemon.Daemon } -func (s *DockerRegistryAuthTokenSuite) OnTimeout(c *check.C) { +func (s *DockerRegistryAuthTokenSuite) OnTimeout(c *testing.T) { s.d.DumpStackAndQuit() } -func (s *DockerRegistryAuthTokenSuite) SetUpTest(c *check.C) { +func (s *DockerRegistryAuthTokenSuite) SetUpTest(c *testing.T) { testRequires(c, DaemonIsLinux, RegistryHosting, testEnv.IsLocalDaemon) s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) } -func (s *DockerRegistryAuthTokenSuite) TearDownTest(c *check.C) { +func (s *DockerRegistryAuthTokenSuite) TearDownTest(c *testing.T) { if s.reg != nil { out, err := s.d.Cmd("logout", privateRegistryURL) assert.NilError(c, err, out) @@ -242,7 +242,7 @@ func (s *DockerRegistryAuthTokenSuite) TearDownTest(c *check.C) { s.ds.TearDownTest(c) } -func (s *DockerRegistryAuthTokenSuite) setupRegistryWithTokenService(c *check.C, tokenURL string) { +func (s *DockerRegistryAuthTokenSuite) setupRegistryWithTokenService(c *testing.T, tokenURL string) { if s == nil { c.Fatal("registry suite isn't initialized") } @@ -261,16 +261,16 @@ type DockerDaemonSuite struct { d *daemon.Daemon } -func (s *DockerDaemonSuite) OnTimeout(c *check.C) { +func (s *DockerDaemonSuite) OnTimeout(c *testing.T) { s.d.DumpStackAndQuit() } -func (s *DockerDaemonSuite) SetUpTest(c *check.C) { +func (s *DockerDaemonSuite) SetUpTest(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) } -func (s *DockerDaemonSuite) TearDownTest(c *check.C) { +func (s *DockerDaemonSuite) TearDownTest(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) if s.d != nil { s.d.Stop(c) @@ -278,7 +278,7 @@ func (s *DockerDaemonSuite) TearDownTest(c *check.C) { s.ds.TearDownTest(c) } -func (s *DockerDaemonSuite) TearDownSuite(c *check.C) { +func (s *DockerDaemonSuite) TearDownSuite(c *testing.T) { filepath.Walk(testdaemon.SockRoot, func(path string, fi os.FileInfo, err error) error { if err != nil { // ignore errors here @@ -309,7 +309,7 @@ type DockerSwarmSuite struct { portIndex int } -func (s *DockerSwarmSuite) OnTimeout(c *check.C) { +func (s *DockerSwarmSuite) OnTimeout(c *testing.T) { s.daemonsLock.Lock() defer s.daemonsLock.Unlock() for _, d := range s.daemons { @@ -317,11 +317,11 @@ func (s *DockerSwarmSuite) OnTimeout(c *check.C) { } } -func (s *DockerSwarmSuite) SetUpTest(c *check.C) { +func (s *DockerSwarmSuite) SetUpTest(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) } -func (s *DockerSwarmSuite) AddDaemon(c *check.C, joinSwarm, manager bool) *daemon.Daemon { +func (s *DockerSwarmSuite) AddDaemon(c *testing.T, joinSwarm, manager bool) *daemon.Daemon { d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution), testdaemon.WithSwarmPort(defaultSwarmPort+s.portIndex), @@ -344,7 +344,7 @@ func (s *DockerSwarmSuite) AddDaemon(c *check.C, joinSwarm, manager bool) *daemo return d } -func (s *DockerSwarmSuite) TearDownTest(c *check.C) { +func (s *DockerSwarmSuite) TearDownTest(c *testing.T) { testRequires(c, DaemonIsLinux) s.daemonsLock.Lock() for _, d := range s.daemons { @@ -381,7 +381,7 @@ func (ps *DockerPluginSuite) getPluginRepoWithTag() string { return ps.getPluginRepo() + ":" + "latest" } -func (ps *DockerPluginSuite) SetUpSuite(c *check.C) { +func (ps *DockerPluginSuite) SetUpSuite(c *testing.T) { testRequires(c, DaemonIsLinux, RegistryHosting) ps.registry = registry.NewV2(c) ps.registry.WaitReady(c) @@ -393,16 +393,16 @@ func (ps *DockerPluginSuite) SetUpSuite(c *check.C) { assert.NilError(c, err, "failed to create plugin") } -func (ps *DockerPluginSuite) TearDownSuite(c *check.C) { +func (ps *DockerPluginSuite) TearDownSuite(c *testing.T) { if ps.registry != nil { ps.registry.Close() } } -func (ps *DockerPluginSuite) TearDownTest(c *check.C) { +func (ps *DockerPluginSuite) TearDownTest(c *testing.T) { ps.ds.TearDownTest(c) } -func (ps *DockerPluginSuite) OnTimeout(c *check.C) { +func (ps *DockerPluginSuite) OnTimeout(c *testing.T) { ps.ds.OnTimeout(c) } diff --git a/integration-cli/daemon/daemon.go b/integration-cli/daemon/daemon.go index 4bf773b314..ca89f4d455 100644 --- a/integration-cli/daemon/daemon.go +++ b/integration-cli/daemon/daemon.go @@ -88,7 +88,7 @@ func (d *Daemon) inspectFieldWithError(name, field string) (string, error) { // CheckActiveContainerCount returns the number of active containers // FIXME(vdemeester) should re-use ActivateContainers in some way -func (d *Daemon) CheckActiveContainerCount(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckActiveContainerCount(c *testing.T) (interface{}, check.CommentInterface) { out, err := d.Cmd("ps", "-q") assert.NilError(c, err) if len(strings.TrimSpace(out)) == 0 { diff --git a/integration-cli/daemon/daemon_swarm.go b/integration-cli/daemon/daemon_swarm.go index bbb124dd86..3e8ea4d19c 100644 --- a/integration-cli/daemon/daemon_swarm.go +++ b/integration-cli/daemon/daemon_swarm.go @@ -15,8 +15,8 @@ import ( // CheckServiceTasksInState returns the number of tasks with a matching state, // and optional message substring. -func (d *Daemon) CheckServiceTasksInState(service string, state swarm.TaskState, message string) func(*check.C) (interface{}, check.CommentInterface) { - return func(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckServiceTasksInState(service string, state swarm.TaskState, message string) func(*testing.T) (interface{}, check.CommentInterface) { + return func(c *testing.T) (interface{}, check.CommentInterface) { tasks := d.GetServiceTasks(c, service) var count int for _, task := range tasks { @@ -32,8 +32,8 @@ func (d *Daemon) CheckServiceTasksInState(service string, state swarm.TaskState, // CheckServiceTasksInStateWithError returns the number of tasks with a matching state, // and optional message substring. -func (d *Daemon) CheckServiceTasksInStateWithError(service string, state swarm.TaskState, errorMessage string) func(*check.C) (interface{}, check.CommentInterface) { - return func(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckServiceTasksInStateWithError(service string, state swarm.TaskState, errorMessage string) func(*testing.T) (interface{}, check.CommentInterface) { + return func(c *testing.T) (interface{}, check.CommentInterface) { tasks := d.GetServiceTasks(c, service) var count int for _, task := range tasks { @@ -48,13 +48,13 @@ func (d *Daemon) CheckServiceTasksInStateWithError(service string, state swarm.T } // CheckServiceRunningTasks returns the number of running tasks for the specified service -func (d *Daemon) CheckServiceRunningTasks(service string) func(*check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckServiceRunningTasks(service string) func(*testing.T) (interface{}, check.CommentInterface) { return d.CheckServiceTasksInState(service, swarm.TaskStateRunning, "") } // CheckServiceUpdateState returns the current update state for the specified service -func (d *Daemon) CheckServiceUpdateState(service string) func(*check.C) (interface{}, check.CommentInterface) { - return func(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckServiceUpdateState(service string) func(*testing.T) (interface{}, check.CommentInterface) { + return func(c *testing.T) (interface{}, check.CommentInterface) { service := d.GetService(c, service) if service.UpdateStatus == nil { return "", nil @@ -64,8 +64,8 @@ func (d *Daemon) CheckServiceUpdateState(service string) func(*check.C) (interfa } // CheckPluginRunning returns the runtime state of the plugin -func (d *Daemon) CheckPluginRunning(plugin string) func(c *check.C) (interface{}, check.CommentInterface) { - return func(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckPluginRunning(plugin string) func(c *testing.T) (interface{}, check.CommentInterface) { + return func(c *testing.T) (interface{}, check.CommentInterface) { apiclient := d.NewClientT(c) resp, _, err := apiclient.PluginInspectWithRaw(context.Background(), plugin) if client.IsErrNotFound(err) { @@ -77,8 +77,8 @@ func (d *Daemon) CheckPluginRunning(plugin string) func(c *check.C) (interface{} } // CheckPluginImage returns the runtime state of the plugin -func (d *Daemon) CheckPluginImage(plugin string) func(c *check.C) (interface{}, check.CommentInterface) { - return func(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckPluginImage(plugin string) func(c *testing.T) (interface{}, check.CommentInterface) { + return func(c *testing.T) (interface{}, check.CommentInterface) { apiclient := d.NewClientT(c) resp, _, err := apiclient.PluginInspectWithRaw(context.Background(), plugin) if client.IsErrNotFound(err) { @@ -90,15 +90,15 @@ func (d *Daemon) CheckPluginImage(plugin string) func(c *check.C) (interface{}, } // CheckServiceTasks returns the number of tasks for the specified service -func (d *Daemon) CheckServiceTasks(service string) func(*check.C) (interface{}, check.CommentInterface) { - return func(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckServiceTasks(service string) func(*testing.T) (interface{}, check.CommentInterface) { + return func(c *testing.T) (interface{}, check.CommentInterface) { tasks := d.GetServiceTasks(c, service) return len(tasks), nil } } // CheckRunningTaskNetworks returns the number of times each network is referenced from a task. -func (d *Daemon) CheckRunningTaskNetworks(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckRunningTaskNetworks(c *testing.T) (interface{}, check.CommentInterface) { cli := d.NewClientT(c) defer cli.Close() @@ -122,7 +122,7 @@ func (d *Daemon) CheckRunningTaskNetworks(c *check.C) (interface{}, check.Commen } // CheckRunningTaskImages returns the times each image is running as a task. -func (d *Daemon) CheckRunningTaskImages(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckRunningTaskImages(c *testing.T) (interface{}, check.CommentInterface) { cli := d.NewClientT(c) defer cli.Close() @@ -146,7 +146,7 @@ func (d *Daemon) CheckRunningTaskImages(c *check.C) (interface{}, check.CommentI } // CheckNodeReadyCount returns the number of ready node on the swarm -func (d *Daemon) CheckNodeReadyCount(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckNodeReadyCount(c *testing.T) (interface{}, check.CommentInterface) { nodes := d.ListNodes(c) var readyCount int for _, node := range nodes { @@ -158,20 +158,20 @@ func (d *Daemon) CheckNodeReadyCount(c *check.C) (interface{}, check.CommentInte } // CheckLocalNodeState returns the current swarm node state -func (d *Daemon) CheckLocalNodeState(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckLocalNodeState(c *testing.T) (interface{}, check.CommentInterface) { info := d.SwarmInfo(c) return info.LocalNodeState, nil } // CheckControlAvailable returns the current swarm control available -func (d *Daemon) CheckControlAvailable(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckControlAvailable(c *testing.T) (interface{}, check.CommentInterface) { info := d.SwarmInfo(c) assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive) return info.ControlAvailable, nil } // CheckLeader returns whether there is a leader on the swarm or not -func (d *Daemon) CheckLeader(c *check.C) (interface{}, check.CommentInterface) { +func (d *Daemon) CheckLeader(c *testing.T) (interface{}, check.CommentInterface) { cli := d.NewClientT(c) defer cli.Close() diff --git a/integration-cli/daemon_swarm_hack_test.go b/integration-cli/daemon_swarm_hack_test.go index 7a23e84bfc..5d3fbd294a 100644 --- a/integration-cli/daemon_swarm_hack_test.go +++ b/integration-cli/daemon_swarm_hack_test.go @@ -5,7 +5,7 @@ import ( "github.com/go-check/check" ) -func (s *DockerSwarmSuite) getDaemon(c *check.C, nodeID string) *daemon.Daemon { +func (s *DockerSwarmSuite) getDaemon(c *testing.T, nodeID string) *daemon.Daemon { s.daemonsLock.Lock() defer s.daemonsLock.Unlock() for _, d := range s.daemons { @@ -18,6 +18,6 @@ func (s *DockerSwarmSuite) getDaemon(c *check.C, nodeID string) *daemon.Daemon { } // nodeCmd executes a command on a given node via the normal docker socket -func (s *DockerSwarmSuite) nodeCmd(c *check.C, id string, args ...string) (string, error) { +func (s *DockerSwarmSuite) nodeCmd(c *testing.T, id string, args ...string) (string, error) { return s.getDaemon(c, id).Cmd(args...) } diff --git a/integration-cli/docker_api_attach_test.go b/integration-cli/docker_api_attach_test.go index 00f8bc9d6f..7b4d7c72be 100644 --- a/integration-cli/docker_api_attach_test.go +++ b/integration-cli/docker_api_attach_test.go @@ -23,7 +23,7 @@ import ( is "gotest.tools/assert/cmp" ) -func (s *DockerSuite) TestGetContainersAttachWebsocket(c *check.C) { +func (s *DockerSuite) TestGetContainersAttachWebsocket(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-dit", "busybox", "cat") @@ -76,7 +76,7 @@ func (s *DockerSuite) TestGetContainersAttachWebsocket(c *check.C) { } // regression gh14320 -func (s *DockerSuite) TestPostContainersAttachContainerNotFound(c *check.C) { +func (s *DockerSuite) TestPostContainersAttachContainerNotFound(c *testing.T) { resp, _, err := request.Post("/containers/doesnotexist/attach") assert.NilError(c, err) // connection will shutdown, err should be "persistent connection closed" @@ -87,7 +87,7 @@ func (s *DockerSuite) TestPostContainersAttachContainerNotFound(c *check.C) { assert.Equal(c, string(content), expected) } -func (s *DockerSuite) TestGetContainersWsAttachContainerNotFound(c *check.C) { +func (s *DockerSuite) TestGetContainersWsAttachContainerNotFound(c *testing.T) { res, body, err := request.Get("/containers/doesnotexist/attach/ws") assert.Equal(c, res.StatusCode, http.StatusNotFound) assert.NilError(c, err) @@ -97,7 +97,7 @@ func (s *DockerSuite) TestGetContainersWsAttachContainerNotFound(c *check.C) { assert.Assert(c, strings.Contains(getErrorMessage(c, b), expected)) } -func (s *DockerSuite) TestPostContainersAttach(c *check.C) { +func (s *DockerSuite) TestPostContainersAttach(c *testing.T) { testRequires(c, DaemonIsLinux) expectSuccess := func(conn net.Conn, br *bufio.Reader, stream string, tty bool) { diff --git a/integration-cli/docker_api_build_test.go b/integration-cli/docker_api_build_test.go index e82d54cb59..30b4540385 100644 --- a/integration-cli/docker_api_build_test.go +++ b/integration-cli/docker_api_build_test.go @@ -22,7 +22,7 @@ import ( is "gotest.tools/assert/cmp" ) -func (s *DockerSuite) TestBuildAPIDockerFileRemote(c *check.C) { +func (s *DockerSuite) TestBuildAPIDockerFileRemote(c *testing.T) { testRequires(c, NotUserNamespace) var testD string @@ -53,7 +53,7 @@ RUN find /tmp/` assert.Assert(c, !strings.Contains(out, "baz")) } -func (s *DockerSuite) TestBuildAPIRemoteTarballContext(c *check.C) { +func (s *DockerSuite) TestBuildAPIRemoteTarballContext(c *testing.T) { buffer := new(bytes.Buffer) tw := tar.NewWriter(buffer) defer tw.Close() @@ -80,7 +80,7 @@ func (s *DockerSuite) TestBuildAPIRemoteTarballContext(c *check.C) { b.Close() } -func (s *DockerSuite) TestBuildAPIRemoteTarballContextWithCustomDockerfile(c *check.C) { +func (s *DockerSuite) TestBuildAPIRemoteTarballContextWithCustomDockerfile(c *testing.T) { buffer := new(bytes.Buffer) tw := tar.NewWriter(buffer) defer tw.Close() @@ -134,7 +134,7 @@ RUN echo 'right' assert.Assert(c, !strings.Contains(string(content), "wrong")) } -func (s *DockerSuite) TestBuildAPILowerDockerfile(c *check.C) { +func (s *DockerSuite) TestBuildAPILowerDockerfile(c *testing.T) { git := fakegit.New(c, "repo", map[string]string{ "dockerfile": `FROM busybox RUN echo from dockerfile`, @@ -152,7 +152,7 @@ RUN echo from dockerfile`, assert.Assert(c, is.Contains(out, "from dockerfile")) } -func (s *DockerSuite) TestBuildAPIBuildGitWithF(c *check.C) { +func (s *DockerSuite) TestBuildAPIBuildGitWithF(c *testing.T) { git := fakegit.New(c, "repo", map[string]string{ "baz": `FROM busybox RUN echo from baz`, @@ -173,7 +173,7 @@ RUN echo from Dockerfile`, assert.Assert(c, is.Contains(out, "from baz")) } -func (s *DockerSuite) TestBuildAPIDoubleDockerfile(c *check.C) { +func (s *DockerSuite) TestBuildAPIDoubleDockerfile(c *testing.T) { testRequires(c, UnixCli) // dockerfile overwrites Dockerfile on Windows git := fakegit.New(c, "repo", map[string]string{ "Dockerfile": `FROM busybox @@ -195,7 +195,7 @@ RUN echo from dockerfile`, assert.Assert(c, is.Contains(out, "from Dockerfile")) } -func (s *DockerSuite) TestBuildAPIUnnormalizedTarPaths(c *check.C) { +func (s *DockerSuite) TestBuildAPIUnnormalizedTarPaths(c *testing.T) { // Make sure that build context tars with entries of the form // x/./y don't cause caching false positives. @@ -254,7 +254,7 @@ func (s *DockerSuite) TestBuildAPIUnnormalizedTarPaths(c *check.C) { assert.Assert(c, imageA != imageB) } -func (s *DockerSuite) TestBuildOnBuildWithCopy(c *check.C) { +func (s *DockerSuite) TestBuildOnBuildWithCopy(c *testing.T) { dockerfile := ` FROM ` + minimalBaseImage() + ` as onbuildbase ONBUILD COPY file /file @@ -279,7 +279,7 @@ func (s *DockerSuite) TestBuildOnBuildWithCopy(c *check.C) { assert.Assert(c, is.Contains(string(out), "Successfully built")) } -func (s *DockerSuite) TestBuildOnBuildCache(c *check.C) { +func (s *DockerSuite) TestBuildOnBuildCache(c *testing.T) { build := func(dockerfile string) []byte { ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(dockerfile), @@ -321,7 +321,7 @@ func (s *DockerSuite) TestBuildOnBuildCache(c *check.C) { assert.Check(c, is.Equal(parentID, image.Parent)) } -func (s *DockerRegistrySuite) TestBuildCopyFromForcePull(c *check.C) { +func (s *DockerRegistrySuite) TestBuildCopyFromForcePull(c *testing.T) { client := testEnv.APIClient() repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) @@ -358,7 +358,7 @@ func (s *DockerRegistrySuite) TestBuildCopyFromForcePull(c *check.C) { assert.Check(c, is.Contains(string(out), "Successfully built")) } -func (s *DockerSuite) TestBuildAddRemoteNoDecompress(c *check.C) { +func (s *DockerSuite) TestBuildAddRemoteNoDecompress(c *testing.T) { buffer := new(bytes.Buffer) tw := tar.NewWriter(buffer) dt := []byte("contents") @@ -402,7 +402,7 @@ func (s *DockerSuite) TestBuildAddRemoteNoDecompress(c *check.C) { assert.Check(c, is.Contains(string(out), "Successfully built")) } -func (s *DockerSuite) TestBuildChownOnCopy(c *check.C) { +func (s *DockerSuite) TestBuildChownOnCopy(c *testing.T) { // new feature added in 1.31 - https://github.com/moby/moby/pull/34263 testRequires(c, DaemonIsLinux, MinimumAPIVersion("1.31")) dockerfile := `FROM busybox @@ -432,7 +432,7 @@ func (s *DockerSuite) TestBuildChownOnCopy(c *check.C) { assert.Check(c, is.Contains(string(out), "Successfully built")) } -func (s *DockerSuite) TestBuildCopyCacheOnFileChange(c *check.C) { +func (s *DockerSuite) TestBuildCopyCacheOnFileChange(c *testing.T) { dockerfile := `FROM busybox COPY file /file` @@ -473,7 +473,7 @@ COPY file /file` } } -func (s *DockerSuite) TestBuildAddCacheOnFileChange(c *check.C) { +func (s *DockerSuite) TestBuildAddCacheOnFileChange(c *testing.T) { dockerfile := `FROM busybox ADD file /file` @@ -514,7 +514,7 @@ ADD file /file` } } -func (s *DockerSuite) TestBuildScratchCopy(c *check.C) { +func (s *DockerSuite) TestBuildScratchCopy(c *testing.T) { testRequires(c, DaemonIsLinux) dockerfile := `FROM scratch ADD Dockerfile / @@ -543,7 +543,7 @@ type buildLine struct { } } -func getImageIDsFromBuild(c *check.C, output []byte) []string { +func getImageIDsFromBuild(c *testing.T, output []byte) []string { var ids []string for _, line := range bytes.Split(output, []byte("\n")) { if len(line) == 0 { diff --git a/integration-cli/docker_api_build_windows_test.go b/integration-cli/docker_api_build_windows_test.go index d100c8e297..1f3dd4710d 100644 --- a/integration-cli/docker_api_build_windows_test.go +++ b/integration-cli/docker_api_build_windows_test.go @@ -12,7 +12,7 @@ import ( is "gotest.tools/assert/cmp" ) -func (s *DockerSuite) TestBuildWithRecycleBin(c *check.C) { +func (s *DockerSuite) TestBuildWithRecycleBin(c *testing.T) { testRequires(c, DaemonIsWindows) dockerfile := "" + diff --git a/integration-cli/docker_api_containers_test.go b/integration-cli/docker_api_containers_test.go index 62354d4221..50f3b44d55 100644 --- a/integration-cli/docker_api_containers_test.go +++ b/integration-cli/docker_api_containers_test.go @@ -37,7 +37,7 @@ import ( "gotest.tools/poll" ) -func (s *DockerSuite) TestContainerAPIGetAll(c *check.C) { +func (s *DockerSuite) TestContainerAPIGetAll(c *testing.T) { startCount := getContainerCount(c) name := "getall" dockerCmd(c, "run", "--name", name, "busybox", "true") @@ -57,7 +57,7 @@ func (s *DockerSuite) TestContainerAPIGetAll(c *check.C) { } // regression test for empty json field being omitted #13691 -func (s *DockerSuite) TestContainerAPIGetJSONNoFieldsOmitted(c *check.C) { +func (s *DockerSuite) TestContainerAPIGetJSONNoFieldsOmitted(c *testing.T) { startCount := getContainerCount(c) dockerCmd(c, "run", "busybox", "true") @@ -97,7 +97,7 @@ func (s *DockerSuite) TestContainerAPIGetJSONNoFieldsOmitted(c *check.C) { } } -func (s *DockerSuite) TestContainerAPIGetExport(c *check.C) { +func (s *DockerSuite) TestContainerAPIGetExport(c *testing.T) { // Not supported on Windows as Windows does not support docker export testRequires(c, DaemonIsLinux) name := "exportcontainer" @@ -124,7 +124,7 @@ func (s *DockerSuite) TestContainerAPIGetExport(c *check.C) { assert.Assert(c, found, checker.True, check.Commentf("The created test file has not been found in the exported image")) } -func (s *DockerSuite) TestContainerAPIGetChanges(c *check.C) { +func (s *DockerSuite) TestContainerAPIGetChanges(c *testing.T) { // Not supported on Windows as Windows does not support docker diff (/containers/name/changes) testRequires(c, DaemonIsLinux) name := "changescontainer" @@ -147,7 +147,7 @@ func (s *DockerSuite) TestContainerAPIGetChanges(c *check.C) { assert.Assert(c, success, checker.True, check.Commentf("/etc/passwd has been removed but is not present in the diff")) } -func (s *DockerSuite) TestGetContainerStats(c *check.C) { +func (s *DockerSuite) TestGetContainerStats(c *testing.T) { var ( name = "statscontainer" ) @@ -187,7 +187,7 @@ func (s *DockerSuite) TestGetContainerStats(c *check.C) { } } -func (s *DockerSuite) TestGetContainerStatsRmRunning(c *check.C) { +func (s *DockerSuite) TestGetContainerStatsRmRunning(c *testing.T) { out := runSleepingContainer(c) id := strings.TrimSpace(out) @@ -254,7 +254,7 @@ func (c *ChannelBuffer) ReadTimeout(p []byte, n time.Duration) (int, error) { // regression test for gh13421 // previous test was just checking one stat entry so it didn't fail (stats with // stream false always return one stat) -func (s *DockerSuite) TestGetContainerStatsStream(c *check.C) { +func (s *DockerSuite) TestGetContainerStatsStream(c *testing.T) { name := "statscontainer" runSleepingContainer(c, "--name", name) @@ -295,7 +295,7 @@ func (s *DockerSuite) TestGetContainerStatsStream(c *check.C) { } } -func (s *DockerSuite) TestGetContainerStatsNoStream(c *check.C) { +func (s *DockerSuite) TestGetContainerStatsNoStream(c *testing.T) { name := "statscontainer" runSleepingContainer(c, "--name", name) @@ -335,7 +335,7 @@ func (s *DockerSuite) TestGetContainerStatsNoStream(c *check.C) { } } -func (s *DockerSuite) TestGetStoppedContainerStats(c *check.C) { +func (s *DockerSuite) TestGetStoppedContainerStats(c *testing.T) { name := "statscontainer" dockerCmd(c, "create", "--name", name, "busybox", "ps") @@ -361,11 +361,11 @@ func (s *DockerSuite) TestGetStoppedContainerStats(c *check.C) { } } -func (s *DockerSuite) TestContainerAPIPause(c *check.C) { +func (s *DockerSuite) TestContainerAPIPause(c *testing.T) { // Problematic on Windows as Windows does not support pause testRequires(c, DaemonIsLinux) - getPaused := func(c *check.C) []string { + getPaused := func(c *testing.T) []string { return strings.Fields(cli.DockerCmd(c, "ps", "-f", "status=paused", "-q", "-a").Combined()) } @@ -392,7 +392,7 @@ func (s *DockerSuite) TestContainerAPIPause(c *check.C) { assert.Assert(c, pausedContainers, checker.HasLen, 0, check.Commentf("There should be no paused container.")) } -func (s *DockerSuite) TestContainerAPITop(c *check.C) { +func (s *DockerSuite) TestContainerAPITop(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "top") id := strings.TrimSpace(string(out)) @@ -415,7 +415,7 @@ func (s *DockerSuite) TestContainerAPITop(c *check.C) { assert.Assert(c, top.Processes[1][10], checker.Equals, "top") } -func (s *DockerSuite) TestContainerAPITopWindows(c *check.C) { +func (s *DockerSuite) TestContainerAPITopWindows(c *testing.T) { testRequires(c, DaemonIsWindows) out := runSleepingContainer(c, "-d") id := strings.TrimSpace(string(out)) @@ -446,7 +446,7 @@ func (s *DockerSuite) TestContainerAPITopWindows(c *check.C) { assert.Assert(c, foundProcess, "expected to find %s: %v", expectedProcess, top.Processes) } -func (s *DockerSuite) TestContainerAPICommit(c *check.C) { +func (s *DockerSuite) TestContainerAPICommit(c *testing.T) { cName := "testapicommit" dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test") @@ -468,7 +468,7 @@ func (s *DockerSuite) TestContainerAPICommit(c *check.C) { dockerCmd(c, "run", img.ID, "ls", "/test") } -func (s *DockerSuite) TestContainerAPICommitWithLabelInConfig(c *check.C) { +func (s *DockerSuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) { cName := "testapicommitwithconfig" dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test") @@ -500,7 +500,7 @@ func (s *DockerSuite) TestContainerAPICommitWithLabelInConfig(c *check.C) { dockerCmd(c, "run", img.ID, "ls", "/test") } -func (s *DockerSuite) TestContainerAPIBadPort(c *check.C) { +func (s *DockerSuite) TestContainerAPIBadPort(c *testing.T) { // TODO Windows to Windows CI - Port this test testRequires(c, DaemonIsLinux) @@ -527,7 +527,7 @@ func (s *DockerSuite) TestContainerAPIBadPort(c *check.C) { assert.ErrorContains(c, err, `invalid port specification: "aa80"`) } -func (s *DockerSuite) TestContainerAPICreate(c *check.C) { +func (s *DockerSuite) TestContainerAPICreate(c *testing.T) { config := containertypes.Config{ Image: "busybox", Cmd: []string{"/bin/sh", "-c", "touch /test && ls /test"}, @@ -544,7 +544,7 @@ func (s *DockerSuite) TestContainerAPICreate(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "/test") } -func (s *DockerSuite) TestContainerAPICreateEmptyConfig(c *check.C) { +func (s *DockerSuite) TestContainerAPICreateEmptyConfig(c *testing.T) { cli, err := client.NewClientWithOpts(client.FromEnv) assert.NilError(c, err) @@ -556,7 +556,7 @@ func (s *DockerSuite) TestContainerAPICreateEmptyConfig(c *check.C) { assert.ErrorContains(c, err, expected) } -func (s *DockerSuite) TestContainerAPICreateMultipleNetworksConfig(c *check.C) { +func (s *DockerSuite) TestContainerAPICreateMultipleNetworksConfig(c *testing.T) { // Container creation must fail if client specified configurations for more than one network config := containertypes.Config{ Image: "busybox", @@ -583,20 +583,20 @@ func (s *DockerSuite) TestContainerAPICreateMultipleNetworksConfig(c *check.C) { assert.Assert(c, msg, checker.Contains, "net3") } -func (s *DockerSuite) TestContainerAPICreateBridgeNetworkMode(c *check.C) { +func (s *DockerSuite) TestContainerAPICreateBridgeNetworkMode(c *testing.T) { // Windows does not support bridge testRequires(c, DaemonIsLinux) UtilCreateNetworkMode(c, "bridge") } -func (s *DockerSuite) TestContainerAPICreateOtherNetworkModes(c *check.C) { +func (s *DockerSuite) TestContainerAPICreateOtherNetworkModes(c *testing.T) { // Windows does not support these network modes testRequires(c, DaemonIsLinux, NotUserNamespace) UtilCreateNetworkMode(c, "host") UtilCreateNetworkMode(c, "container:web1") } -func UtilCreateNetworkMode(c *check.C, networkMode containertypes.NetworkMode) { +func UtilCreateNetworkMode(c *testing.T, networkMode containertypes.NetworkMode) { config := containertypes.Config{ Image: "busybox", } @@ -618,7 +618,7 @@ func UtilCreateNetworkMode(c *check.C, networkMode containertypes.NetworkMode) { assert.Assert(c, containerJSON.HostConfig.NetworkMode, checker.Equals, containertypes.NetworkMode(networkMode), check.Commentf("Mismatched NetworkMode")) } -func (s *DockerSuite) TestContainerAPICreateWithCpuSharesCpuset(c *check.C) { +func (s *DockerSuite) TestContainerAPICreateWithCpuSharesCpuset(c *testing.T) { // TODO Windows to Windows CI. The CpuShares part could be ported. testRequires(c, DaemonIsLinux) config := containertypes.Config{ @@ -649,7 +649,7 @@ func (s *DockerSuite) TestContainerAPICreateWithCpuSharesCpuset(c *check.C) { assert.Assert(c, outCpuset, checker.Equals, "0") } -func (s *DockerSuite) TestContainerAPIVerifyHeader(c *check.C) { +func (s *DockerSuite) TestContainerAPIVerifyHeader(c *testing.T) { config := map[string]interface{}{ "Image": "busybox", } @@ -690,7 +690,7 @@ func (s *DockerSuite) TestContainerAPIVerifyHeader(c *check.C) { } //Issue 14230. daemon should return 500 for invalid port syntax -func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *check.C) { +func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *testing.T) { config := `{ "Image": "busybox", "HostConfig": { @@ -716,7 +716,7 @@ func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *check.C) { assert.Assert(c, string(b[:]), checker.Contains, "invalid port") } -func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *check.C) { +func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *testing.T) { config := `{ "Image": "busybox", "HostConfig": { @@ -740,7 +740,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *check.C) assert.Assert(c, string(b[:]), checker.Contains, "invalid restart policy") } -func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *check.C) { +func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *testing.T) { config := `{ "Image": "busybox", "HostConfig": { @@ -764,7 +764,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *check.C) { assert.Assert(c, string(b[:]), checker.Contains, "maximum retry count cannot be used with restart policy") } -func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *check.C) { +func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *testing.T) { config := `{ "Image": "busybox", "HostConfig": { @@ -788,7 +788,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *check.C assert.Assert(c, string(b[:]), checker.Contains, "maximum retry count cannot be negative") } -func (s *DockerSuite) TestContainerAPIRestartPolicyDefaultRetryCount(c *check.C) { +func (s *DockerSuite) TestContainerAPIRestartPolicyDefaultRetryCount(c *testing.T) { config := `{ "Image": "busybox", "HostConfig": { @@ -806,7 +806,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyDefaultRetryCount(c *check.C) // Issue 7941 - test to make sure a "null" in JSON is just ignored. // W/o this fix a null in JSON would be parsed into a string var as "null" -func (s *DockerSuite) TestContainerAPIPostCreateNull(c *check.C) { +func (s *DockerSuite) TestContainerAPIPostCreateNull(c *testing.T) { config := `{ "Hostname":"", "Domainname":"", @@ -850,7 +850,7 @@ func (s *DockerSuite) TestContainerAPIPostCreateNull(c *check.C) { assert.Assert(c, outMemorySwap, checker.Equals, "0") } -func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *check.C) { +func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *testing.T) { // TODO Windows: Port once memory is supported testRequires(c, DaemonIsLinux) config := `{ @@ -874,7 +874,7 @@ func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *check.C) { assert.Assert(c, string(b), checker.Contains, "Minimum memory limit allowed is 4MB") } -func (s *DockerSuite) TestContainerAPIRename(c *check.C) { +func (s *DockerSuite) TestContainerAPIRename(c *testing.T) { out, _ := dockerCmd(c, "run", "--name", "TestContainerAPIRename", "-d", "busybox", "sh") containerID := strings.TrimSpace(out) @@ -891,7 +891,7 @@ func (s *DockerSuite) TestContainerAPIRename(c *check.C) { assert.Assert(c, name, checker.Equals, "/"+newName, check.Commentf("Failed to rename container")) } -func (s *DockerSuite) TestContainerAPIKill(c *check.C) { +func (s *DockerSuite) TestContainerAPIKill(c *testing.T) { name := "test-api-kill" runSleepingContainer(c, "-i", "--name", name) @@ -906,7 +906,7 @@ func (s *DockerSuite) TestContainerAPIKill(c *check.C) { assert.Assert(c, state, checker.Equals, "false", check.Commentf("got wrong State from container %s: %q", name, state)) } -func (s *DockerSuite) TestContainerAPIRestart(c *check.C) { +func (s *DockerSuite) TestContainerAPIRestart(c *testing.T) { name := "test-api-restart" runSleepingContainer(c, "-di", "--name", name) cli, err := client.NewClientWithOpts(client.FromEnv) @@ -920,7 +920,7 @@ func (s *DockerSuite) TestContainerAPIRestart(c *check.C) { assert.Assert(c, waitInspect(name, "{{ .State.Restarting }} {{ .State.Running }}", "false true", 15*time.Second), checker.IsNil) } -func (s *DockerSuite) TestContainerAPIRestartNotimeoutParam(c *check.C) { +func (s *DockerSuite) TestContainerAPIRestartNotimeoutParam(c *testing.T) { name := "test-api-restart-no-timeout-param" out := runSleepingContainer(c, "-di", "--name", name) id := strings.TrimSpace(out) @@ -936,7 +936,7 @@ func (s *DockerSuite) TestContainerAPIRestartNotimeoutParam(c *check.C) { assert.Assert(c, waitInspect(name, "{{ .State.Restarting }} {{ .State.Running }}", "false true", 15*time.Second), checker.IsNil) } -func (s *DockerSuite) TestContainerAPIStart(c *check.C) { +func (s *DockerSuite) TestContainerAPIStart(c *testing.T) { name := "testing-start" config := containertypes.Config{ Image: "busybox", @@ -962,7 +962,7 @@ func (s *DockerSuite) TestContainerAPIStart(c *check.C) { // TODO(tibor): figure out why this doesn't work on windows } -func (s *DockerSuite) TestContainerAPIStop(c *check.C) { +func (s *DockerSuite) TestContainerAPIStop(c *testing.T) { name := "test-api-stop" runSleepingContainer(c, "-i", "--name", name) timeout := 30 * time.Second @@ -981,7 +981,7 @@ func (s *DockerSuite) TestContainerAPIStop(c *check.C) { assert.NilError(c, err) } -func (s *DockerSuite) TestContainerAPIWait(c *check.C) { +func (s *DockerSuite) TestContainerAPIWait(c *testing.T) { name := "test-api-wait" sleepCmd := "/bin/sleep" @@ -1004,7 +1004,7 @@ func (s *DockerSuite) TestContainerAPIWait(c *check.C) { } } -func (s *DockerSuite) TestContainerAPICopyNotExistsAnyMore(c *check.C) { +func (s *DockerSuite) TestContainerAPICopyNotExistsAnyMore(c *testing.T) { name := "test-container-api-copy" dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt") @@ -1017,7 +1017,7 @@ func (s *DockerSuite) TestContainerAPICopyNotExistsAnyMore(c *check.C) { assert.Equal(c, res.StatusCode, http.StatusNotFound) } -func (s *DockerSuite) TestContainerAPICopyPre124(c *check.C) { +func (s *DockerSuite) TestContainerAPICopyPre124(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later name := "test-container-api-copy" dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt") @@ -1047,7 +1047,7 @@ func (s *DockerSuite) TestContainerAPICopyPre124(c *check.C) { assert.Assert(c, found, checker.True) } -func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *check.C) { +func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later name := "test-container-api-copy-resource-empty" dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt") @@ -1068,7 +1068,7 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *check.C) { assert.Assert(c, string(b), checker.Matches, "Path cannot be empty\n") } -func (s *DockerSuite) TestContainerAPICopyResourcePathNotFoundPre124(c *check.C) { +func (s *DockerSuite) TestContainerAPICopyResourcePathNotFoundPre124(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later name := "test-container-api-copy-resource-not-found" dockerCmd(c, "run", "--name", name, "busybox") @@ -1089,7 +1089,7 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathNotFoundPre124(c *check.C) assert.Assert(c, string(b), checker.Matches, "Could not find the file /notexist in container "+name+"\n") } -func (s *DockerSuite) TestContainerAPICopyContainerNotFoundPr124(c *check.C) { +func (s *DockerSuite) TestContainerAPICopyContainerNotFoundPr124(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later postData := types.CopyConfig{ Resource: "/something", @@ -1100,7 +1100,7 @@ func (s *DockerSuite) TestContainerAPICopyContainerNotFoundPr124(c *check.C) { assert.Equal(c, res.StatusCode, http.StatusNotFound) } -func (s *DockerSuite) TestContainerAPIDelete(c *check.C) { +func (s *DockerSuite) TestContainerAPIDelete(c *testing.T) { out := runSleepingContainer(c) id := strings.TrimSpace(out) @@ -1116,7 +1116,7 @@ func (s *DockerSuite) TestContainerAPIDelete(c *check.C) { assert.NilError(c, err) } -func (s *DockerSuite) TestContainerAPIDeleteNotExist(c *check.C) { +func (s *DockerSuite) TestContainerAPIDeleteNotExist(c *testing.T) { cli, err := client.NewClientWithOpts(client.FromEnv) assert.NilError(c, err) defer cli.Close() @@ -1125,7 +1125,7 @@ func (s *DockerSuite) TestContainerAPIDeleteNotExist(c *check.C) { assert.ErrorContains(c, err, "No such container: doesnotexist") } -func (s *DockerSuite) TestContainerAPIDeleteForce(c *check.C) { +func (s *DockerSuite) TestContainerAPIDeleteForce(c *testing.T) { out := runSleepingContainer(c) id := strings.TrimSpace(out) assert.NilError(c, waitRun(id)) @@ -1142,7 +1142,7 @@ func (s *DockerSuite) TestContainerAPIDeleteForce(c *check.C) { assert.NilError(c, err) } -func (s *DockerSuite) TestContainerAPIDeleteRemoveLinks(c *check.C) { +func (s *DockerSuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) { // Windows does not support links testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "--name", "tlink1", "busybox", "top") @@ -1173,7 +1173,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveLinks(c *check.C) { assert.Assert(c, linksPostRm, checker.Equals, "null", check.Commentf("call to api deleteContainer links should have removed the specified links")) } -func (s *DockerSuite) TestContainerAPIDeleteConflict(c *check.C) { +func (s *DockerSuite) TestContainerAPIDeleteConflict(c *testing.T) { out := runSleepingContainer(c) id := strings.TrimSpace(out) @@ -1188,7 +1188,7 @@ func (s *DockerSuite) TestContainerAPIDeleteConflict(c *check.C) { assert.ErrorContains(c, err, expected) } -func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *check.C) { +func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) vol := "/testvolume" @@ -1223,7 +1223,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *check.C) { } // Regression test for https://github.com/docker/docker/issues/6231 -func (s *DockerSuite) TestContainerAPIChunkedEncoding(c *check.C) { +func (s *DockerSuite) TestContainerAPIChunkedEncoding(c *testing.T) { config := map[string]interface{}{ "Image": "busybox", @@ -1243,7 +1243,7 @@ func (s *DockerSuite) TestContainerAPIChunkedEncoding(c *check.C) { assert.Equal(c, resp.StatusCode, http.StatusCreated) } -func (s *DockerSuite) TestContainerAPIPostContainerStop(c *check.C) { +func (s *DockerSuite) TestContainerAPIPostContainerStop(c *testing.T) { out := runSleepingContainer(c) containerID := strings.TrimSpace(out) @@ -1259,7 +1259,7 @@ func (s *DockerSuite) TestContainerAPIPostContainerStop(c *check.C) { } // #14170 -func (s *DockerSuite) TestPostContainerAPICreateWithStringOrSliceEntrypoint(c *check.C) { +func (s *DockerSuite) TestPostContainerAPICreateWithStringOrSliceEntrypoint(c *testing.T) { config := containertypes.Config{ Image: "busybox", Entrypoint: []string{"echo"}, @@ -1287,7 +1287,7 @@ func (s *DockerSuite) TestPostContainerAPICreateWithStringOrSliceEntrypoint(c *c } // #14170 -func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *check.C) { +func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *testing.T) { config := containertypes.Config{ Image: "busybox", Cmd: []string{"echo", "hello", "world"}, @@ -1316,7 +1316,7 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *check.C) { // regression #14318 // for backward compatibility testing with and without CAP_ prefix // and with upper and lowercase -func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *check.C) { +func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *testing.T) { // Windows doesn't support CapAdd/CapDrop testRequires(c, DaemonIsLinux) config := struct { @@ -1345,7 +1345,7 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *che } // #14915 -func (s *DockerSuite) TestContainerAPICreateNoHostConfig118(c *check.C) { +func (s *DockerSuite) TestContainerAPICreateNoHostConfig118(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows only support 1.25 or later config := containertypes.Config{ Image: "busybox", @@ -1361,7 +1361,7 @@ func (s *DockerSuite) TestContainerAPICreateNoHostConfig118(c *check.C) { // Ensure an error occurs when you have a container read-only rootfs but you // extract an archive to a symlink in a writable volume which points to a // directory outside of the volume. -func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(c *check.C) { +func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(c *testing.T) { // Windows does not support read-only rootfs // Requires local volume mount bind. // --read-only + userns has remount issues @@ -1387,7 +1387,7 @@ func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs( assert.ErrorContains(c, err, "container rootfs is marked read-only") } -func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *check.C) { +func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *testing.T) { // Not supported on Windows testRequires(c, DaemonIsLinux) @@ -1420,7 +1420,7 @@ func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *check.C) assert.ErrorContains(c, err, expected) } -func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *check.C) { +func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *testing.T) { // ShmSize is not supported on Windows testRequires(c, DaemonIsLinux) config := containertypes.Config{ @@ -1438,7 +1438,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *check.C) { assert.ErrorContains(c, err, "SHM size can not be less than 0") } -func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check.C) { +func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *testing.T) { // ShmSize is not supported on Windows testRequires(c, DaemonIsLinux) var defaultSHMSize int64 = 67108864 @@ -1466,7 +1466,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check. } } -func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *check.C) { +func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *testing.T) { // ShmSize is not supported on Windows testRequires(c, DaemonIsLinux) config := containertypes.Config{ @@ -1493,7 +1493,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *check.C) { } } -func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *check.C) { +func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *testing.T) { // ShmSize is not supported on Windows testRequires(c, DaemonIsLinux) config := containertypes.Config{ @@ -1524,7 +1524,7 @@ func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *check.C) { } } -func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(c *check.C) { +func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(c *testing.T) { // Swappiness is not supported on Windows testRequires(c, DaemonIsLinux) config := containertypes.Config{ @@ -1549,7 +1549,7 @@ func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted( } // check validation is done daemon side and not only in cli -func (s *DockerSuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *check.C) { +func (s *DockerSuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *testing.T) { // OomScoreAdj is not supported on Windows testRequires(c, DaemonIsLinux) @@ -1583,7 +1583,7 @@ func (s *DockerSuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *che } // test case for #22210 where an empty container name caused panic. -func (s *DockerSuite) TestContainerAPIDeleteWithEmptyName(c *check.C) { +func (s *DockerSuite) TestContainerAPIDeleteWithEmptyName(c *testing.T) { cli, err := client.NewClientWithOpts(client.FromEnv) assert.NilError(c, err) defer cli.Close() @@ -1592,7 +1592,7 @@ func (s *DockerSuite) TestContainerAPIDeleteWithEmptyName(c *check.C) { assert.ErrorContains(c, err, "No such container") } -func (s *DockerSuite) TestContainerAPIStatsWithNetworkDisabled(c *check.C) { +func (s *DockerSuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T) { // Problematic on Windows as Windows does not support stats testRequires(c, DaemonIsLinux) @@ -1641,7 +1641,7 @@ func (s *DockerSuite) TestContainerAPIStatsWithNetworkDisabled(c *check.C) { } } -func (s *DockerSuite) TestContainersAPICreateMountsValidation(c *check.C) { +func (s *DockerSuite) TestContainersAPICreateMountsValidation(c *testing.T) { type testCase struct { config containertypes.Config hostConfig containertypes.HostConfig @@ -1932,7 +1932,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsValidation(c *check.C) { } } -func (s *DockerSuite) TestContainerAPICreateMountsBindRead(c *check.C) { +func (s *DockerSuite) TestContainerAPICreateMountsBindRead(c *testing.T) { testRequires(c, NotUserNamespace, testEnv.IsLocalDaemon) // also with data in the host side prefix, slash := getPrefixAndSlashFromDaemonPlatform() @@ -1963,7 +1963,7 @@ func (s *DockerSuite) TestContainerAPICreateMountsBindRead(c *check.C) { } // Test Mounts comes out as expected for the MountPoint -func (s *DockerSuite) TestContainersAPICreateMountsCreate(c *check.C) { +func (s *DockerSuite) TestContainersAPICreateMountsCreate(c *testing.T) { prefix, slash := getPrefixAndSlashFromDaemonPlatform() destPath := prefix + slash + "foo" @@ -2177,7 +2177,7 @@ func containerExit(apiclient client.APIClient, name string) func(poll.LogT) poll } } -func (s *DockerSuite) TestContainersAPICreateMountsTmpfs(c *check.C) { +func (s *DockerSuite) TestContainersAPICreateMountsTmpfs(c *testing.T) { testRequires(c, DaemonIsLinux) type testCase struct { cfg mounttypes.Mount @@ -2227,7 +2227,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsTmpfs(c *check.C) { // Regression test for #33334 // Makes sure that when a container which has a custom stop signal + restart=always // gets killed (with SIGKILL) by the kill API, that the restart policy is cancelled. -func (s *DockerSuite) TestContainerKillCustomStopSignal(c *check.C) { +func (s *DockerSuite) TestContainerKillCustomStopSignal(c *testing.T) { id := strings.TrimSpace(runSleepingContainer(c, "--stop-signal=SIGTERM", "--restart=always")) res, _, err := request.Post("/containers/" + id + "/kill") assert.NilError(c, err) diff --git a/integration-cli/docker_api_containers_windows_test.go b/integration-cli/docker_api_containers_windows_test.go index dc3fbefbf2..8ddd31a1a9 100644 --- a/integration-cli/docker_api_containers_windows_test.go +++ b/integration-cli/docker_api_containers_windows_test.go @@ -18,7 +18,7 @@ import ( is "gotest.tools/assert/cmp" ) -func (s *DockerSuite) TestContainersAPICreateMountsBindNamedPipe(c *check.C) { +func (s *DockerSuite) TestContainersAPICreateMountsBindNamedPipe(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsWindowsAtLeastBuild(16299)) // Named pipe support was added in RS3 // Create a host pipe to map into the container diff --git a/integration-cli/docker_api_exec_resize_test.go b/integration-cli/docker_api_exec_resize_test.go index 75be90bb12..1fdab4755d 100644 --- a/integration-cli/docker_api_exec_resize_test.go +++ b/integration-cli/docker_api_exec_resize_test.go @@ -15,7 +15,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSuite) TestExecResizeAPIHeightWidthNoInt(c *check.C) { +func (s *DockerSuite) TestExecResizeAPIHeightWidthNoInt(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "top") cleanedContainerID := strings.TrimSpace(out) @@ -31,7 +31,7 @@ func (s *DockerSuite) TestExecResizeAPIHeightWidthNoInt(c *check.C) { } // Part of #14845 -func (s *DockerSuite) TestExecResizeImmediatelyAfterExecStart(c *check.C) { +func (s *DockerSuite) TestExecResizeImmediatelyAfterExecStart(c *testing.T) { name := "exec_resize_test" dockerCmd(c, "run", "-d", "-i", "-t", "--name", name, "--restart", "always", "busybox", "/bin/sh") diff --git a/integration-cli/docker_api_exec_test.go b/integration-cli/docker_api_exec_test.go index 78c89f17b1..19f58e5232 100644 --- a/integration-cli/docker_api_exec_test.go +++ b/integration-cli/docker_api_exec_test.go @@ -21,7 +21,7 @@ import ( ) // Regression test for #9414 -func (s *DockerSuite) TestExecAPICreateNoCmd(c *check.C) { +func (s *DockerSuite) TestExecAPICreateNoCmd(c *testing.T) { name := "exec_test" dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh") @@ -37,7 +37,7 @@ func (s *DockerSuite) TestExecAPICreateNoCmd(c *check.C) { assert.Assert(c, strings.Contains(getErrorMessage(c, b), "No exec command specified"), "Expected message when creating exec command with no Cmd specified") } -func (s *DockerSuite) TestExecAPICreateNoValidContentType(c *check.C) { +func (s *DockerSuite) TestExecAPICreateNoValidContentType(c *testing.T) { name := "exec_test" dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh") @@ -58,7 +58,7 @@ func (s *DockerSuite) TestExecAPICreateNoValidContentType(c *check.C) { assert.Assert(c, strings.Contains(getErrorMessage(c, b), "Content-Type specified"), "Expected message when creating exec command with invalid Content-Type specified") } -func (s *DockerSuite) TestExecAPICreateContainerPaused(c *check.C) { +func (s *DockerSuite) TestExecAPICreateContainerPaused(c *testing.T) { // Not relevant on Windows as Windows containers cannot be paused testRequires(c, DaemonIsLinux) name := "exec_create_test" @@ -77,7 +77,7 @@ func (s *DockerSuite) TestExecAPICreateContainerPaused(c *check.C) { assert.ErrorContains(c, err, "Container "+name+" is paused, unpause the container before exec", "Expected message when creating exec command with Container %s is paused", name) } -func (s *DockerSuite) TestExecAPIStart(c *check.C) { +func (s *DockerSuite) TestExecAPIStart(c *testing.T) { testRequires(c, DaemonIsLinux) // Uses pause/unpause but bits may be salvageable to Windows to Windows CI dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top") @@ -104,7 +104,7 @@ func (s *DockerSuite) TestExecAPIStart(c *check.C) { startExec(c, id, http.StatusOK) } -func (s *DockerSuite) TestExecAPIStartEnsureHeaders(c *check.C) { +func (s *DockerSuite) TestExecAPIStartEnsureHeaders(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top") @@ -114,7 +114,7 @@ func (s *DockerSuite) TestExecAPIStartEnsureHeaders(c *check.C) { assert.Assert(c, resp.Header.Get("Server") != "") } -func (s *DockerSuite) TestExecAPIStartBackwardsCompatible(c *check.C) { +func (s *DockerSuite) TestExecAPIStartBackwardsCompatible(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later runSleepingContainer(c, "-d", "--name", "test") id := createExec(c, "test") @@ -129,7 +129,7 @@ func (s *DockerSuite) TestExecAPIStartBackwardsCompatible(c *check.C) { } // #19362 -func (s *DockerSuite) TestExecAPIStartMultipleTimesError(c *check.C) { +func (s *DockerSuite) TestExecAPIStartMultipleTimesError(c *testing.T) { runSleepingContainer(c, "-d", "--name", "test") execID := createExec(c, "test") startExec(c, execID, http.StatusOK) @@ -139,7 +139,7 @@ func (s *DockerSuite) TestExecAPIStartMultipleTimesError(c *check.C) { } // #20638 -func (s *DockerSuite) TestExecAPIStartWithDetach(c *check.C) { +func (s *DockerSuite) TestExecAPIStartWithDetach(c *testing.T) { name := "foo" runSleepingContainer(c, "-d", "-t", "--name", name) @@ -170,7 +170,7 @@ func (s *DockerSuite) TestExecAPIStartWithDetach(c *check.C) { } // #30311 -func (s *DockerSuite) TestExecAPIStartValidCommand(c *check.C) { +func (s *DockerSuite) TestExecAPIStartValidCommand(c *testing.T) { name := "exec_test" dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh") @@ -186,7 +186,7 @@ func (s *DockerSuite) TestExecAPIStartValidCommand(c *check.C) { } // #30311 -func (s *DockerSuite) TestExecAPIStartInvalidCommand(c *check.C) { +func (s *DockerSuite) TestExecAPIStartInvalidCommand(c *testing.T) { name := "exec_test" dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh") @@ -204,7 +204,7 @@ func (s *DockerSuite) TestExecAPIStartInvalidCommand(c *check.C) { assert.Assert(c, inspectJSON.ExecIDs == nil) } -func (s *DockerSuite) TestExecStateCleanup(c *check.C) { +func (s *DockerSuite) TestExecStateCleanup(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) // This test checks accidental regressions. Not part of stable API. @@ -215,7 +215,7 @@ func (s *DockerSuite) TestExecStateCleanup(c *check.C) { stateDir := "/var/run/docker/containerd/" + cid - checkReadDir := func(c *check.C) (interface{}, check.CommentInterface) { + checkReadDir := func(c *testing.T) (interface{}, check.CommentInterface) { fi, err := ioutil.ReadDir(stateDir) assert.NilError(c, err) return len(fi), nil @@ -243,11 +243,11 @@ func (s *DockerSuite) TestExecStateCleanup(c *check.C) { assert.Assert(c, os.IsNotExist(err)) } -func createExec(c *check.C, name string) string { +func createExec(c *testing.T, name string) string { return createExecCmd(c, name, "true") } -func createExecCmd(c *check.C, name string, cmd string) string { +func createExecCmd(c *testing.T, name string, cmd string) string { _, reader, err := request.Post(fmt.Sprintf("/containers/%s/exec", name), request.JSONBody(map[string]interface{}{"Cmd": []string{cmd}})) assert.NilError(c, err) b, err := ioutil.ReadAll(reader) @@ -260,7 +260,7 @@ func createExecCmd(c *check.C, name string, cmd string) string { return createResp.ID } -func startExec(c *check.C, id string, code int) { +func startExec(c *testing.T, id string, code int) { resp, body, err := request.Post(fmt.Sprintf("/exec/%s/start", id), request.RawString(`{"Detach": true}`), request.JSON) assert.NilError(c, err) @@ -269,7 +269,7 @@ func startExec(c *check.C, id string, code int) { assert.Equal(c, resp.StatusCode, code, "response body: %s", b) } -func inspectExec(c *check.C, id string, out interface{}) { +func inspectExec(c *testing.T, id string, out interface{}) { resp, body, err := request.Get(fmt.Sprintf("/exec/%s/json", id)) assert.NilError(c, err) defer body.Close() @@ -278,7 +278,7 @@ func inspectExec(c *check.C, id string, out interface{}) { assert.NilError(c, err) } -func waitForExec(c *check.C, id string) { +func waitForExec(c *testing.T, id string) { timeout := time.After(60 * time.Second) var execJSON struct{ Running bool } for { @@ -295,7 +295,7 @@ func waitForExec(c *check.C, id string) { } } -func inspectContainer(c *check.C, id string, out interface{}) { +func inspectContainer(c *testing.T, id string, out interface{}) { resp, body, err := request.Get(fmt.Sprintf("/containers/%s/json", id)) assert.NilError(c, err) defer body.Close() diff --git a/integration-cli/docker_api_images_test.go b/integration-cli/docker_api_images_test.go index 9e4f84a581..1086b58deb 100644 --- a/integration-cli/docker_api_images_test.go +++ b/integration-cli/docker_api_images_test.go @@ -19,7 +19,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSuite) TestAPIImagesFilter(c *check.C) { +func (s *DockerSuite) TestAPIImagesFilter(c *testing.T) { cli, err := client.NewClientWithOpts(client.FromEnv) assert.NilError(c, err) defer cli.Close() @@ -57,7 +57,7 @@ func (s *DockerSuite) TestAPIImagesFilter(c *check.C) { assert.Equal(c, len(images[0].RepoTags), 1) } -func (s *DockerSuite) TestAPIImagesSaveAndLoad(c *check.C) { +func (s *DockerSuite) TestAPIImagesSaveAndLoad(c *testing.T) { if runtime.GOOS == "windows" { v, err := kernel.GetKernelVersion() assert.NilError(c, err) @@ -87,7 +87,7 @@ func (s *DockerSuite) TestAPIImagesSaveAndLoad(c *check.C) { assert.Equal(c, strings.TrimSpace(string(inspectOut)), id, "load did not work properly") } -func (s *DockerSuite) TestAPIImagesDelete(c *check.C) { +func (s *DockerSuite) TestAPIImagesDelete(c *testing.T) { cli, err := client.NewClientWithOpts(client.FromEnv) assert.NilError(c, err) defer cli.Close() @@ -111,7 +111,7 @@ func (s *DockerSuite) TestAPIImagesDelete(c *check.C) { assert.NilError(c, err) } -func (s *DockerSuite) TestAPIImagesHistory(c *check.C) { +func (s *DockerSuite) TestAPIImagesHistory(c *testing.T) { cli, err := client.NewClientWithOpts(client.FromEnv) assert.NilError(c, err) defer cli.Close() @@ -137,7 +137,7 @@ func (s *DockerSuite) TestAPIImagesHistory(c *check.C) { assert.Assert(c, found) } -func (s *DockerSuite) TestAPIImagesImportBadSrc(c *check.C) { +func (s *DockerSuite) TestAPIImagesImportBadSrc(c *testing.T) { if runtime.GOOS == "windows" { v, err := kernel.GetKernelVersion() assert.NilError(c, err) @@ -172,7 +172,7 @@ func (s *DockerSuite) TestAPIImagesImportBadSrc(c *check.C) { } // #14846 -func (s *DockerSuite) TestAPIImagesSearchJSONContentType(c *check.C) { +func (s *DockerSuite) TestAPIImagesSearchJSONContentType(c *testing.T) { testRequires(c, Network) res, b, err := request.Get("/images/search?term=test", request.JSON) @@ -184,7 +184,7 @@ func (s *DockerSuite) TestAPIImagesSearchJSONContentType(c *check.C) { // Test case for 30027: image size reported as -1 in v1.12 client against v1.13 daemon. // This test checks to make sure both v1.12 and v1.13 client against v1.13 daemon get correct `Size` after the fix. -func (s *DockerSuite) TestAPIImagesSizeCompatibility(c *check.C) { +func (s *DockerSuite) TestAPIImagesSizeCompatibility(c *testing.T) { apiclient := testEnv.APIClient() defer apiclient.Close() diff --git a/integration-cli/docker_api_inspect_test.go b/integration-cli/docker_api_inspect_test.go index cc0fbc3205..c3a1bffe78 100644 --- a/integration-cli/docker_api_inspect_test.go +++ b/integration-cli/docker_api_inspect_test.go @@ -13,7 +13,7 @@ import ( is "gotest.tools/assert/cmp" ) -func (s *DockerSuite) TestInspectAPIContainerResponse(c *check.C) { +func (s *DockerSuite) TestInspectAPIContainerResponse(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "true") cleanedContainerID := strings.TrimSpace(out) @@ -57,7 +57,7 @@ func (s *DockerSuite) TestInspectAPIContainerResponse(c *check.C) { } } -func (s *DockerSuite) TestInspectAPIContainerVolumeDriverLegacy(c *check.C) { +func (s *DockerSuite) TestInspectAPIContainerVolumeDriverLegacy(c *testing.T) { // No legacy implications for Windows testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "true") @@ -80,7 +80,7 @@ func (s *DockerSuite) TestInspectAPIContainerVolumeDriverLegacy(c *check.C) { } } -func (s *DockerSuite) TestInspectAPIContainerVolumeDriver(c *check.C) { +func (s *DockerSuite) TestInspectAPIContainerVolumeDriver(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "--volume-driver", "local", "busybox", "true") cleanedContainerID := strings.TrimSpace(out) @@ -104,7 +104,7 @@ func (s *DockerSuite) TestInspectAPIContainerVolumeDriver(c *check.C) { assert.Assert(c, ok, "API version 1.25 expected to include VolumeDriver in 'HostConfig'") } -func (s *DockerSuite) TestInspectAPIImageResponse(c *check.C) { +func (s *DockerSuite) TestInspectAPIImageResponse(c *testing.T) { dockerCmd(c, "tag", "busybox:latest", "busybox:mytag") cli, err := client.NewClientWithOpts(client.FromEnv) assert.NilError(c, err) @@ -119,7 +119,7 @@ func (s *DockerSuite) TestInspectAPIImageResponse(c *check.C) { } // #17131, #17139, #17173 -func (s *DockerSuite) TestInspectAPIEmptyFieldsInConfigPre121(c *check.C) { +func (s *DockerSuite) TestInspectAPIEmptyFieldsInConfigPre121(c *testing.T) { // Not relevant on Windows testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "true") @@ -143,7 +143,7 @@ func (s *DockerSuite) TestInspectAPIEmptyFieldsInConfigPre121(c *check.C) { } } -func (s *DockerSuite) TestInspectAPIBridgeNetworkSettings120(c *check.C) { +func (s *DockerSuite) TestInspectAPIBridgeNetworkSettings120(c *testing.T) { // Not relevant on Windows, and besides it doesn't have any bridge network settings testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "top") @@ -160,7 +160,7 @@ func (s *DockerSuite) TestInspectAPIBridgeNetworkSettings120(c *check.C) { assert.Assert(c, len(settings.IPAddress) != 0) } -func (s *DockerSuite) TestInspectAPIBridgeNetworkSettings121(c *check.C) { +func (s *DockerSuite) TestInspectAPIBridgeNetworkSettings121(c *testing.T) { // Windows doesn't have any bridge network settings testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "top") diff --git a/integration-cli/docker_api_logs_test.go b/integration-cli/docker_api_logs_test.go index 62a48f5ebe..1b7786f207 100644 --- a/integration-cli/docker_api_logs_test.go +++ b/integration-cli/docker_api_logs_test.go @@ -20,7 +20,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSuite) TestLogsAPIWithStdout(c *check.C) { +func (s *DockerSuite) TestLogsAPIWithStdout(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "-t", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 1; done") id := strings.TrimSpace(out) assert.NilError(c, waitRun(id)) @@ -56,7 +56,7 @@ func (s *DockerSuite) TestLogsAPIWithStdout(c *check.C) { } } -func (s *DockerSuite) TestLogsAPINoStdoutNorStderr(c *check.C) { +func (s *DockerSuite) TestLogsAPINoStdoutNorStderr(c *testing.T) { name := "logs_test" dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh") cli, err := client.NewClientWithOpts(client.FromEnv) @@ -68,7 +68,7 @@ func (s *DockerSuite) TestLogsAPINoStdoutNorStderr(c *check.C) { } // Regression test for #12704 -func (s *DockerSuite) TestLogsAPIFollowEmptyOutput(c *check.C) { +func (s *DockerSuite) TestLogsAPIFollowEmptyOutput(c *testing.T) { name := "logs_test" t0 := time.Now() dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "sleep", "10") @@ -83,14 +83,14 @@ func (s *DockerSuite) TestLogsAPIFollowEmptyOutput(c *check.C) { } } -func (s *DockerSuite) TestLogsAPIContainerNotFound(c *check.C) { +func (s *DockerSuite) TestLogsAPIContainerNotFound(c *testing.T) { name := "nonExistentContainer" resp, _, err := request.Get(fmt.Sprintf("/containers/%s/logs?follow=1&stdout=1&stderr=1&tail=all", name)) assert.NilError(c, err) assert.Equal(c, resp.StatusCode, http.StatusNotFound) } -func (s *DockerSuite) TestLogsAPIUntilFutureFollow(c *check.C) { +func (s *DockerSuite) TestLogsAPIUntilFutureFollow(c *testing.T) { testRequires(c, DaemonIsLinux) name := "logsuntilfuturefollow" dockerCmd(c, "run", "-d", "--name", name, "busybox", "/bin/sh", "-c", "while true; do date +%s; sleep 1; done") @@ -147,7 +147,7 @@ func (s *DockerSuite) TestLogsAPIUntilFutureFollow(c *check.C) { } } -func (s *DockerSuite) TestLogsAPIUntil(c *check.C) { +func (s *DockerSuite) TestLogsAPIUntil(c *testing.T) { testRequires(c, MinimumAPIVersion("1.34")) name := "logsuntil" dockerCmd(c, "run", "--name", name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do echo log$i; sleep 1; done") @@ -157,7 +157,7 @@ func (s *DockerSuite) TestLogsAPIUntil(c *check.C) { c.Fatal(err) } - extractBody := func(c *check.C, cfg types.ContainerLogsOptions) []string { + extractBody := func(c *testing.T, cfg types.ContainerLogsOptions) []string { reader, err := client.ContainerLogs(context.Background(), name, cfg) assert.NilError(c, err) @@ -185,7 +185,7 @@ func (s *DockerSuite) TestLogsAPIUntil(c *check.C) { assert.Assert(c, !strings.Contains(logsString, "log3"), "unexpected log message returned, until=%v", until) } -func (s *DockerSuite) TestLogsAPIUntilDefaultValue(c *check.C) { +func (s *DockerSuite) TestLogsAPIUntilDefaultValue(c *testing.T) { name := "logsuntildefaultval" dockerCmd(c, "run", "--name", name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do echo log$i; done") @@ -194,7 +194,7 @@ func (s *DockerSuite) TestLogsAPIUntilDefaultValue(c *check.C) { c.Fatal(err) } - extractBody := func(c *check.C, cfg types.ContainerLogsOptions) []string { + extractBody := func(c *testing.T, cfg types.ContainerLogsOptions) []string { reader, err := client.ContainerLogs(context.Background(), name, cfg) assert.NilError(c, err) diff --git a/integration-cli/docker_api_network_test.go b/integration-cli/docker_api_network_test.go index 3e854c78e1..ab1d057aea 100644 --- a/integration-cli/docker_api_network_test.go +++ b/integration-cli/docker_api_network_test.go @@ -17,7 +17,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSuite) TestAPINetworkGetDefaults(c *check.C) { +func (s *DockerSuite) TestAPINetworkGetDefaults(c *testing.T) { testRequires(c, DaemonIsLinux) // By default docker daemon creates 3 networks. check if they are present defaults := []string{"bridge", "host", "none"} @@ -26,7 +26,7 @@ func (s *DockerSuite) TestAPINetworkGetDefaults(c *check.C) { } } -func (s *DockerSuite) TestAPINetworkCreateCheckDuplicate(c *check.C) { +func (s *DockerSuite) TestAPINetworkCreateCheckDuplicate(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testcheckduplicate" configOnCheck := types.NetworkCreateRequest{ @@ -64,13 +64,13 @@ func (s *DockerSuite) TestAPINetworkCreateCheckDuplicate(c *check.C) { createNetwork(c, configNotCheck, http.StatusCreated) } -func (s *DockerSuite) TestAPINetworkFilter(c *check.C) { +func (s *DockerSuite) TestAPINetworkFilter(c *testing.T) { testRequires(c, DaemonIsLinux) nr := getNetworkResource(c, getNetworkIDByName(c, "bridge")) assert.Equal(c, nr.Name, "bridge") } -func (s *DockerSuite) TestAPINetworkInspectBridge(c *check.C) { +func (s *DockerSuite) TestAPINetworkInspectBridge(c *testing.T) { testRequires(c, DaemonIsLinux) // Inspect default bridge network nr := getNetworkResource(c, "bridge") @@ -96,7 +96,7 @@ func (s *DockerSuite) TestAPINetworkInspectBridge(c *check.C) { assert.Equal(c, ip.String(), containerIP) } -func (s *DockerSuite) TestAPINetworkInspectUserDefinedNetwork(c *check.C) { +func (s *DockerSuite) TestAPINetworkInspectUserDefinedNetwork(c *testing.T) { testRequires(c, DaemonIsLinux) // IPAM configuration inspect ipam := &network.IPAM{ @@ -127,7 +127,7 @@ func (s *DockerSuite) TestAPINetworkInspectUserDefinedNetwork(c *check.C) { assert.Assert(c, !isNetworkAvailable(c, "br0")) } -func (s *DockerSuite) TestAPINetworkConnectDisconnect(c *check.C) { +func (s *DockerSuite) TestAPINetworkConnectDisconnect(c *testing.T) { testRequires(c, DaemonIsLinux) // Create test network name := "testnetwork" @@ -169,7 +169,7 @@ func (s *DockerSuite) TestAPINetworkConnectDisconnect(c *check.C) { deleteNetwork(c, nr.ID, true) } -func (s *DockerSuite) TestAPINetworkIPAMMultipleBridgeNetworks(c *check.C) { +func (s *DockerSuite) TestAPINetworkIPAMMultipleBridgeNetworks(c *testing.T) { testRequires(c, DaemonIsLinux) // test0 bridge network ipam0 := &network.IPAM{ @@ -238,14 +238,14 @@ func (s *DockerSuite) TestAPINetworkIPAMMultipleBridgeNetworks(c *check.C) { } } -func (s *DockerSuite) TestAPICreateDeletePredefinedNetworks(c *check.C) { +func (s *DockerSuite) TestAPICreateDeletePredefinedNetworks(c *testing.T) { testRequires(c, DaemonIsLinux, SwarmInactive) createDeletePredefinedNetwork(c, "bridge") createDeletePredefinedNetwork(c, "none") createDeletePredefinedNetwork(c, "host") } -func createDeletePredefinedNetwork(c *check.C, name string) { +func createDeletePredefinedNetwork(c *testing.T, name string) { // Create pre-defined network config := types.NetworkCreateRequest{ Name: name, @@ -267,7 +267,7 @@ func createDeletePredefinedNetwork(c *check.C, name string) { deleteNetwork(c, name, false) } -func isNetworkAvailable(c *check.C, name string) bool { +func isNetworkAvailable(c *testing.T, name string) bool { resp, body, err := request.Get("/networks") assert.NilError(c, err) defer resp.Body.Close() @@ -285,7 +285,7 @@ func isNetworkAvailable(c *check.C, name string) bool { return false } -func getNetworkIDByName(c *check.C, name string) string { +func getNetworkIDByName(c *testing.T, name string) string { var ( v = url.Values{} filterArgs = filters.NewArgs() @@ -314,7 +314,7 @@ func getNetworkIDByName(c *check.C, name string) string { return res } -func getNetworkResource(c *check.C, id string) *types.NetworkResource { +func getNetworkResource(c *testing.T, id string) *types.NetworkResource { _, obj, err := request.Get("/networks/" + id) assert.NilError(c, err) @@ -325,7 +325,7 @@ func getNetworkResource(c *check.C, id string) *types.NetworkResource { return &nr } -func createNetwork(c *check.C, config types.NetworkCreateRequest, expectedStatusCode int) string { +func createNetwork(c *testing.T, config types.NetworkCreateRequest, expectedStatusCode int) string { resp, body, err := request.Post("/networks/create", request.JSONBody(config)) assert.NilError(c, err) defer resp.Body.Close() @@ -346,7 +346,7 @@ func createNetwork(c *check.C, config types.NetworkCreateRequest, expectedStatus return "" } -func connectNetwork(c *check.C, nid, cid string) { +func connectNetwork(c *testing.T, nid, cid string) { config := types.NetworkConnect{ Container: cid, } @@ -356,7 +356,7 @@ func connectNetwork(c *check.C, nid, cid string) { assert.NilError(c, err) } -func disconnectNetwork(c *check.C, nid, cid string) { +func disconnectNetwork(c *testing.T, nid, cid string) { config := types.NetworkConnect{ Container: cid, } @@ -366,7 +366,7 @@ func disconnectNetwork(c *check.C, nid, cid string) { assert.NilError(c, err) } -func deleteNetwork(c *check.C, id string, shouldSucceed bool) { +func deleteNetwork(c *testing.T, id string, shouldSucceed bool) { resp, _, err := request.Delete("/networks/" + id) assert.NilError(c, err) defer resp.Body.Close() diff --git a/integration-cli/docker_api_stats_test.go b/integration-cli/docker_api_stats_test.go index 63ee9231fe..a2f668684f 100644 --- a/integration-cli/docker_api_stats_test.go +++ b/integration-cli/docker_api_stats_test.go @@ -22,7 +22,7 @@ import ( var expectedNetworkInterfaceStats = strings.Split("rx_bytes rx_dropped rx_errors rx_packets tx_bytes tx_dropped tx_errors tx_packets", " ") -func (s *DockerSuite) TestAPIStatsNoStreamGetCpu(c *check.C) { +func (s *DockerSuite) TestAPIStatsNoStreamGetCpu(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true;usleep 100; do echo 'Hello'; done") id := strings.TrimSpace(out) @@ -62,7 +62,7 @@ func (s *DockerSuite) TestAPIStatsNoStreamGetCpu(c *check.C) { assert.Assert(c, cpuPercent != 0.0, "docker stats with no-stream get cpu usage failed: was %v", cpuPercent) } -func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *check.C) { +func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo 1") id := strings.TrimSpace(out) @@ -97,7 +97,7 @@ func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *check.C) { } } -func (s *DockerSuite) TestAPIStatsNetworkStats(c *check.C) { +func (s *DockerSuite) TestAPIStatsNetworkStats(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) out := runSleepingContainer(c) @@ -162,7 +162,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStats(c *check.C) { assert.Assert(c, postRxPackets >= expRxPkts, "Reported less RxPackets than expected. Expected >= %d. Found %d. %s", expRxPkts, postRxPackets, pingouts) } -func (s *DockerSuite) TestAPIStatsNetworkStatsVersioning(c *check.C) { +func (s *DockerSuite) TestAPIStatsNetworkStatsVersioning(c *testing.T) { // Windows doesn't support API versions less than 1.25, so no point testing 1.17 .. 1.21 testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) @@ -187,7 +187,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStatsVersioning(c *check.C) { wg.Wait() } -func getNetworkStats(c *check.C, id string) map[string]types.NetworkStats { +func getNetworkStats(c *testing.T, id string) map[string]types.NetworkStats { var st *types.StatsJSON _, body, err := request.Get(fmt.Sprintf("/containers/%s/stats?stream=false", id)) @@ -204,7 +204,7 @@ func getNetworkStats(c *check.C, id string) map[string]types.NetworkStats { // container with id using an API call with version apiVersion. Since the // stats result type differs between API versions, we simply return // map[string]interface{}. -func getVersionedStats(c *check.C, id string, apiVersion string) map[string]interface{} { +func getVersionedStats(c *testing.T, id string, apiVersion string) map[string]interface{} { stats := make(map[string]interface{}) _, body, err := request.Get(fmt.Sprintf("/%s/containers/%s/stats?stream=false", apiVersion, id)) @@ -257,7 +257,7 @@ func jsonBlobHasGTE121NetworkStats(blob map[string]interface{}) bool { return true } -func (s *DockerSuite) TestAPIStatsContainerNotFound(c *check.C) { +func (s *DockerSuite) TestAPIStatsContainerNotFound(c *testing.T) { testRequires(c, DaemonIsLinux) cli, err := client.NewClientWithOpts(client.FromEnv) assert.NilError(c, err) @@ -271,7 +271,7 @@ func (s *DockerSuite) TestAPIStatsContainerNotFound(c *check.C) { assert.ErrorContains(c, err, expected) } -func (s *DockerSuite) TestAPIStatsNoStreamConnectedContainers(c *check.C) { +func (s *DockerSuite) TestAPIStatsNoStreamConnectedContainers(c *testing.T) { testRequires(c, DaemonIsLinux) out1 := runSleepingContainer(c) diff --git a/integration-cli/docker_api_swarm_node_test.go b/integration-cli/docker_api_swarm_node_test.go index e766514688..35aa4f0550 100644 --- a/integration-cli/docker_api_swarm_node_test.go +++ b/integration-cli/docker_api_swarm_node_test.go @@ -11,7 +11,7 @@ import ( "github.com/go-check/check" ) -func (s *DockerSwarmSuite) TestAPISwarmListNodes(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmListNodes(c *testing.T) { d1 := s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, true, false) d3 := s.AddDaemon(c, true, false) @@ -30,7 +30,7 @@ loop0: } } -func (s *DockerSwarmSuite) TestAPISwarmNodeUpdate(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmNodeUpdate(c *testing.T) { d := s.AddDaemon(c, true, true) nodes := d.ListNodes(c) @@ -43,7 +43,7 @@ func (s *DockerSwarmSuite) TestAPISwarmNodeUpdate(c *check.C) { assert.Assert(c, n.Spec.Availability, checker.Equals, swarm.NodeAvailabilityPause) } -func (s *DockerSwarmSuite) TestAPISwarmNodeRemove(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmNodeRemove(c *testing.T) { testRequires(c, Network) d1 := s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, true, false) @@ -72,7 +72,7 @@ func (s *DockerSwarmSuite) TestAPISwarmNodeRemove(c *check.C) { assert.Assert(c, len(nodes), checker.Equals, 2, check.Commentf("nodes: %#v", nodes)) } -func (s *DockerSwarmSuite) TestAPISwarmNodeDrainPause(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmNodeDrainPause(c *testing.T) { d1 := s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, true, false) diff --git a/integration-cli/docker_api_swarm_service_test.go b/integration-cli/docker_api_swarm_service_test.go index e58255820c..a633a906ca 100644 --- a/integration-cli/docker_api_swarm_service_test.go +++ b/integration-cli/docker_api_swarm_service_test.go @@ -31,7 +31,7 @@ func setPortConfig(portConfig []swarm.PortConfig) testdaemon.ServiceConstructor } } -func (s *DockerSwarmSuite) TestAPIServiceUpdatePort(c *check.C) { +func (s *DockerSwarmSuite) TestAPIServiceUpdatePort(c *testing.T) { d := s.AddDaemon(c, true, true) // Create a service with a port mapping of 8080:8081. @@ -52,7 +52,7 @@ func (s *DockerSwarmSuite) TestAPIServiceUpdatePort(c *check.C) { assert.Equal(c, updatedService.Spec.EndpointSpec.Ports[0].PublishedPort, uint32(8082)) } -func (s *DockerSwarmSuite) TestAPISwarmServicesEmptyList(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmServicesEmptyList(c *testing.T) { d := s.AddDaemon(c, true, true) services := d.ListServices(c) @@ -60,7 +60,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesEmptyList(c *check.C) { assert.Assert(c, len(services) == 0, "services: %#v", services) } -func (s *DockerSwarmSuite) TestAPISwarmServicesCreate(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmServicesCreate(c *testing.T) { d := s.AddDaemon(c, true, true) instances := 2 @@ -93,7 +93,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesCreate(c *check.C) { waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 0) } -func (s *DockerSwarmSuite) TestAPISwarmServicesMultipleAgents(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmServicesMultipleAgents(c *testing.T) { d1 := s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, true, false) d3 := s.AddDaemon(c, true, false) @@ -121,7 +121,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesMultipleAgents(c *check.C) { } -func (s *DockerSwarmSuite) TestAPISwarmServicesCreateGlobal(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmServicesCreateGlobal(c *testing.T) { d1 := s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, true, false) d3 := s.AddDaemon(c, true, false) @@ -139,7 +139,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesCreateGlobal(c *check.C) { waitAndAssert(c, defaultReconciliationTimeout, d5.CheckActiveContainerCount, checker.Equals, 1) } -func (s *DockerSwarmSuite) TestAPISwarmServicesUpdate(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmServicesUpdate(c *testing.T) { const nodeCount = 3 var daemons [nodeCount]*daemon.Daemon for i := 0; i < nodeCount; i++ { @@ -199,7 +199,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdate(c *check.C) { map[string]int{image1: instances}) } -func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *testing.T) { d := s.AddDaemon(c, true, true) // service image at start @@ -223,7 +223,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *check.C) { checkStartingTasks := func(expected int) []swarm.Task { var startingTasks []swarm.Task - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { tasks := d.GetServiceTasks(c, id) startingTasks = nil for _, t := range tasks { @@ -308,7 +308,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *check.C) { map[string]int{image1: instances}) } -func (s *DockerSwarmSuite) TestAPISwarmServicesFailedUpdate(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmServicesFailedUpdate(c *testing.T) { const nodeCount = 3 var daemons [nodeCount]*daemon.Daemon for i := 0; i < nodeCount; i++ { @@ -348,7 +348,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesFailedUpdate(c *check.C) { map[string]int{image1: instances}) } -func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintRole(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintRole(c *testing.T) { const nodeCount = 3 var daemons [nodeCount]*daemon.Daemon for i := 0; i < nodeCount; i++ { @@ -400,7 +400,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintRole(c *check.C) { } } -func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *testing.T) { const nodeCount = 3 var daemons [nodeCount]*daemon.Daemon for i := 0; i < nodeCount; i++ { @@ -495,7 +495,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *check.C) { } } -func (s *DockerSwarmSuite) TestAPISwarmServicePlacementPrefs(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmServicePlacementPrefs(c *testing.T) { const nodeCount = 3 var daemons [nodeCount]*daemon.Daemon for i := 0; i < nodeCount; i++ { @@ -537,7 +537,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicePlacementPrefs(c *check.C) { assert.Assert(c, tasksOnNode[nodes[2].ID] == 1) } -func (s *DockerSwarmSuite) TestAPISwarmServicesStateReporting(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmServicesStateReporting(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) testRequires(c, DaemonIsLinux) diff --git a/integration-cli/docker_api_swarm_test.go b/integration-cli/docker_api_swarm_test.go index 7b498d5ea9..40d5bb9832 100644 --- a/integration-cli/docker_api_swarm_test.go +++ b/integration-cli/docker_api_swarm_test.go @@ -34,7 +34,7 @@ import ( var defaultReconciliationTimeout = 30 * time.Second -func (s *DockerSwarmSuite) TestAPISwarmInit(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmInit(c *testing.T) { // todo: should find a better way to verify that components are running than /info d1 := s.AddDaemon(c, true, true) info := d1.SwarmInfo(c) @@ -80,7 +80,7 @@ func (s *DockerSwarmSuite) TestAPISwarmInit(c *check.C) { assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive) } -func (s *DockerSwarmSuite) TestAPISwarmJoinToken(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmJoinToken(c *testing.T) { d1 := s.AddDaemon(c, false, false) d1.SwarmInit(c, swarm.InitRequest{}) @@ -158,7 +158,7 @@ func (s *DockerSwarmSuite) TestAPISwarmJoinToken(c *check.C) { assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive) } -func (s *DockerSwarmSuite) TestUpdateSwarmAddExternalCA(c *check.C) { +func (s *DockerSwarmSuite) TestUpdateSwarmAddExternalCA(c *testing.T) { d1 := s.AddDaemon(c, false, false) d1.SwarmInit(c, swarm.InitRequest{}) d1.UpdateSwarm(c, func(s *swarm.Spec) { @@ -180,7 +180,7 @@ func (s *DockerSwarmSuite) TestUpdateSwarmAddExternalCA(c *check.C) { assert.Equal(c, info.Cluster.Spec.CAConfig.ExternalCAs[1].CACert, "cacert") } -func (s *DockerSwarmSuite) TestAPISwarmCAHash(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmCAHash(c *testing.T) { d1 := s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, false, false) splitToken := strings.Split(d1.JoinTokens(c).Worker, "-") @@ -195,7 +195,7 @@ func (s *DockerSwarmSuite) TestAPISwarmCAHash(c *check.C) { assert.ErrorContains(c, err, "remote CA does not match fingerprint") } -func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *testing.T) { d1 := s.AddDaemon(c, false, false) d1.SwarmInit(c, swarm.InitRequest{}) d2 := s.AddDaemon(c, true, false) @@ -222,7 +222,7 @@ func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *check.C) { // back to manager quickly might cause the node to pause for awhile // while waiting for the role to change to worker, and the test can // time out during this interval. - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { certBytes, err := ioutil.ReadFile(filepath.Join(d2.Folder, "root", "swarm", "certificates", "swarm-node.crt")) if err != nil { return "", check.Commentf("error: %v", err) @@ -265,7 +265,7 @@ func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *check.C) { waitAndAssert(c, defaultReconciliationTimeout, d2.CheckControlAvailable, checker.True) } -func (s *DockerSwarmSuite) TestAPISwarmLeaderProxy(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmLeaderProxy(c *testing.T) { // add three managers, one of these is leader d1 := s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, true, true) @@ -290,7 +290,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderProxy(c *check.C) { } } -func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *testing.T) { if runtime.GOARCH == "s390x" { c.Skip("Disabled on s390x") } @@ -316,7 +316,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *check.C) { ) var lastErr error checkLeader := func(nodes ...*daemon.Daemon) checkF { - return func(c *check.C) (interface{}, check.CommentInterface) { + return func(c *testing.T) (interface{}, check.CommentInterface) { // clear these out before each run leader = nil followers = nil @@ -371,7 +371,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *check.C) { assert.Equal(c, leader.NodeID(), stableleader.NodeID()) } -func (s *DockerSwarmSuite) TestAPISwarmRaftQuorum(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmRaftQuorum(c *testing.T) { if runtime.GOARCH == "s390x" { c.Skip("Disabled on s390x") } @@ -403,7 +403,7 @@ func (s *DockerSwarmSuite) TestAPISwarmRaftQuorum(c *check.C) { defer cli.Close() // d1 will eventually step down from leader because there is no longer an active quorum, wait for that to happen - waitAndAssert(c, defaultReconciliationTimeout*2, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout*2, func(c *testing.T) (interface{}, check.CommentInterface) { _, err := cli.ServiceCreate(context.Background(), service.Spec, types.ServiceCreateOptions{}) return err.Error(), nil }, checker.Contains, "Make sure more than half of the managers are online.") @@ -418,7 +418,7 @@ func (s *DockerSwarmSuite) TestAPISwarmRaftQuorum(c *check.C) { }) } -func (s *DockerSwarmSuite) TestAPISwarmLeaveRemovesContainer(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmLeaveRemovesContainer(c *testing.T) { d := s.AddDaemon(c, true, true) instances := 2 @@ -441,7 +441,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaveRemovesContainer(c *check.C) { } // #23629 -func (s *DockerSwarmSuite) TestAPISwarmLeaveOnPendingJoin(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmLeaveOnPendingJoin(c *testing.T) { testRequires(c, Network) s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, false, false) @@ -470,7 +470,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaveOnPendingJoin(c *check.C) { } // #23705 -func (s *DockerSwarmSuite) TestAPISwarmRestoreOnPendingJoin(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmRestoreOnPendingJoin(c *testing.T) { testRequires(c, Network) d := s.AddDaemon(c, false, false) client := d.NewClientT(c) @@ -488,7 +488,7 @@ func (s *DockerSwarmSuite) TestAPISwarmRestoreOnPendingJoin(c *check.C) { assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive) } -func (s *DockerSwarmSuite) TestAPISwarmManagerRestore(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmManagerRestore(c *testing.T) { d1 := s.AddDaemon(c, true, true) instances := 2 @@ -515,7 +515,7 @@ func (s *DockerSwarmSuite) TestAPISwarmManagerRestore(c *check.C) { d3.GetService(c, id) } -func (s *DockerSwarmSuite) TestAPISwarmScaleNoRollingUpdate(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmScaleNoRollingUpdate(c *testing.T) { d := s.AddDaemon(c, true, true) instances := 2 @@ -539,7 +539,7 @@ loop0: } } -func (s *DockerSwarmSuite) TestAPISwarmInvalidAddress(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmInvalidAddress(c *testing.T) { d := s.AddDaemon(c, false, false) req := swarm.InitRequest{ ListenAddr: "", @@ -557,7 +557,7 @@ func (s *DockerSwarmSuite) TestAPISwarmInvalidAddress(c *check.C) { assert.Equal(c, res.StatusCode, http.StatusBadRequest) } -func (s *DockerSwarmSuite) TestAPISwarmForceNewCluster(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmForceNewCluster(c *testing.T) { d1 := s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, true, true) @@ -728,7 +728,7 @@ func setGlobalMode(s *swarm.Service) { } } -func checkClusterHealth(c *check.C, cl []*daemon.Daemon, managerCount, workerCount int) { +func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerCount int) { var totalMCount, totalWCount int for _, d := range cl { @@ -737,7 +737,7 @@ func checkClusterHealth(c *check.C, cl []*daemon.Daemon, managerCount, workerCou ) // check info in a waitAndAssert, because if the cluster doesn't have a leader, `info` will return an error - checkInfo := func(c *check.C) (interface{}, check.CommentInterface) { + checkInfo := func(c *testing.T) (interface{}, check.CommentInterface) { client := d.NewClientT(c) daemonInfo, err := client.Info(context.Background()) info = daemonInfo.Swarm @@ -754,7 +754,7 @@ func checkClusterHealth(c *check.C, cl []*daemon.Daemon, managerCount, workerCou var mCount, wCount int for _, n := range d.ListNodes(c) { - waitReady := func(c *check.C) (interface{}, check.CommentInterface) { + waitReady := func(c *testing.T) (interface{}, check.CommentInterface) { if n.Status.State == swarm.NodeStateReady { return true, nil } @@ -764,7 +764,7 @@ func checkClusterHealth(c *check.C, cl []*daemon.Daemon, managerCount, workerCou } waitAndAssert(c, defaultReconciliationTimeout, waitReady, checker.True) - waitActive := func(c *check.C) (interface{}, check.CommentInterface) { + waitActive := func(c *testing.T) (interface{}, check.CommentInterface) { if n.Spec.Availability == swarm.NodeAvailabilityActive { return true, nil } @@ -793,7 +793,7 @@ func checkClusterHealth(c *check.C, cl []*daemon.Daemon, managerCount, workerCou assert.Equal(c, totalWCount, workerCount) } -func (s *DockerSwarmSuite) TestAPISwarmRestartCluster(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmRestartCluster(c *testing.T) { mCount, wCount := 5, 1 var nodes []*daemon.Daemon @@ -858,7 +858,7 @@ func (s *DockerSwarmSuite) TestAPISwarmRestartCluster(c *check.C) { checkClusterHealth(c, nodes, mCount, wCount) } -func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateWithName(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateWithName(c *testing.T) { d := s.AddDaemon(c, true, true) instances := 2 @@ -877,14 +877,14 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateWithName(c *check.C) { } // Unlocking an unlocked swarm results in an error -func (s *DockerSwarmSuite) TestAPISwarmUnlockNotLocked(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmUnlockNotLocked(c *testing.T) { d := s.AddDaemon(c, true, true) err := d.SwarmUnlock(c, swarm.UnlockRequest{UnlockKey: "wrong-key"}) assert.ErrorContains(c, err, "swarm is not locked") } // #29885 -func (s *DockerSwarmSuite) TestAPISwarmErrorHandling(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmErrorHandling(c *testing.T) { ln, err := net.Listen("tcp", fmt.Sprintf(":%d", defaultSwarmPort)) assert.NilError(c, err) defer ln.Close() @@ -899,7 +899,7 @@ func (s *DockerSwarmSuite) TestAPISwarmErrorHandling(c *check.C) { // Test case for 30242, where duplicate networks, with different drivers `bridge` and `overlay`, // caused both scopes to be `swarm` for `docker network inspect` and `docker network ls`. // This test makes sure the fixes correctly output scopes instead. -func (s *DockerSwarmSuite) TestAPIDuplicateNetworks(c *check.C) { +func (s *DockerSwarmSuite) TestAPIDuplicateNetworks(c *testing.T) { d := s.AddDaemon(c, true, true) cli := d.NewClientT(c) defer cli.Close() @@ -929,7 +929,7 @@ func (s *DockerSwarmSuite) TestAPIDuplicateNetworks(c *check.C) { } // Test case for 30178 -func (s *DockerSwarmSuite) TestAPISwarmHealthcheckNone(c *check.C) { +func (s *DockerSwarmSuite) TestAPISwarmHealthcheckNone(c *testing.T) { // Issue #36386 can be a independent one, which is worth further investigation. c.Skip("Root cause of Issue #36386 is needed") d := s.AddDaemon(c, true, true) @@ -956,7 +956,7 @@ func (s *DockerSwarmSuite) TestAPISwarmHealthcheckNone(c *check.C) { assert.NilError(c, err, out) } -func (s *DockerSwarmSuite) TestSwarmRepeatedRootRotation(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmRepeatedRootRotation(c *testing.T) { m := s.AddDaemon(c, true, true) w := s.AddDaemon(c, true, false) @@ -1025,7 +1025,7 @@ func (s *DockerSwarmSuite) TestSwarmRepeatedRootRotation(c *check.C) { } } -func (s *DockerSwarmSuite) TestAPINetworkInspectWithScope(c *check.C) { +func (s *DockerSwarmSuite) TestAPINetworkInspectWithScope(c *testing.T) { d := s.AddDaemon(c, true, true) name := "test-scoped-network" diff --git a/integration-cli/docker_api_test.go b/integration-cli/docker_api_test.go index ecf69bb964..d635413597 100644 --- a/integration-cli/docker_api_test.go +++ b/integration-cli/docker_api_test.go @@ -15,13 +15,13 @@ import ( "gotest.tools/assert" ) -func (s *DockerSuite) TestAPIOptionsRoute(c *check.C) { +func (s *DockerSuite) TestAPIOptionsRoute(c *testing.T) { resp, _, err := request.Do("/", request.Method(http.MethodOptions)) assert.NilError(c, err) assert.Equal(c, resp.StatusCode, http.StatusOK) } -func (s *DockerSuite) TestAPIGetEnabledCORS(c *check.C) { +func (s *DockerSuite) TestAPIGetEnabledCORS(c *testing.T) { res, body, err := request.Get("/version") assert.NilError(c, err) assert.Equal(c, res.StatusCode, http.StatusOK) @@ -33,7 +33,7 @@ func (s *DockerSuite) TestAPIGetEnabledCORS(c *check.C) { //assert.Equal(c, res.Header.Get("Access-Control-Allow-Headers"), "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth") } -func (s *DockerSuite) TestAPIClientVersionOldNotSupported(c *check.C) { +func (s *DockerSuite) TestAPIClientVersionOldNotSupported(c *testing.T) { if testEnv.OSType != runtime.GOOS { c.Skip("Daemon platform doesn't match test platform") } @@ -57,7 +57,7 @@ func (s *DockerSuite) TestAPIClientVersionOldNotSupported(c *check.C) { assert.Equal(c, strings.TrimSpace(string(content)), expected) } -func (s *DockerSuite) TestAPIErrorJSON(c *check.C) { +func (s *DockerSuite) TestAPIErrorJSON(c *testing.T) { httpResp, body, err := request.Post("/containers/create", request.JSONBody(struct{}{})) assert.NilError(c, err) if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") { @@ -71,7 +71,7 @@ func (s *DockerSuite) TestAPIErrorJSON(c *check.C) { assert.Equal(c, getErrorMessage(c, b), "Config cannot be empty in order to create a container") } -func (s *DockerSuite) TestAPIErrorPlainText(c *check.C) { +func (s *DockerSuite) TestAPIErrorPlainText(c *testing.T) { // Windows requires API 1.25 or later. This test is validating a behaviour which was present // in v1.23, but changed in 1.24, hence not applicable on Windows. See apiVersionSupportsJSONErrors testRequires(c, DaemonIsLinux) @@ -88,7 +88,7 @@ func (s *DockerSuite) TestAPIErrorPlainText(c *check.C) { assert.Equal(c, strings.TrimSpace(string(b)), "Config cannot be empty in order to create a container") } -func (s *DockerSuite) TestAPIErrorNotFoundJSON(c *check.C) { +func (s *DockerSuite) TestAPIErrorNotFoundJSON(c *testing.T) { // 404 is a different code path to normal errors, so test separately httpResp, body, err := request.Get("/notfound", request.JSON) assert.NilError(c, err) @@ -99,7 +99,7 @@ func (s *DockerSuite) TestAPIErrorNotFoundJSON(c *check.C) { assert.Equal(c, getErrorMessage(c, b), "page not found") } -func (s *DockerSuite) TestAPIErrorNotFoundPlainText(c *check.C) { +func (s *DockerSuite) TestAPIErrorNotFoundPlainText(c *testing.T) { httpResp, body, err := request.Get("/v1.23/notfound", request.JSON) assert.NilError(c, err) assert.Equal(c, httpResp.StatusCode, http.StatusNotFound) diff --git a/integration-cli/docker_cli_attach_test.go b/integration-cli/docker_cli_attach_test.go index f979aedc68..ac1886926c 100644 --- a/integration-cli/docker_cli_attach_test.go +++ b/integration-cli/docker_cli_attach_test.go @@ -18,7 +18,7 @@ import ( const attachWait = 5 * time.Second -func (s *DockerSuite) TestAttachMultipleAndRestart(c *check.C) { +func (s *DockerSuite) TestAttachMultipleAndRestart(c *testing.T) { endGroup := &sync.WaitGroup{} startGroup := &sync.WaitGroup{} endGroup.Add(3) @@ -88,7 +88,7 @@ func (s *DockerSuite) TestAttachMultipleAndRestart(c *check.C) { } } -func (s *DockerSuite) TestAttachTTYWithoutStdin(c *check.C) { +func (s *DockerSuite) TestAttachTTYWithoutStdin(c *testing.T) { // TODO @jhowardmsft. Figure out how to get this running again reliable on Windows. // It works by accident at the moment. Sometimes. I've gone back to v1.13.0 and see the same. // On Windows, docker run -d -ti busybox causes the container to exit immediately. @@ -133,7 +133,7 @@ func (s *DockerSuite) TestAttachTTYWithoutStdin(c *check.C) { } } -func (s *DockerSuite) TestAttachDisconnect(c *check.C) { +func (s *DockerSuite) TestAttachDisconnect(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-di", "busybox", "/bin/cat") id := strings.TrimSpace(out) @@ -166,7 +166,7 @@ func (s *DockerSuite) TestAttachDisconnect(c *check.C) { assert.Assert(c, running, check.Equals, "true") } -func (s *DockerSuite) TestAttachPausedContainer(c *check.C) { +func (s *DockerSuite) TestAttachPausedContainer(c *testing.T) { testRequires(c, IsPausable) runSleepingContainer(c, "-d", "--name=test") dockerCmd(c, "pause", "test") diff --git a/integration-cli/docker_cli_attach_unix_test.go b/integration-cli/docker_cli_attach_unix_test.go index 9402bcea01..b8d3f8ed76 100644 --- a/integration-cli/docker_cli_attach_unix_test.go +++ b/integration-cli/docker_cli_attach_unix_test.go @@ -15,7 +15,7 @@ import ( ) // #9860 Make sure attach ends when container ends (with no errors) -func (s *DockerSuite) TestAttachClosedOnContainerStop(c *check.C) { +func (s *DockerSuite) TestAttachClosedOnContainerStop(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) out, _ := dockerCmd(c, "run", "-dti", "busybox", "/bin/sh", "-c", `trap 'exit 0' SIGTERM; while true; do sleep 1; done`) @@ -58,7 +58,7 @@ func (s *DockerSuite) TestAttachClosedOnContainerStop(c *check.C) { } -func (s *DockerSuite) TestAttachAfterDetach(c *check.C) { +func (s *DockerSuite) TestAttachAfterDetach(c *testing.T) { name := "detachtest" cpty, tty, err := pty.Open() @@ -123,7 +123,7 @@ func (s *DockerSuite) TestAttachAfterDetach(c *check.C) { } // TestAttachDetach checks that attach in tty mode can be detached using the long container ID -func (s *DockerSuite) TestAttachDetach(c *check.C) { +func (s *DockerSuite) TestAttachDetach(c *testing.T) { out, _ := dockerCmd(c, "run", "-itd", "busybox", "cat") id := strings.TrimSpace(out) assert.NilError(c, waitRun(id)) diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index 84debeeef3..01cb499356 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -32,14 +32,14 @@ import ( "gotest.tools/icmd" ) -func (s *DockerSuite) TestBuildJSONEmptyRun(c *check.C) { +func (s *DockerSuite) TestBuildJSONEmptyRun(c *testing.T) { cli.BuildCmd(c, "testbuildjsonemptyrun", build.WithDockerfile(` FROM busybox RUN [] `)) } -func (s *DockerSuite) TestBuildShCmdJSONEntrypoint(c *check.C) { +func (s *DockerSuite) TestBuildShCmdJSONEntrypoint(c *testing.T) { name := "testbuildshcmdjsonentrypoint" expected := "/bin/sh -c echo test" if testEnv.OSType == "windows" { @@ -58,7 +58,7 @@ func (s *DockerSuite) TestBuildShCmdJSONEntrypoint(c *check.C) { } } -func (s *DockerSuite) TestBuildEnvironmentReplacementUser(c *check.C) { +func (s *DockerSuite) TestBuildEnvironmentReplacementUser(c *testing.T) { // Windows does not support FROM scratch or the USER command testRequires(c, DaemonIsLinux) name := "testbuildenvironmentreplacement" @@ -75,7 +75,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementUser(c *check.C) { } } -func (s *DockerSuite) TestBuildEnvironmentReplacementVolume(c *check.C) { +func (s *DockerSuite) TestBuildEnvironmentReplacementVolume(c *testing.T) { name := "testbuildenvironmentreplacement" var volumePath string @@ -100,7 +100,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementVolume(c *check.C) { } -func (s *DockerSuite) TestBuildEnvironmentReplacementExpose(c *check.C) { +func (s *DockerSuite) TestBuildEnvironmentReplacementExpose(c *testing.T) { // Windows does not support FROM scratch or the EXPOSE command testRequires(c, DaemonIsLinux) name := "testbuildenvironmentreplacement" @@ -125,7 +125,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementExpose(c *check.C) { } -func (s *DockerSuite) TestBuildEnvironmentReplacementWorkdir(c *check.C) { +func (s *DockerSuite) TestBuildEnvironmentReplacementWorkdir(c *testing.T) { name := "testbuildenvironmentreplacement" buildImageSuccessfully(c, name, build.WithDockerfile(` @@ -145,7 +145,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementWorkdir(c *check.C) { } } -func (s *DockerSuite) TestBuildEnvironmentReplacementAddCopy(c *check.C) { +func (s *DockerSuite) TestBuildEnvironmentReplacementAddCopy(c *testing.T) { name := "testbuildenvironmentreplacement" buildImageSuccessfully(c, name, build.WithBuildContext(c, @@ -169,7 +169,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementAddCopy(c *check.C) { )) } -func (s *DockerSuite) TestBuildEnvironmentReplacementEnv(c *check.C) { +func (s *DockerSuite) TestBuildEnvironmentReplacementEnv(c *testing.T) { // ENV expansions work differently in Windows testRequires(c, DaemonIsLinux) name := "testbuildenvironmentreplacement" @@ -232,7 +232,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementEnv(c *check.C) { } -func (s *DockerSuite) TestBuildHandleEscapesInVolume(c *check.C) { +func (s *DockerSuite) TestBuildHandleEscapesInVolume(c *testing.T) { // The volume paths used in this test are invalid on Windows testRequires(c, DaemonIsLinux) name := "testbuildhandleescapes" @@ -276,7 +276,7 @@ func (s *DockerSuite) TestBuildHandleEscapesInVolume(c *check.C) { } } -func (s *DockerSuite) TestBuildOnBuildLowercase(c *check.C) { +func (s *DockerSuite) TestBuildOnBuildLowercase(c *testing.T) { name := "testbuildonbuildlowercase" name2 := "testbuildonbuildlowercase2" @@ -300,7 +300,7 @@ func (s *DockerSuite) TestBuildOnBuildLowercase(c *check.C) { } -func (s *DockerSuite) TestBuildEnvEscapes(c *check.C) { +func (s *DockerSuite) TestBuildEnvEscapes(c *testing.T) { // ENV expansions work differently in Windows testRequires(c, DaemonIsLinux) name := "testbuildenvescapes" @@ -317,7 +317,7 @@ func (s *DockerSuite) TestBuildEnvEscapes(c *check.C) { } -func (s *DockerSuite) TestBuildEnvOverwrite(c *check.C) { +func (s *DockerSuite) TestBuildEnvOverwrite(c *testing.T) { // ENV expansions work differently in Windows testRequires(c, DaemonIsLinux) name := "testbuildenvoverwrite" @@ -335,7 +335,7 @@ func (s *DockerSuite) TestBuildEnvOverwrite(c *check.C) { } // FIXME(vdemeester) why we disabled cache here ? -func (s *DockerSuite) TestBuildOnBuildCmdEntrypointJSON(c *check.C) { +func (s *DockerSuite) TestBuildOnBuildCmdEntrypointJSON(c *testing.T) { name1 := "onbuildcmd" name2 := "onbuildgenerated" @@ -352,7 +352,7 @@ ONBUILD RUN ["true"]`)) } // FIXME(vdemeester) why we disabled cache here ? -func (s *DockerSuite) TestBuildOnBuildEntrypointJSON(c *check.C) { +func (s *DockerSuite) TestBuildOnBuildEntrypointJSON(c *testing.T) { name1 := "onbuildcmd" name2 := "onbuildgenerated" @@ -369,7 +369,7 @@ ONBUILD ENTRYPOINT ["echo"]`)) } -func (s *DockerSuite) TestBuildCacheAdd(c *check.C) { +func (s *DockerSuite) TestBuildCacheAdd(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows doesn't have httpserver image yet name := "testbuildtwoimageswithadd" server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{ @@ -389,7 +389,7 @@ func (s *DockerSuite) TestBuildCacheAdd(c *check.C) { } } -func (s *DockerSuite) TestBuildLastModified(c *check.C) { +func (s *DockerSuite) TestBuildLastModified(c *testing.T) { // Temporary fix for #30890. TODO @jhowardmsft figure out what // has changed in the master busybox image. testRequires(c, DaemonIsLinux) @@ -442,7 +442,7 @@ ADD %s/file /` // Regression for https://github.com/docker/docker/pull/27805 // Makes sure that we don't use the cache if the contents of // a file in a subfolder of the context is modified and we re-build. -func (s *DockerSuite) TestBuildModifyFileInFolder(c *check.C) { +func (s *DockerSuite) TestBuildModifyFileInFolder(c *testing.T) { name := "testbuildmodifyfileinfolder" ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(`FROM busybox @@ -464,7 +464,7 @@ ADD folder/file /test/changetarget`)) } } -func (s *DockerSuite) TestBuildAddSingleFileToRoot(c *check.C) { +func (s *DockerSuite) TestBuildAddSingleFileToRoot(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test buildImageSuccessfully(c, "testaddimg", build.WithBuildContext(c, build.WithFile("Dockerfile", fmt.Sprintf(`FROM busybox @@ -480,7 +480,7 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`, expecte } // Issue #3960: "ADD src ." hangs -func (s *DockerSuite) TestBuildAddSingleFileToWorkdir(c *check.C) { +func (s *DockerSuite) TestBuildAddSingleFileToWorkdir(c *testing.T) { name := "testaddsinglefiletoworkdir" ctx := fakecontext.New(c, "", fakecontext.WithDockerfile( `FROM busybox @@ -503,7 +503,7 @@ func (s *DockerSuite) TestBuildAddSingleFileToWorkdir(c *check.C) { } } -func (s *DockerSuite) TestBuildAddSingleFileToExistDir(c *check.C) { +func (s *DockerSuite) TestBuildAddSingleFileToExistDir(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test cli.BuildCmd(c, "testaddsinglefiletoexistdir", build.WithBuildContext(c, build.WithFile("Dockerfile", `FROM busybox @@ -519,7 +519,7 @@ RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' build.WithFile("test_file", "test1"))) } -func (s *DockerSuite) TestBuildCopyAddMultipleFiles(c *check.C) { +func (s *DockerSuite) TestBuildCopyAddMultipleFiles(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{ "robots.txt": "hello", @@ -552,7 +552,7 @@ RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' // These tests are mainly for user namespaces to verify that new directories // are created as the remapped root uid/gid pair -func (s *DockerSuite) TestBuildUsernamespaceValidateRemappedRoot(c *check.C) { +func (s *DockerSuite) TestBuildUsernamespaceValidateRemappedRoot(c *testing.T) { testRequires(c, DaemonIsLinux) testCases := []string{ "ADD . /new_dir", @@ -571,7 +571,7 @@ RUN [ $(ls -l / | grep new_dir | awk '{print $3":"$4}') = 'root:root' ]`, tc)), } } -func (s *DockerSuite) TestBuildAddAndCopyFileWithWhitespace(c *check.C) { +func (s *DockerSuite) TestBuildAddAndCopyFileWithWhitespace(c *testing.T) { testRequires(c, DaemonIsLinux) // Not currently passing on Windows name := "testaddfilewithwhitespace" @@ -604,7 +604,7 @@ RUN [ $(cat "/test dir/test_file6") = 'test6' ]`, command, command, command, com } } -func (s *DockerSuite) TestBuildCopyFileWithWhitespaceOnWindows(c *check.C) { +func (s *DockerSuite) TestBuildCopyFileWithWhitespaceOnWindows(c *testing.T) { testRequires(c, DaemonIsWindows) dockerfile := `FROM ` + testEnv.PlatformDefaults.BaseImage + ` RUN mkdir "C:/test dir" @@ -634,7 +634,7 @@ RUN find "test6" "C:/test dir/test_file6"` )) } -func (s *DockerSuite) TestBuildCopyWildcard(c *check.C) { +func (s *DockerSuite) TestBuildCopyWildcard(c *testing.T) { name := "testcopywildcard" server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{ "robots.txt": "hello", @@ -674,7 +674,7 @@ func (s *DockerSuite) TestBuildCopyWildcard(c *check.C) { } -func (s *DockerSuite) TestBuildCopyWildcardInName(c *check.C) { +func (s *DockerSuite) TestBuildCopyWildcardInName(c *testing.T) { // Run this only on Linux // Below is the original comment (that I don't agree with — vdemeester) // Normally we would do c.Fatal(err) here but given that @@ -694,7 +694,7 @@ func (s *DockerSuite) TestBuildCopyWildcardInName(c *check.C) { )) } -func (s *DockerSuite) TestBuildCopyWildcardCache(c *check.C) { +func (s *DockerSuite) TestBuildCopyWildcardCache(c *testing.T) { name := "testcopywildcardcache" ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(`FROM busybox COPY file1.txt /tmp/`), @@ -720,7 +720,7 @@ func (s *DockerSuite) TestBuildCopyWildcardCache(c *check.C) { } -func (s *DockerSuite) TestBuildAddSingleFileToNonExistingDir(c *check.C) { +func (s *DockerSuite) TestBuildAddSingleFileToNonExistingDir(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test buildImageSuccessfully(c, "testaddsinglefiletononexistingdir", build.WithBuildContext(c, build.WithFile("Dockerfile", `FROM busybox @@ -735,7 +735,7 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`), build.WithFile("test_file", "test1"))) } -func (s *DockerSuite) TestBuildAddDirContentToRoot(c *check.C) { +func (s *DockerSuite) TestBuildAddDirContentToRoot(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test buildImageSuccessfully(c, "testadddircontenttoroot", build.WithBuildContext(c, build.WithFile("Dockerfile", `FROM busybox @@ -749,7 +749,7 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`), build.WithFile("test_dir/test_file", "test1"))) } -func (s *DockerSuite) TestBuildAddDirContentToExistingDir(c *check.C) { +func (s *DockerSuite) TestBuildAddDirContentToExistingDir(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test buildImageSuccessfully(c, "testadddircontenttoexistingdir", build.WithBuildContext(c, build.WithFile("Dockerfile", `FROM busybox @@ -765,7 +765,7 @@ RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ]`), build.WithFile("test_dir/test_file", "test1"))) } -func (s *DockerSuite) TestBuildAddWholeDirToRoot(c *check.C) { +func (s *DockerSuite) TestBuildAddWholeDirToRoot(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test buildImageSuccessfully(c, "testaddwholedirtoroot", build.WithBuildContext(c, build.WithFile("Dockerfile", fmt.Sprintf(`FROM busybox @@ -783,7 +783,7 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`, expecte } // Testing #5941 : Having an etc directory in context conflicts with the /etc/mtab -func (s *DockerSuite) TestBuildAddOrCopyEtcToRootShouldNotConflict(c *check.C) { +func (s *DockerSuite) TestBuildAddOrCopyEtcToRootShouldNotConflict(c *testing.T) { buildImageSuccessfully(c, "testaddetctoroot", build.WithBuildContext(c, build.WithFile("Dockerfile", `FROM `+minimalBaseImage()+` ADD . /`), @@ -795,7 +795,7 @@ COPY . /`), } // Testing #9401 : Losing setuid flag after a ADD -func (s *DockerSuite) TestBuildAddPreservesFilesSpecialBits(c *check.C) { +func (s *DockerSuite) TestBuildAddPreservesFilesSpecialBits(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test buildImageSuccessfully(c, "testaddetctoroot", build.WithBuildContext(c, build.WithFile("Dockerfile", `FROM busybox @@ -808,7 +808,7 @@ RUN [ $(ls -l /usr/bin/suidbin | awk '{print $1}') = '-rwsr-xr-x' ]`), build.WithFile("/data/usr/test_file", "test1"))) } -func (s *DockerSuite) TestBuildCopySingleFileToRoot(c *check.C) { +func (s *DockerSuite) TestBuildCopySingleFileToRoot(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test buildImageSuccessfully(c, "testcopysinglefiletoroot", build.WithBuildContext(c, build.WithFile("Dockerfile", fmt.Sprintf(`FROM busybox @@ -824,7 +824,7 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`, expecte } // Issue #3960: "ADD src ." hangs - adapted for COPY -func (s *DockerSuite) TestBuildCopySingleFileToWorkdir(c *check.C) { +func (s *DockerSuite) TestBuildCopySingleFileToWorkdir(c *testing.T) { name := "testcopysinglefiletoworkdir" ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(`FROM busybox COPY test_file .`), @@ -846,7 +846,7 @@ COPY test_file .`), } } -func (s *DockerSuite) TestBuildCopySingleFileToExistDir(c *check.C) { +func (s *DockerSuite) TestBuildCopySingleFileToExistDir(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test buildImageSuccessfully(c, "testcopysinglefiletoexistdir", build.WithBuildContext(c, build.WithFile("Dockerfile", `FROM busybox @@ -862,7 +862,7 @@ RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' build.WithFile("test_file", "test1"))) } -func (s *DockerSuite) TestBuildCopySingleFileToNonExistDir(c *check.C) { +func (s *DockerSuite) TestBuildCopySingleFileToNonExistDir(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific buildImageSuccessfully(c, "testcopysinglefiletononexistdir", build.WithBuildContext(c, build.WithFile("Dockerfile", `FROM busybox @@ -877,7 +877,7 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`), build.WithFile("test_file", "test1"))) } -func (s *DockerSuite) TestBuildCopyDirContentToRoot(c *check.C) { +func (s *DockerSuite) TestBuildCopyDirContentToRoot(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test buildImageSuccessfully(c, "testcopydircontenttoroot", build.WithBuildContext(c, build.WithFile("Dockerfile", `FROM busybox @@ -891,7 +891,7 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`), build.WithFile("test_dir/test_file", "test1"))) } -func (s *DockerSuite) TestBuildCopyDirContentToExistDir(c *check.C) { +func (s *DockerSuite) TestBuildCopyDirContentToExistDir(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test buildImageSuccessfully(c, "testcopydircontenttoexistdir", build.WithBuildContext(c, build.WithFile("Dockerfile", `FROM busybox @@ -907,7 +907,7 @@ RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ]`), build.WithFile("test_dir/test_file", "test1"))) } -func (s *DockerSuite) TestBuildCopyWholeDirToRoot(c *check.C) { +func (s *DockerSuite) TestBuildCopyWholeDirToRoot(c *testing.T) { testRequires(c, DaemonIsLinux) // Linux specific test buildImageSuccessfully(c, "testcopywholedirtoroot", build.WithBuildContext(c, build.WithFile("Dockerfile", fmt.Sprintf(`FROM busybox @@ -924,7 +924,7 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`, expecte build.WithFile("test_dir/test_file", "test1"))) } -func (s *DockerSuite) TestBuildAddBadLinks(c *check.C) { +func (s *DockerSuite) TestBuildAddBadLinks(c *testing.T) { testRequires(c, DaemonIsLinux) // Not currently working on Windows dockerfile := ` @@ -1004,7 +1004,7 @@ func (s *DockerSuite) TestBuildAddBadLinks(c *check.C) { } -func (s *DockerSuite) TestBuildAddBadLinksVolume(c *check.C) { +func (s *DockerSuite) TestBuildAddBadLinksVolume(c *testing.T) { testRequires(c, DaemonIsLinux) // ln not implemented on Windows busybox const ( dockerfileTemplate = ` @@ -1047,7 +1047,7 @@ func (s *DockerSuite) TestBuildAddBadLinksVolume(c *check.C) { // Issue #5270 - ensure we throw a better error than "unexpected EOF" // when we can't access files in the context. -func (s *DockerSuite) TestBuildWithInaccessibleFilesInContext(c *check.C) { +func (s *DockerSuite) TestBuildWithInaccessibleFilesInContext(c *testing.T) { testRequires(c, DaemonIsLinux, UnixCli, testEnv.IsLocalDaemon) // test uses chown/chmod: not available on windows { @@ -1168,7 +1168,7 @@ func (s *DockerSuite) TestBuildWithInaccessibleFilesInContext(c *check.C) { } } -func (s *DockerSuite) TestBuildForceRm(c *check.C) { +func (s *DockerSuite) TestBuildForceRm(c *testing.T) { containerCountBefore := getContainerCount(c) name := "testbuildforcerm" @@ -1187,7 +1187,7 @@ func (s *DockerSuite) TestBuildForceRm(c *check.C) { } -func (s *DockerSuite) TestBuildRm(c *check.C) { +func (s *DockerSuite) TestBuildRm(c *testing.T) { name := "testbuildrm" testCases := []struct { @@ -1230,7 +1230,7 @@ func (s *DockerSuite) TestBuildRm(c *check.C) { } } -func (s *DockerSuite) TestBuildWithVolumes(c *check.C) { +func (s *DockerSuite) TestBuildWithVolumes(c *testing.T) { testRequires(c, DaemonIsLinux) // Invalid volume paths on Windows var ( result map[string]map[string]struct{} @@ -1265,7 +1265,7 @@ func (s *DockerSuite) TestBuildWithVolumes(c *check.C) { } -func (s *DockerSuite) TestBuildMaintainer(c *check.C) { +func (s *DockerSuite) TestBuildMaintainer(c *testing.T) { name := "testbuildmaintainer" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM `+minimalBaseImage()+` @@ -1278,7 +1278,7 @@ func (s *DockerSuite) TestBuildMaintainer(c *check.C) { } } -func (s *DockerSuite) TestBuildUser(c *check.C) { +func (s *DockerSuite) TestBuildUser(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuilduser" expected := "dockerio" @@ -1292,7 +1292,7 @@ func (s *DockerSuite) TestBuildUser(c *check.C) { } } -func (s *DockerSuite) TestBuildRelativeWorkdir(c *check.C) { +func (s *DockerSuite) TestBuildRelativeWorkdir(c *testing.T) { name := "testbuildrelativeworkdir" var ( @@ -1334,7 +1334,7 @@ func (s *DockerSuite) TestBuildRelativeWorkdir(c *check.C) { // #22181 Regression test. Single end-to-end test of using // Windows semantics. Most path handling verifications are in unit tests -func (s *DockerSuite) TestBuildWindowsWorkdirProcessing(c *check.C) { +func (s *DockerSuite) TestBuildWindowsWorkdirProcessing(c *testing.T) { testRequires(c, DaemonIsWindows) buildImageSuccessfully(c, "testbuildwindowsworkdirprocessing", build.WithDockerfile(`FROM busybox WORKDIR C:\\foo @@ -1345,7 +1345,7 @@ func (s *DockerSuite) TestBuildWindowsWorkdirProcessing(c *check.C) { // #22181 Regression test. Most paths handling verifications are in unit test. // One functional test for end-to-end -func (s *DockerSuite) TestBuildWindowsAddCopyPathProcessing(c *check.C) { +func (s *DockerSuite) TestBuildWindowsAddCopyPathProcessing(c *testing.T) { testRequires(c, DaemonIsWindows) // TODO Windows (@jhowardmsft). Needs a follow-up PR to 22181 to // support backslash such as .\\ being equivalent to ./ and c:\\ being @@ -1378,7 +1378,7 @@ func (s *DockerSuite) TestBuildWindowsAddCopyPathProcessing(c *check.C) { )) } -func (s *DockerSuite) TestBuildWorkdirWithEnvVariables(c *check.C) { +func (s *DockerSuite) TestBuildWorkdirWithEnvVariables(c *testing.T) { name := "testbuildworkdirwithenvvariables" var expected string @@ -1399,7 +1399,7 @@ func (s *DockerSuite) TestBuildWorkdirWithEnvVariables(c *check.C) { } } -func (s *DockerSuite) TestBuildRelativeCopy(c *check.C) { +func (s *DockerSuite) TestBuildRelativeCopy(c *testing.T) { // cat /test1/test2/foo gets permission denied for the user testRequires(c, NotUserNamespace) @@ -1438,7 +1438,7 @@ func (s *DockerSuite) TestBuildRelativeCopy(c *check.C) { } // FIXME(vdemeester) should be unit test -func (s *DockerSuite) TestBuildBlankName(c *check.C) { +func (s *DockerSuite) TestBuildBlankName(c *testing.T) { name := "testbuildblankname" testCases := []struct { expression string @@ -1467,7 +1467,7 @@ func (s *DockerSuite) TestBuildBlankName(c *check.C) { } } -func (s *DockerSuite) TestBuildEnv(c *check.C) { +func (s *DockerSuite) TestBuildEnv(c *testing.T) { testRequires(c, DaemonIsLinux) // ENV expansion is different in Windows name := "testbuildenv" expected := "[PATH=/test:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PORT=2375]" @@ -1481,7 +1481,7 @@ func (s *DockerSuite) TestBuildEnv(c *check.C) { } } -func (s *DockerSuite) TestBuildPATH(c *check.C) { +func (s *DockerSuite) TestBuildPATH(c *testing.T) { testRequires(c, DaemonIsLinux) // ENV expansion is different in Windows defPath := "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" @@ -1510,7 +1510,7 @@ func (s *DockerSuite) TestBuildPATH(c *check.C) { } } -func (s *DockerSuite) TestBuildContextCleanup(c *check.C) { +func (s *DockerSuite) TestBuildContextCleanup(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) name := "testbuildcontextcleanup" @@ -1532,7 +1532,7 @@ func (s *DockerSuite) TestBuildContextCleanup(c *check.C) { } -func (s *DockerSuite) TestBuildContextCleanupFailedBuild(c *check.C) { +func (s *DockerSuite) TestBuildContextCleanupFailedBuild(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) name := "testbuildcontextcleanup" @@ -1575,7 +1575,7 @@ func compareDirectoryEntries(e1 []os.FileInfo, e2 []os.FileInfo) error { return nil } -func (s *DockerSuite) TestBuildCmd(c *check.C) { +func (s *DockerSuite) TestBuildCmd(c *testing.T) { name := "testbuildcmd" expected := "[/bin/echo Hello World]" @@ -1588,7 +1588,7 @@ func (s *DockerSuite) TestBuildCmd(c *check.C) { } } -func (s *DockerSuite) TestBuildExpose(c *check.C) { +func (s *DockerSuite) TestBuildExpose(c *testing.T) { testRequires(c, DaemonIsLinux) // Expose not implemented on Windows name := "testbuildexpose" expected := "map[2375/tcp:{}]" @@ -1602,7 +1602,7 @@ func (s *DockerSuite) TestBuildExpose(c *check.C) { } } -func (s *DockerSuite) TestBuildExposeMorePorts(c *check.C) { +func (s *DockerSuite) TestBuildExposeMorePorts(c *testing.T) { testRequires(c, DaemonIsLinux) // Expose not implemented on Windows // start building docker file with a large number of ports portList := make([]string, 50) @@ -1651,7 +1651,7 @@ func (s *DockerSuite) TestBuildExposeMorePorts(c *check.C) { } } -func (s *DockerSuite) TestBuildExposeOrder(c *check.C) { +func (s *DockerSuite) TestBuildExposeOrder(c *testing.T) { testRequires(c, DaemonIsLinux) // Expose not implemented on Windows buildID := func(name, exposed string) string { buildImageSuccessfully(c, name, build.WithDockerfile(fmt.Sprintf(`FROM scratch @@ -1667,7 +1667,7 @@ func (s *DockerSuite) TestBuildExposeOrder(c *check.C) { } } -func (s *DockerSuite) TestBuildExposeUpperCaseProto(c *check.C) { +func (s *DockerSuite) TestBuildExposeUpperCaseProto(c *testing.T) { testRequires(c, DaemonIsLinux) // Expose not implemented on Windows name := "testbuildexposeuppercaseproto" expected := "map[5678/udp:{}]" @@ -1679,7 +1679,7 @@ func (s *DockerSuite) TestBuildExposeUpperCaseProto(c *check.C) { } } -func (s *DockerSuite) TestBuildEmptyEntrypointInheritance(c *check.C) { +func (s *DockerSuite) TestBuildEmptyEntrypointInheritance(c *testing.T) { name := "testbuildentrypointinheritance" name2 := "testbuildentrypointinheritance2" @@ -1702,7 +1702,7 @@ func (s *DockerSuite) TestBuildEmptyEntrypointInheritance(c *check.C) { } } -func (s *DockerSuite) TestBuildEmptyEntrypoint(c *check.C) { +func (s *DockerSuite) TestBuildEmptyEntrypoint(c *testing.T) { name := "testbuildentrypoint" expected := "[]" @@ -1716,7 +1716,7 @@ func (s *DockerSuite) TestBuildEmptyEntrypoint(c *check.C) { } -func (s *DockerSuite) TestBuildEntrypoint(c *check.C) { +func (s *DockerSuite) TestBuildEntrypoint(c *testing.T) { name := "testbuildentrypoint" expected := "[/bin/echo]" @@ -1731,7 +1731,7 @@ func (s *DockerSuite) TestBuildEntrypoint(c *check.C) { } // #6445 ensure ONBUILD triggers aren't committed to grandchildren -func (s *DockerSuite) TestBuildOnBuildLimitedInheritance(c *check.C) { +func (s *DockerSuite) TestBuildOnBuildLimitedInheritance(c *testing.T) { buildImageSuccessfully(c, "testonbuildtrigger1", build.WithDockerfile(` FROM busybox RUN echo "GRANDPARENT" @@ -1749,7 +1749,7 @@ func (s *DockerSuite) TestBuildOnBuildLimitedInheritance(c *check.C) { } } -func (s *DockerSuite) TestBuildSameDockerfileWithAndWithoutCache(c *check.C) { +func (s *DockerSuite) TestBuildSameDockerfileWithAndWithoutCache(c *testing.T) { testRequires(c, DaemonIsLinux) // Expose not implemented on Windows name := "testbuildwithcache" dockerfile := `FROM scratch @@ -1771,7 +1771,7 @@ func (s *DockerSuite) TestBuildSameDockerfileWithAndWithoutCache(c *check.C) { } // Make sure that ADD/COPY still populate the cache even if they don't use it -func (s *DockerSuite) TestBuildConditionalCache(c *check.C) { +func (s *DockerSuite) TestBuildConditionalCache(c *testing.T) { name := "testbuildconditionalcache" dockerfile := ` @@ -1805,7 +1805,7 @@ func (s *DockerSuite) TestBuildConditionalCache(c *check.C) { } } -func (s *DockerSuite) TestBuildAddMultipleLocalFileWithAndWithoutCache(c *check.C) { +func (s *DockerSuite) TestBuildAddMultipleLocalFileWithAndWithoutCache(c *testing.T) { name := "testbuildaddmultiplelocalfilewithcache" baseName := name + "-base" @@ -1837,7 +1837,7 @@ func (s *DockerSuite) TestBuildAddMultipleLocalFileWithAndWithoutCache(c *check. } } -func (s *DockerSuite) TestBuildCopyDirButNotFile(c *check.C) { +func (s *DockerSuite) TestBuildCopyDirButNotFile(c *testing.T) { name := "testbuildcopydirbutnotfile" name2 := "testbuildcopydirbutnotfile2" @@ -1861,7 +1861,7 @@ func (s *DockerSuite) TestBuildCopyDirButNotFile(c *check.C) { } } -func (s *DockerSuite) TestBuildAddCurrentDirWithCache(c *check.C) { +func (s *DockerSuite) TestBuildAddCurrentDirWithCache(c *testing.T) { name := "testbuildaddcurrentdirwithcache" name2 := name + "2" name3 := name + "3" @@ -1908,7 +1908,7 @@ func (s *DockerSuite) TestBuildAddCurrentDirWithCache(c *check.C) { } // FIXME(vdemeester) this really seems to test the same thing as before (TestBuildAddMultipleLocalFileWithAndWithoutCache) -func (s *DockerSuite) TestBuildAddCurrentDirWithoutCache(c *check.C) { +func (s *DockerSuite) TestBuildAddCurrentDirWithoutCache(c *testing.T) { name := "testbuildaddcurrentdirwithoutcache" dockerfile := ` FROM ` + minimalBaseImage() + ` @@ -1927,7 +1927,7 @@ func (s *DockerSuite) TestBuildAddCurrentDirWithoutCache(c *check.C) { } } -func (s *DockerSuite) TestBuildAddRemoteFileWithAndWithoutCache(c *check.C) { +func (s *DockerSuite) TestBuildAddRemoteFileWithAndWithoutCache(c *testing.T) { name := "testbuildaddremotefilewithcache" server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{ "baz": "hello", @@ -1952,7 +1952,7 @@ func (s *DockerSuite) TestBuildAddRemoteFileWithAndWithoutCache(c *check.C) { } } -func (s *DockerSuite) TestBuildAddRemoteFileMTime(c *check.C) { +func (s *DockerSuite) TestBuildAddRemoteFileMTime(c *testing.T) { name := "testbuildaddremotefilemtime" name2 := name + "2" name3 := name + "3" @@ -1995,7 +1995,7 @@ func (s *DockerSuite) TestBuildAddRemoteFileMTime(c *check.C) { } // FIXME(vdemeester) this really seems to test the same thing as before (combined) -func (s *DockerSuite) TestBuildAddLocalAndRemoteFilesWithAndWithoutCache(c *check.C) { +func (s *DockerSuite) TestBuildAddLocalAndRemoteFilesWithAndWithoutCache(c *testing.T) { name := "testbuildaddlocalandremotefilewithcache" server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{ "baz": "hello", @@ -2024,7 +2024,7 @@ func (s *DockerSuite) TestBuildAddLocalAndRemoteFilesWithAndWithoutCache(c *chec } } -func testContextTar(c *check.C, compression archive.Compression) { +func testContextTar(c *testing.T, compression archive.Compression) { ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(`FROM busybox ADD foo /foo @@ -2043,15 +2043,15 @@ CMD ["cat", "/foo"]`), cli.BuildCmd(c, name, build.WithStdinContext(context)) } -func (s *DockerSuite) TestBuildContextTarGzip(c *check.C) { +func (s *DockerSuite) TestBuildContextTarGzip(c *testing.T) { testContextTar(c, archive.Gzip) } -func (s *DockerSuite) TestBuildContextTarNoCompression(c *check.C) { +func (s *DockerSuite) TestBuildContextTarNoCompression(c *testing.T) { testContextTar(c, archive.Uncompressed) } -func (s *DockerSuite) TestBuildNoContext(c *check.C) { +func (s *DockerSuite) TestBuildNoContext(c *testing.T) { name := "nocontext" icmd.RunCmd(icmd.Cmd{ Command: []string{dockerBinary, "build", "-t", name, "-"}, @@ -2066,7 +2066,7 @@ func (s *DockerSuite) TestBuildNoContext(c *check.C) { } // FIXME(vdemeester) migrate to docker/cli e2e -func (s *DockerSuite) TestBuildDockerfileStdin(c *check.C) { +func (s *DockerSuite) TestBuildDockerfileStdin(c *testing.T) { name := "stdindockerfile" tmpDir, err := ioutil.TempDir("", "fake-context") assert.NilError(c, err) @@ -2086,7 +2086,7 @@ CMD ["cat", "/foo"]`), } // FIXME(vdemeester) migrate to docker/cli tests (unit or e2e) -func (s *DockerSuite) TestBuildDockerfileStdinConflict(c *check.C) { +func (s *DockerSuite) TestBuildDockerfileStdinConflict(c *testing.T) { name := "stdindockerfiletarcontext" icmd.RunCmd(icmd.Cmd{ Command: []string{dockerBinary, "build", "-t", name, "-f", "-", "-"}, @@ -2096,19 +2096,19 @@ func (s *DockerSuite) TestBuildDockerfileStdinConflict(c *check.C) { }) } -func (s *DockerSuite) TestBuildDockerfileStdinNoExtraFiles(c *check.C) { +func (s *DockerSuite) TestBuildDockerfileStdinNoExtraFiles(c *testing.T) { s.testBuildDockerfileStdinNoExtraFiles(c, false, false) } -func (s *DockerSuite) TestBuildDockerfileStdinDockerignore(c *check.C) { +func (s *DockerSuite) TestBuildDockerfileStdinDockerignore(c *testing.T) { s.testBuildDockerfileStdinNoExtraFiles(c, true, false) } -func (s *DockerSuite) TestBuildDockerfileStdinDockerignoreIgnored(c *check.C) { +func (s *DockerSuite) TestBuildDockerfileStdinDockerignoreIgnored(c *testing.T) { s.testBuildDockerfileStdinNoExtraFiles(c, true, true) } -func (s *DockerSuite) testBuildDockerfileStdinNoExtraFiles(c *check.C, hasDockerignore, ignoreDockerignore bool) { +func (s *DockerSuite) testBuildDockerfileStdinNoExtraFiles(c *testing.T, hasDockerignore, ignoreDockerignore bool) { name := "stdindockerfilenoextra" tmpDir, err := ioutil.TempDir("", "fake-context") assert.NilError(c, err) @@ -2148,7 +2148,7 @@ COPY . /baz`), } } -func (s *DockerSuite) TestBuildWithVolumeOwnership(c *check.C) { +func (s *DockerSuite) TestBuildWithVolumeOwnership(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildimg" @@ -2168,7 +2168,7 @@ func (s *DockerSuite) TestBuildWithVolumeOwnership(c *check.C) { // testing #1405 - config.Cmd does not get cleaned up if // utilizing cache -func (s *DockerSuite) TestBuildEntrypointRunCleanup(c *check.C) { +func (s *DockerSuite) TestBuildEntrypointRunCleanup(c *testing.T) { name := "testbuildcmdcleanup" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox RUN echo "hello"`)) @@ -2187,7 +2187,7 @@ func (s *DockerSuite) TestBuildEntrypointRunCleanup(c *check.C) { } } -func (s *DockerSuite) TestBuildAddFileNotFound(c *check.C) { +func (s *DockerSuite) TestBuildAddFileNotFound(c *testing.T) { name := "testbuildaddnotfound" expected := "foo: no such file or directory" @@ -2204,7 +2204,7 @@ func (s *DockerSuite) TestBuildAddFileNotFound(c *check.C) { }) } -func (s *DockerSuite) TestBuildInheritance(c *check.C) { +func (s *DockerSuite) TestBuildInheritance(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildinheritance" @@ -2225,7 +2225,7 @@ func (s *DockerSuite) TestBuildInheritance(c *check.C) { } } -func (s *DockerSuite) TestBuildFails(c *check.C) { +func (s *DockerSuite) TestBuildFails(c *testing.T) { name := "testbuildfails" buildImage(name, build.WithDockerfile(`FROM busybox RUN sh -c "exit 23"`)).Assert(c, icmd.Expected{ @@ -2234,7 +2234,7 @@ func (s *DockerSuite) TestBuildFails(c *check.C) { }) } -func (s *DockerSuite) TestBuildOnBuild(c *check.C) { +func (s *DockerSuite) TestBuildOnBuild(c *testing.T) { name := "testbuildonbuild" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox ONBUILD RUN touch foobar`)) @@ -2243,7 +2243,7 @@ func (s *DockerSuite) TestBuildOnBuild(c *check.C) { } // gh #2446 -func (s *DockerSuite) TestBuildAddToSymlinkDest(c *check.C) { +func (s *DockerSuite) TestBuildAddToSymlinkDest(c *testing.T) { makeLink := `ln -s /foo /bar` if testEnv.OSType == "windows" { makeLink = `mklink /D C:\bar C:\foo` @@ -2261,7 +2261,7 @@ func (s *DockerSuite) TestBuildAddToSymlinkDest(c *check.C) { )) } -func (s *DockerSuite) TestBuildEscapeWhitespace(c *check.C) { +func (s *DockerSuite) TestBuildEscapeWhitespace(c *testing.T) { name := "testbuildescapewhitespace" buildImageSuccessfully(c, name, build.WithDockerfile(` @@ -2279,7 +2279,7 @@ docker.com>" } -func (s *DockerSuite) TestBuildVerifyIntString(c *check.C) { +func (s *DockerSuite) TestBuildVerifyIntString(c *testing.T) { // Verify that strings that look like ints are still passed as strings name := "testbuildstringing" @@ -2294,7 +2294,7 @@ func (s *DockerSuite) TestBuildVerifyIntString(c *check.C) { } -func (s *DockerSuite) TestBuildDockerignore(c *check.C) { +func (s *DockerSuite) TestBuildDockerignore(c *testing.T) { name := "testbuilddockerignore" buildImageSuccessfully(c, name, build.WithBuildContext(c, build.WithFile("Dockerfile", ` @@ -2332,7 +2332,7 @@ dir`), )) } -func (s *DockerSuite) TestBuildDockerignoreCleanPaths(c *check.C) { +func (s *DockerSuite) TestBuildDockerignoreCleanPaths(c *testing.T) { name := "testbuilddockerignorecleanpaths" buildImageSuccessfully(c, name, build.WithBuildContext(c, build.WithFile("Dockerfile", ` @@ -2346,7 +2346,7 @@ func (s *DockerSuite) TestBuildDockerignoreCleanPaths(c *check.C) { )) } -func (s *DockerSuite) TestBuildDockerignoreExceptions(c *check.C) { +func (s *DockerSuite) TestBuildDockerignoreExceptions(c *testing.T) { name := "testbuilddockerignoreexceptions" buildImageSuccessfully(c, name, build.WithBuildContext(c, build.WithFile("Dockerfile", ` @@ -2391,7 +2391,7 @@ dir )) } -func (s *DockerSuite) TestBuildDockerignoringDockerfile(c *check.C) { +func (s *DockerSuite) TestBuildDockerignoringDockerfile(c *testing.T) { name := "testbuilddockerignoredockerfile" dockerfile := ` FROM busybox @@ -2409,7 +2409,7 @@ func (s *DockerSuite) TestBuildDockerignoringDockerfile(c *check.C) { )) } -func (s *DockerSuite) TestBuildDockerignoringRenamedDockerfile(c *check.C) { +func (s *DockerSuite) TestBuildDockerignoringRenamedDockerfile(c *testing.T) { name := "testbuilddockerignoredockerfile" dockerfile := ` FROM busybox @@ -2430,7 +2430,7 @@ func (s *DockerSuite) TestBuildDockerignoringRenamedDockerfile(c *check.C) { )) } -func (s *DockerSuite) TestBuildDockerignoringDockerignore(c *check.C) { +func (s *DockerSuite) TestBuildDockerignoringDockerignore(c *testing.T) { name := "testbuilddockerignoredockerignore" dockerfile := ` FROM busybox @@ -2443,7 +2443,7 @@ func (s *DockerSuite) TestBuildDockerignoringDockerignore(c *check.C) { )) } -func (s *DockerSuite) TestBuildDockerignoreTouchDockerfile(c *check.C) { +func (s *DockerSuite) TestBuildDockerignoreTouchDockerfile(c *testing.T) { name := "testbuilddockerignoretouchdockerfile" dockerfile := ` FROM busybox @@ -2485,7 +2485,7 @@ func (s *DockerSuite) TestBuildDockerignoreTouchDockerfile(c *check.C) { } } -func (s *DockerSuite) TestBuildDockerignoringWholeDir(c *check.C) { +func (s *DockerSuite) TestBuildDockerignoringWholeDir(c *testing.T) { name := "testbuilddockerignorewholedir" dockerfile := ` @@ -2502,7 +2502,7 @@ func (s *DockerSuite) TestBuildDockerignoringWholeDir(c *check.C) { )) } -func (s *DockerSuite) TestBuildDockerignoringOnlyDotfiles(c *check.C) { +func (s *DockerSuite) TestBuildDockerignoringOnlyDotfiles(c *testing.T) { name := "testbuilddockerignorewholedir" dockerfile := ` @@ -2519,7 +2519,7 @@ func (s *DockerSuite) TestBuildDockerignoringOnlyDotfiles(c *check.C) { )) } -func (s *DockerSuite) TestBuildDockerignoringBadExclusion(c *check.C) { +func (s *DockerSuite) TestBuildDockerignoringBadExclusion(c *testing.T) { name := "testbuilddockerignorebadexclusion" buildImage(name, build.WithBuildContext(c, build.WithFile("Dockerfile", ` @@ -2536,7 +2536,7 @@ func (s *DockerSuite) TestBuildDockerignoringBadExclusion(c *check.C) { }) } -func (s *DockerSuite) TestBuildDockerignoringWildTopDir(c *check.C) { +func (s *DockerSuite) TestBuildDockerignoringWildTopDir(c *testing.T) { dockerfile := ` FROM busybox COPY . / @@ -2558,7 +2558,7 @@ func (s *DockerSuite) TestBuildDockerignoringWildTopDir(c *check.C) { } } -func (s *DockerSuite) TestBuildDockerignoringWildDirs(c *check.C) { +func (s *DockerSuite) TestBuildDockerignoringWildDirs(c *testing.T) { dockerfile := ` FROM busybox COPY . / @@ -2621,7 +2621,7 @@ dir1/dir3/** )) } -func (s *DockerSuite) TestBuildLineBreak(c *check.C) { +func (s *DockerSuite) TestBuildLineBreak(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildlinebreak" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox @@ -2632,7 +2632,7 @@ RUN sh -c "[ "$(cat /tmp/passwd)" = "root:testpass" ]" RUN sh -c "[ "$(ls -d /var/run/sshd)" = "/var/run/sshd" ]"`)) } -func (s *DockerSuite) TestBuildEOLInLine(c *check.C) { +func (s *DockerSuite) TestBuildEOLInLine(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildeolinline" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox @@ -2643,7 +2643,7 @@ RUN sh -c "[ "$(cat /tmp/passwd)" = "root:testpass" ]" RUN sh -c "[ "$(ls -d /var/run/sshd)" = "/var/run/sshd" ]"`)) } -func (s *DockerSuite) TestBuildCommentsShebangs(c *check.C) { +func (s *DockerSuite) TestBuildCommentsShebangs(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildcomments" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox @@ -2657,7 +2657,7 @@ RUN [ "$(cat /hello.sh)" = $'#!/bin/sh\necho hello world' ] RUN [ "$(/hello.sh)" = "hello world" ]`)) } -func (s *DockerSuite) TestBuildUsersAndGroups(c *check.C) { +func (s *DockerSuite) TestBuildUsersAndGroups(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildusers" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox @@ -2713,7 +2713,7 @@ RUN [ "$(id -u):$(id -g)/$(id -un):$(id -gn)/$(id -G):$(id -Gn)" = '1042:1043/10 } // FIXME(vdemeester) rename this test (and probably "merge" it with the one below TestBuildEnvUsage2) -func (s *DockerSuite) TestBuildEnvUsage(c *check.C) { +func (s *DockerSuite) TestBuildEnvUsage(c *testing.T) { // /docker/world/hello is not owned by the correct user testRequires(c, NotUserNamespace) testRequires(c, DaemonIsLinux) @@ -2744,7 +2744,7 @@ RUN [ "$ghi" = "def" ] } // FIXME(vdemeester) rename this test (and probably "merge" it with the one above TestBuildEnvUsage) -func (s *DockerSuite) TestBuildEnvUsage2(c *check.C) { +func (s *DockerSuite) TestBuildEnvUsage2(c *testing.T) { // /docker/world/hello is not owned by the correct user testRequires(c, NotUserNamespace) testRequires(c, DaemonIsLinux) @@ -2813,7 +2813,7 @@ RUN [ "$eee1,$eee2,$eee3,$eee4" = 'foo,foo,foo,foo' ] )) } -func (s *DockerSuite) TestBuildAddScript(c *check.C) { +func (s *DockerSuite) TestBuildAddScript(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildaddscript" dockerfile := ` @@ -2829,7 +2829,7 @@ RUN [ "$(cat /testfile)" = 'test!' ]` )) } -func (s *DockerSuite) TestBuildAddTar(c *check.C) { +func (s *DockerSuite) TestBuildAddTar(c *testing.T) { // /test/foo is not owned by the correct user testRequires(c, NotUserNamespace) name := "testbuildaddtar" @@ -2883,7 +2883,7 @@ RUN cat /existing-directory-trailing-slash/test/foo | grep Hi` buildImageSuccessfully(c, name, build.WithExternalBuildContext(ctx)) } -func (s *DockerSuite) TestBuildAddBrokenTar(c *check.C) { +func (s *DockerSuite) TestBuildAddBrokenTar(c *testing.T) { name := "testbuildaddbrokentar" ctx := func() *fakecontext.Fake { @@ -2934,7 +2934,7 @@ ADD test.tar /` }) } -func (s *DockerSuite) TestBuildAddNonTar(c *check.C) { +func (s *DockerSuite) TestBuildAddNonTar(c *testing.T) { name := "testbuildaddnontar" // Should not try to extract test.tar @@ -2947,7 +2947,7 @@ func (s *DockerSuite) TestBuildAddNonTar(c *check.C) { )) } -func (s *DockerSuite) TestBuildAddTarXz(c *check.C) { +func (s *DockerSuite) TestBuildAddTarXz(c *testing.T) { // /test/foo is not owned by the correct user testRequires(c, NotUserNamespace) testRequires(c, DaemonIsLinux) @@ -2996,7 +2996,7 @@ func (s *DockerSuite) TestBuildAddTarXz(c *check.C) { buildImageSuccessfully(c, name, build.WithExternalBuildContext(ctx)) } -func (s *DockerSuite) TestBuildAddTarXzGz(c *check.C) { +func (s *DockerSuite) TestBuildAddTarXzGz(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildaddtarxzgz" @@ -3049,7 +3049,7 @@ func (s *DockerSuite) TestBuildAddTarXzGz(c *check.C) { } // FIXME(vdemeester) most of the from git tests could be moved to `docker/cli` e2e tests -func (s *DockerSuite) TestBuildFromGit(c *check.C) { +func (s *DockerSuite) TestBuildFromGit(c *testing.T) { name := "testbuildfromgit" git := fakegit.New(c, "repo", map[string]string{ "Dockerfile": `FROM busybox @@ -3068,7 +3068,7 @@ func (s *DockerSuite) TestBuildFromGit(c *check.C) { } } -func (s *DockerSuite) TestBuildFromGitWithContext(c *check.C) { +func (s *DockerSuite) TestBuildFromGitWithContext(c *testing.T) { name := "testbuildfromgit" git := fakegit.New(c, "repo", map[string]string{ "docker/Dockerfile": `FROM busybox @@ -3087,7 +3087,7 @@ func (s *DockerSuite) TestBuildFromGitWithContext(c *check.C) { } } -func (s *DockerSuite) TestBuildFromGitWithF(c *check.C) { +func (s *DockerSuite) TestBuildFromGitWithF(c *testing.T) { name := "testbuildfromgitwithf" git := fakegit.New(c, "repo", map[string]string{ "myApp/myDockerfile": `FROM busybox @@ -3100,7 +3100,7 @@ func (s *DockerSuite) TestBuildFromGitWithF(c *check.C) { }) } -func (s *DockerSuite) TestBuildFromRemoteTarball(c *check.C) { +func (s *DockerSuite) TestBuildFromRemoteTarball(c *testing.T) { name := "testbuildfromremotetarball" buffer := new(bytes.Buffer) @@ -3135,7 +3135,7 @@ func (s *DockerSuite) TestBuildFromRemoteTarball(c *check.C) { } } -func (s *DockerSuite) TestBuildCleanupCmdOnEntrypoint(c *check.C) { +func (s *DockerSuite) TestBuildCleanupCmdOnEntrypoint(c *testing.T) { name := "testbuildcmdcleanuponentrypoint" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM `+minimalBaseImage()+` @@ -3154,7 +3154,7 @@ func (s *DockerSuite) TestBuildCleanupCmdOnEntrypoint(c *check.C) { } } -func (s *DockerSuite) TestBuildClearCmd(c *check.C) { +func (s *DockerSuite) TestBuildClearCmd(c *testing.T) { name := "testbuildclearcmd" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM `+minimalBaseImage()+` ENTRYPOINT ["/bin/bash"] @@ -3166,7 +3166,7 @@ func (s *DockerSuite) TestBuildClearCmd(c *check.C) { } } -func (s *DockerSuite) TestBuildEmptyCmd(c *check.C) { +func (s *DockerSuite) TestBuildEmptyCmd(c *testing.T) { // Skip on Windows. Base image on Windows has a CMD set in the image. testRequires(c, DaemonIsLinux) @@ -3179,7 +3179,7 @@ func (s *DockerSuite) TestBuildEmptyCmd(c *check.C) { } } -func (s *DockerSuite) TestBuildOnBuildOutput(c *check.C) { +func (s *DockerSuite) TestBuildOnBuildOutput(c *testing.T) { name := "testbuildonbuildparent" buildImageSuccessfully(c, name, build.WithDockerfile("FROM busybox\nONBUILD RUN echo foo\n")) @@ -3189,7 +3189,7 @@ func (s *DockerSuite) TestBuildOnBuildOutput(c *check.C) { } // FIXME(vdemeester) should be a unit test -func (s *DockerSuite) TestBuildInvalidTag(c *check.C) { +func (s *DockerSuite) TestBuildInvalidTag(c *testing.T) { name := "abcd:" + testutil.GenerateRandomAlphaOnlyString(200) buildImage(name, build.WithDockerfile("FROM "+minimalBaseImage()+"\nMAINTAINER quux\n")).Assert(c, icmd.Expected{ ExitCode: 125, @@ -3197,7 +3197,7 @@ func (s *DockerSuite) TestBuildInvalidTag(c *check.C) { }) } -func (s *DockerSuite) TestBuildCmdShDashC(c *check.C) { +func (s *DockerSuite) TestBuildCmdShDashC(c *testing.T) { name := "testbuildcmdshc" buildImageSuccessfully(c, name, build.WithDockerfile("FROM busybox\nCMD echo cmd\n")) @@ -3212,7 +3212,7 @@ func (s *DockerSuite) TestBuildCmdShDashC(c *check.C) { } -func (s *DockerSuite) TestBuildCmdSpaces(c *check.C) { +func (s *DockerSuite) TestBuildCmdSpaces(c *testing.T) { // Test to make sure that when we strcat arrays we take into account // the arg separator to make sure ["echo","hi"] and ["echo hi"] don't // look the same @@ -3238,7 +3238,7 @@ func (s *DockerSuite) TestBuildCmdSpaces(c *check.C) { } } -func (s *DockerSuite) TestBuildCmdJSONNoShDashC(c *check.C) { +func (s *DockerSuite) TestBuildCmdJSONNoShDashC(c *testing.T) { name := "testbuildcmdjson" buildImageSuccessfully(c, name, build.WithDockerfile("FROM busybox\nCMD [\"echo\", \"cmd\"]")) @@ -3249,7 +3249,7 @@ func (s *DockerSuite) TestBuildCmdJSONNoShDashC(c *check.C) { } } -func (s *DockerSuite) TestBuildEntrypointCanBeOverriddenByChild(c *check.C) { +func (s *DockerSuite) TestBuildEntrypointCanBeOverriddenByChild(c *testing.T) { buildImageSuccessfully(c, "parent", build.WithDockerfile(` FROM busybox ENTRYPOINT exit 130 @@ -3269,7 +3269,7 @@ func (s *DockerSuite) TestBuildEntrypointCanBeOverriddenByChild(c *check.C) { }) } -func (s *DockerSuite) TestBuildEntrypointCanBeOverriddenByChildInspect(c *check.C) { +func (s *DockerSuite) TestBuildEntrypointCanBeOverriddenByChildInspect(c *testing.T) { var ( name = "testbuildepinherit" name2 = "testbuildepinherit2" @@ -3293,14 +3293,14 @@ func (s *DockerSuite) TestBuildEntrypointCanBeOverriddenByChildInspect(c *check. }) } -func (s *DockerSuite) TestBuildRunShEntrypoint(c *check.C) { +func (s *DockerSuite) TestBuildRunShEntrypoint(c *testing.T) { name := "testbuildentrypoint" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox ENTRYPOINT echo`)) dockerCmd(c, "run", "--rm", name) } -func (s *DockerSuite) TestBuildExoticShellInterpolation(c *check.C) { +func (s *DockerSuite) TestBuildExoticShellInterpolation(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildexoticshellinterpolation" @@ -3325,7 +3325,7 @@ func (s *DockerSuite) TestBuildExoticShellInterpolation(c *check.C) { `)) } -func (s *DockerSuite) TestBuildVerifySingleQuoteFails(c *check.C) { +func (s *DockerSuite) TestBuildVerifySingleQuoteFails(c *testing.T) { // This testcase is supposed to generate an error because the // JSON array we're passing in on the CMD uses single quotes instead // of double quotes (per the JSON spec). This means we interpret it @@ -3342,7 +3342,7 @@ func (s *DockerSuite) TestBuildVerifySingleQuoteFails(c *check.C) { }) } -func (s *DockerSuite) TestBuildVerboseOut(c *check.C) { +func (s *DockerSuite) TestBuildVerboseOut(c *testing.T) { name := "testbuildverboseout" expected := "\n123\n" @@ -3356,7 +3356,7 @@ RUN echo 123`)).Assert(c, icmd.Expected{ }) } -func (s *DockerSuite) TestBuildWithTabs(c *check.C) { +func (s *DockerSuite) TestBuildWithTabs(c *testing.T) { name := "testbuildwithtabs" buildImageSuccessfully(c, name, build.WithDockerfile("FROM busybox\nRUN echo\tone\t\ttwo")) res := inspectFieldJSON(c, name, "ContainerConfig.Cmd") @@ -3371,7 +3371,7 @@ func (s *DockerSuite) TestBuildWithTabs(c *check.C) { } } -func (s *DockerSuite) TestBuildLabels(c *check.C) { +func (s *DockerSuite) TestBuildLabels(c *testing.T) { name := "testbuildlabel" expected := `{"License":"GPL","Vendor":"Acme"}` buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox @@ -3383,7 +3383,7 @@ func (s *DockerSuite) TestBuildLabels(c *check.C) { } } -func (s *DockerSuite) TestBuildLabelsCache(c *check.C) { +func (s *DockerSuite) TestBuildLabelsCache(c *testing.T) { name := "testbuildlabelcache" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox @@ -3424,7 +3424,7 @@ func (s *DockerSuite) TestBuildLabelsCache(c *check.C) { } // FIXME(vdemeester) port to docker/cli e2e tests (api tests should test suppressOutput option though) -func (s *DockerSuite) TestBuildNotVerboseSuccess(c *check.C) { +func (s *DockerSuite) TestBuildNotVerboseSuccess(c *testing.T) { // This test makes sure that -q works correctly when build is successful: // stdout has only the image ID (long image ID) and stderr is empty. outRegexp := regexp.MustCompile("^(sha256:|)[a-z0-9]{64}\\n$") @@ -3475,7 +3475,7 @@ func (s *DockerSuite) TestBuildNotVerboseSuccess(c *check.C) { } // FIXME(vdemeester) migrate to docker/cli tests -func (s *DockerSuite) TestBuildNotVerboseFailureWithNonExistImage(c *check.C) { +func (s *DockerSuite) TestBuildNotVerboseFailureWithNonExistImage(c *testing.T) { // This test makes sure that -q works correctly when build fails by // comparing between the stderr output in quiet mode and in stdout // and stderr output in verbose mode @@ -3496,7 +3496,7 @@ func (s *DockerSuite) TestBuildNotVerboseFailureWithNonExistImage(c *check.C) { } // FIXME(vdemeester) migrate to docker/cli tests -func (s *DockerSuite) TestBuildNotVerboseFailure(c *check.C) { +func (s *DockerSuite) TestBuildNotVerboseFailure(c *testing.T) { // This test makes sure that -q works correctly when build fails by // comparing between the stderr output in quiet mode and in stdout // and stderr output in verbose mode @@ -3524,7 +3524,7 @@ func (s *DockerSuite) TestBuildNotVerboseFailure(c *check.C) { } // FIXME(vdemeester) migrate to docker/cli tests -func (s *DockerSuite) TestBuildNotVerboseFailureRemote(c *check.C) { +func (s *DockerSuite) TestBuildNotVerboseFailureRemote(c *testing.T) { // This test ensures that when given a wrong URL, stderr in quiet mode and // stderr in verbose mode are identical. // TODO(vdemeester) with cobra, stdout has a carriage return too much so this test should not check stdout @@ -3554,7 +3554,7 @@ func (s *DockerSuite) TestBuildNotVerboseFailureRemote(c *check.C) { } // FIXME(vdemeester) migrate to docker/cli tests -func (s *DockerSuite) TestBuildStderr(c *check.C) { +func (s *DockerSuite) TestBuildStderr(c *testing.T) { // This test just makes sure that no non-error output goes // to stderr name := "testbuildstderr" @@ -3572,7 +3572,7 @@ func (s *DockerSuite) TestBuildStderr(c *check.C) { } } -func (s *DockerSuite) TestBuildChownSingleFile(c *check.C) { +func (s *DockerSuite) TestBuildChownSingleFile(c *testing.T) { testRequires(c, UnixCli, DaemonIsLinux) // test uses chown: not available on windows name := "testbuildchownsinglefile" @@ -3596,7 +3596,7 @@ RUN [ $(ls -l /test | awk '{print $3":"$4}') = 'root:root' ] cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) } -func (s *DockerSuite) TestBuildSymlinkBreakout(c *check.C) { +func (s *DockerSuite) TestBuildSymlinkBreakout(c *testing.T) { name := "testbuildsymlinkbreakout" tmpdir, err := ioutil.TempDir("", name) assert.NilError(c, err) @@ -3651,7 +3651,7 @@ func (s *DockerSuite) TestBuildSymlinkBreakout(c *check.C) { } } -func (s *DockerSuite) TestBuildXZHost(c *check.C) { +func (s *DockerSuite) TestBuildXZHost(c *testing.T) { // /usr/local/sbin/xz gets permission denied for the user testRequires(c, NotUserNamespace) testRequires(c, DaemonIsLinux) @@ -3669,7 +3669,7 @@ RUN [ ! -e /injected ]`), )) } -func (s *DockerSuite) TestBuildVolumesRetainContents(c *check.C) { +func (s *DockerSuite) TestBuildVolumesRetainContents(c *testing.T) { // /foo/file gets permission denied for the user testRequires(c, NotUserNamespace) testRequires(c, DaemonIsLinux) // TODO Windows: Issue #20127 @@ -3699,7 +3699,7 @@ CMD cat /foo/file`), } -func (s *DockerSuite) TestBuildFromMixedcaseDockerfile(c *check.C) { +func (s *DockerSuite) TestBuildFromMixedcaseDockerfile(c *testing.T) { testRequires(c, UnixCli) // Dockerfile overwrites dockerfile on windows testRequires(c, DaemonIsLinux) @@ -3723,7 +3723,7 @@ func (s *DockerSuite) TestBuildFromMixedcaseDockerfile(c *check.C) { } // FIXME(vdemeester) should migrate to docker/cli tests -func (s *DockerSuite) TestBuildFromURLWithF(c *check.C) { +func (s *DockerSuite) TestBuildFromURLWithF(c *testing.T) { server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{"baz": `FROM busybox RUN echo from baz COPY * /tmp/ @@ -3750,7 +3750,7 @@ RUN find /tmp/`})) } // FIXME(vdemeester) should migrate to docker/cli tests -func (s *DockerSuite) TestBuildFromStdinWithF(c *check.C) { +func (s *DockerSuite) TestBuildFromStdinWithF(c *testing.T) { testRequires(c, DaemonIsLinux) // TODO Windows: This test is flaky; no idea why ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(`FROM busybox RUN echo "from Dockerfile"`)) @@ -3775,7 +3775,7 @@ RUN sh -c "find /tmp/" # sh -c is needed on Windows to use the correct find`) } -func (s *DockerSuite) TestBuildFromOfficialNames(c *check.C) { +func (s *DockerSuite) TestBuildFromOfficialNames(c *testing.T) { name := "testbuildfromofficial" fromNames := []string{ "busybox", @@ -3793,7 +3793,7 @@ func (s *DockerSuite) TestBuildFromOfficialNames(c *check.C) { } // FIXME(vdemeester) should be a unit test -func (s *DockerSuite) TestBuildSpaces(c *check.C) { +func (s *DockerSuite) TestBuildSpaces(c *testing.T) { // Test to make sure that leading/trailing spaces on a command // doesn't change the error msg we get name := "testspaces" @@ -3856,7 +3856,7 @@ func (s *DockerSuite) TestBuildSpaces(c *check.C) { } -func (s *DockerSuite) TestBuildSpacesWithQuotes(c *check.C) { +func (s *DockerSuite) TestBuildSpacesWithQuotes(c *testing.T) { // Test to make sure that spaces in quotes aren't lost name := "testspacesquotes" @@ -3876,7 +3876,7 @@ RUN echo " \ } // #4393 -func (s *DockerSuite) TestBuildVolumeFileExistsinContainer(c *check.C) { +func (s *DockerSuite) TestBuildVolumeFileExistsinContainer(c *testing.T) { testRequires(c, DaemonIsLinux) // TODO Windows: This should error out buildImage("docker-test-errcreatevolumewithfile", build.WithDockerfile(` FROM busybox @@ -3889,7 +3889,7 @@ func (s *DockerSuite) TestBuildVolumeFileExistsinContainer(c *check.C) { } // FIXME(vdemeester) should be a unit test -func (s *DockerSuite) TestBuildMissingArgs(c *check.C) { +func (s *DockerSuite) TestBuildMissingArgs(c *testing.T) { // Test to make sure that all Dockerfile commands (except the ones listed // in skipCmds) will generate an error if no args are provided. // Note: INSERT is deprecated so we exclude it because of that. @@ -3934,7 +3934,7 @@ func (s *DockerSuite) TestBuildMissingArgs(c *check.C) { } -func (s *DockerSuite) TestBuildEmptyScratch(c *check.C) { +func (s *DockerSuite) TestBuildEmptyScratch(c *testing.T) { testRequires(c, DaemonIsLinux) buildImage("sc", build.WithDockerfile("FROM scratch")).Assert(c, icmd.Expected{ ExitCode: 1, @@ -3942,14 +3942,14 @@ func (s *DockerSuite) TestBuildEmptyScratch(c *check.C) { }) } -func (s *DockerSuite) TestBuildDotDotFile(c *check.C) { +func (s *DockerSuite) TestBuildDotDotFile(c *testing.T) { buildImageSuccessfully(c, "sc", build.WithBuildContext(c, build.WithFile("Dockerfile", "FROM busybox\n"), build.WithFile("..gitme", ""), )) } -func (s *DockerSuite) TestBuildRUNoneJSON(c *check.C) { +func (s *DockerSuite) TestBuildRUNoneJSON(c *testing.T) { testRequires(c, DaemonIsLinux) // No hello-world Windows image name := "testbuildrunonejson" @@ -3959,7 +3959,7 @@ RUN [ "/hello" ]`)).Assert(c, icmd.Expected{ }) } -func (s *DockerSuite) TestBuildEmptyStringVolume(c *check.C) { +func (s *DockerSuite) TestBuildEmptyStringVolume(c *testing.T) { name := "testbuildemptystringvolume" buildImage(name, build.WithDockerfile(` @@ -3971,7 +3971,7 @@ func (s *DockerSuite) TestBuildEmptyStringVolume(c *check.C) { }) } -func (s *DockerSuite) TestBuildContainerWithCgroupParent(c *check.C) { +func (s *DockerSuite) TestBuildContainerWithCgroupParent(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) cgroupParent := "test" @@ -3999,7 +3999,7 @@ RUN cat /proc/self/cgroup } // FIXME(vdemeester) could be a unit test -func (s *DockerSuite) TestBuildNoDupOutput(c *check.C) { +func (s *DockerSuite) TestBuildNoDupOutput(c *testing.T) { // Check to make sure our build output prints the Dockerfile cmd // property - there was a bug that caused it to be duplicated on the // Step X line @@ -4016,7 +4016,7 @@ func (s *DockerSuite) TestBuildNoDupOutput(c *check.C) { // GH15826 // FIXME(vdemeester) could be a unit test -func (s *DockerSuite) TestBuildStartsFromOne(c *check.C) { +func (s *DockerSuite) TestBuildStartsFromOne(c *testing.T) { // Explicit check to ensure that build starts from step 1 rather than 0 name := "testbuildstartsfromone" result := buildImage(name, build.WithDockerfile(`FROM busybox`)) @@ -4027,7 +4027,7 @@ func (s *DockerSuite) TestBuildStartsFromOne(c *check.C) { } } -func (s *DockerSuite) TestBuildRUNErrMsg(c *check.C) { +func (s *DockerSuite) TestBuildRUNErrMsg(c *testing.T) { // Test to make sure the bad command is quoted with just "s and // not as a Go []string name := "testbuildbadrunerrmsg" @@ -4049,7 +4049,7 @@ func (s *DockerSuite) TestBuildRUNErrMsg(c *check.C) { } // Issue #15634: COPY fails when path starts with "null" -func (s *DockerSuite) TestBuildNullStringInAddCopyVolume(c *check.C) { +func (s *DockerSuite) TestBuildNullStringInAddCopyVolume(c *testing.T) { name := "testbuildnullstringinaddcopyvolume" volName := "nullvolume" if testEnv.OSType == "windows" { @@ -4069,7 +4069,7 @@ func (s *DockerSuite) TestBuildNullStringInAddCopyVolume(c *check.C) { )) } -func (s *DockerSuite) TestBuildStopSignal(c *check.C) { +func (s *DockerSuite) TestBuildStopSignal(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support STOPSIGNAL yet imgName := "test_build_stop_signal" buildImageSuccessfully(c, imgName, build.WithDockerfile(`FROM busybox @@ -4087,7 +4087,7 @@ func (s *DockerSuite) TestBuildStopSignal(c *check.C) { } } -func (s *DockerSuite) TestBuildBuildTimeArg(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArg(c *testing.T) { imgName := "bldargtest" envKey := "foo" envVal := "bar" @@ -4120,7 +4120,7 @@ func (s *DockerSuite) TestBuildBuildTimeArg(c *check.C) { } } -func (s *DockerSuite) TestBuildBuildTimeArgHistory(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgHistory(c *testing.T) { imgName := "bldargtest" envKey := "foo" envVal := "bar" @@ -4141,7 +4141,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgHistory(c *check.C) { } } -func (s *DockerSuite) TestBuildTimeArgHistoryExclusions(c *check.C) { +func (s *DockerSuite) TestBuildTimeArgHistoryExclusions(c *testing.T) { imgName := "bldargtest" envKey := "foo" envVal := "bar" @@ -4181,7 +4181,7 @@ func (s *DockerSuite) TestBuildTimeArgHistoryExclusions(c *check.C) { assert.Assert(c, origID, checker.Equals, cacheID) } -func (s *DockerSuite) TestBuildBuildTimeArgCacheHit(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgCacheHit(c *testing.T) { imgName := "bldargtest" envKey := "foo" envVal := "bar" @@ -4205,7 +4205,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgCacheHit(c *check.C) { } } -func (s *DockerSuite) TestBuildBuildTimeArgCacheMissExtraArg(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgCacheMissExtraArg(c *testing.T) { imgName := "bldargtest" envKey := "foo" envVal := "bar" @@ -4236,7 +4236,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgCacheMissExtraArg(c *check.C) { } } -func (s *DockerSuite) TestBuildBuildTimeArgCacheMissSameArgDiffVal(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgCacheMissSameArgDiffVal(c *testing.T) { imgName := "bldargtest" envKey := "foo" envVal := "bar" @@ -4261,7 +4261,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgCacheMissSameArgDiffVal(c *check.C) { } } -func (s *DockerSuite) TestBuildBuildTimeArgOverrideArgDefinedBeforeEnv(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgOverrideArgDefinedBeforeEnv(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support ARG imgName := "bldargtest" envKey := "foo" @@ -4290,7 +4290,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgOverrideArgDefinedBeforeEnv(c *check. } // FIXME(vdemeester) might be useful to merge with the one above ? -func (s *DockerSuite) TestBuildBuildTimeArgOverrideEnvDefinedBeforeArg(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgOverrideEnvDefinedBeforeArg(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support ARG imgName := "bldargtest" envKey := "foo" @@ -4317,7 +4317,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgOverrideEnvDefinedBeforeArg(c *check. } } -func (s *DockerSuite) TestBuildBuildTimeArgExpansion(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgExpansion(c *testing.T) { imgName := "bldvarstest" wdVar := "WDIR" @@ -4407,7 +4407,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgExpansion(c *check.C) { } } -func (s *DockerSuite) TestBuildBuildTimeArgExpansionOverride(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgExpansionOverride(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support ARG imgName := "bldvarstest" envKey := "foo" @@ -4435,7 +4435,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgExpansionOverride(c *check.C) { } } -func (s *DockerSuite) TestBuildBuildTimeArgUntrustedDefinedAfterUse(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgUntrustedDefinedAfterUse(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support ARG imgName := "bldargtest" envKey := "foo" @@ -4459,7 +4459,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgUntrustedDefinedAfterUse(c *check.C) } } -func (s *DockerSuite) TestBuildBuildTimeArgBuiltinArg(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgBuiltinArg(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support --build-arg imgName := "bldargtest" envKey := "HTTP_PROXY" @@ -4482,7 +4482,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgBuiltinArg(c *check.C) { } } -func (s *DockerSuite) TestBuildBuildTimeArgDefaultOverride(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgDefaultOverride(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support ARG imgName := "bldargtest" envKey := "foo" @@ -4508,7 +4508,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgDefaultOverride(c *check.C) { } } -func (s *DockerSuite) TestBuildBuildTimeArgUnconsumedArg(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgUnconsumedArg(c *testing.T) { imgName := "bldargtest" envKey := "foo" envVal := "bar" @@ -4524,7 +4524,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgUnconsumedArg(c *check.C) { }) } -func (s *DockerSuite) TestBuildBuildTimeArgEnv(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgEnv(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support ARG dockerfile := `FROM busybox ARG FOO1=fromfile @@ -4584,7 +4584,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgEnv(c *check.C) { assert.Assert(c, out, checker.Contains, "FOO9") } -func (s *DockerSuite) TestBuildBuildTimeArgQuotedValVariants(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgQuotedValVariants(c *testing.T) { imgName := "bldargtest" envKey := "foo" envKey1 := "foo1" @@ -4605,7 +4605,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgQuotedValVariants(c *check.C) { buildImageSuccessfully(c, imgName, build.WithDockerfile(dockerfile)) } -func (s *DockerSuite) TestBuildBuildTimeArgEmptyValVariants(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgEmptyValVariants(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support ARG imgName := "bldargtest" envKey := "foo" @@ -4621,7 +4621,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgEmptyValVariants(c *check.C) { buildImageSuccessfully(c, imgName, build.WithDockerfile(dockerfile)) } -func (s *DockerSuite) TestBuildBuildTimeArgDefinitionWithNoEnvInjection(c *check.C) { +func (s *DockerSuite) TestBuildBuildTimeArgDefinitionWithNoEnvInjection(c *testing.T) { imgName := "bldargtest" envKey := "foo" dockerfile := fmt.Sprintf(`FROM busybox @@ -4635,7 +4635,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgDefinitionWithNoEnvInjection(c *check } } -func (s *DockerSuite) TestBuildMultiStageArg(c *check.C) { +func (s *DockerSuite) TestBuildMultiStageArg(c *testing.T) { imgName := "multifrombldargtest" dockerfile := `FROM busybox ARG foo=abc @@ -4659,7 +4659,7 @@ func (s *DockerSuite) TestBuildMultiStageArg(c *check.C) { assert.Assert(c, result.Stdout(), checker.Contains, "bar=def") } -func (s *DockerSuite) TestBuildMultiStageGlobalArg(c *check.C) { +func (s *DockerSuite) TestBuildMultiStageGlobalArg(c *testing.T) { imgName := "multifrombldargtest" dockerfile := `ARG tag=nosuchtag FROM busybox:${tag} @@ -4684,7 +4684,7 @@ func (s *DockerSuite) TestBuildMultiStageGlobalArg(c *check.C) { assert.Assert(c, result.Stdout(), checker.Contains, "tag=latest") } -func (s *DockerSuite) TestBuildMultiStageUnusedArg(c *check.C) { +func (s *DockerSuite) TestBuildMultiStageUnusedArg(c *testing.T) { imgName := "multifromunusedarg" dockerfile := `FROM busybox ARG foo @@ -4704,7 +4704,7 @@ func (s *DockerSuite) TestBuildMultiStageUnusedArg(c *check.C) { assert.Assert(c, result.Stdout(), checker.Not(checker.Contains), "baz") } -func (s *DockerSuite) TestBuildNoNamedVolume(c *check.C) { +func (s *DockerSuite) TestBuildNoNamedVolume(c *testing.T) { volName := "testname:/foo" if testEnv.OSType == "windows" { @@ -4721,7 +4721,7 @@ func (s *DockerSuite) TestBuildNoNamedVolume(c *check.C) { }) } -func (s *DockerSuite) TestBuildTagEvent(c *check.C) { +func (s *DockerSuite) TestBuildTagEvent(c *testing.T) { since := daemonUnixTime(c) dockerFile := `FROM busybox @@ -4745,7 +4745,7 @@ func (s *DockerSuite) TestBuildTagEvent(c *check.C) { } // #15780 -func (s *DockerSuite) TestBuildMultipleTags(c *check.C) { +func (s *DockerSuite) TestBuildMultipleTags(c *testing.T) { dockerfile := ` FROM busybox MAINTAINER test-15780 @@ -4758,7 +4758,7 @@ func (s *DockerSuite) TestBuildMultipleTags(c *check.C) { } // #17290 -func (s *DockerSuite) TestBuildCacheBrokenSymlink(c *check.C) { +func (s *DockerSuite) TestBuildCacheBrokenSymlink(c *testing.T) { name := "testbuildbrokensymlink" ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(` @@ -4785,7 +4785,7 @@ func (s *DockerSuite) TestBuildCacheBrokenSymlink(c *check.C) { } } -func (s *DockerSuite) TestBuildFollowSymlinkToFile(c *check.C) { +func (s *DockerSuite) TestBuildFollowSymlinkToFile(c *testing.T) { name := "testbuildbrokensymlink" ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(` @@ -4815,7 +4815,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToFile(c *check.C) { assert.Assert(c, out, checker.Matches, "baz") } -func (s *DockerSuite) TestBuildFollowSymlinkToDir(c *check.C) { +func (s *DockerSuite) TestBuildFollowSymlinkToDir(c *testing.T) { name := "testbuildbrokensymlink" ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(` @@ -4849,7 +4849,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToDir(c *check.C) { // TestBuildSymlinkBasename tests that target file gets basename from symlink, // not from the target file. -func (s *DockerSuite) TestBuildSymlinkBasename(c *check.C) { +func (s *DockerSuite) TestBuildSymlinkBasename(c *testing.T) { name := "testbuildbrokensymlink" ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(` @@ -4870,7 +4870,7 @@ func (s *DockerSuite) TestBuildSymlinkBasename(c *check.C) { } // #17827 -func (s *DockerSuite) TestBuildCacheRootSource(c *check.C) { +func (s *DockerSuite) TestBuildCacheRootSource(c *testing.T) { name := "testbuildrootsource" ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(` @@ -4895,7 +4895,7 @@ func (s *DockerSuite) TestBuildCacheRootSource(c *check.C) { // #19375 // FIXME(vdemeester) should migrate to docker/cli tests -func (s *DockerSuite) TestBuildFailsGitNotCallable(c *check.C) { +func (s *DockerSuite) TestBuildFailsGitNotCallable(c *testing.T) { buildImage("gitnotcallable", cli.WithEnvironmentVariables("PATH="), build.WithContextPath("github.com/docker/v1.10-migrator.git")).Assert(c, icmd.Expected{ ExitCode: 1, @@ -4910,7 +4910,7 @@ func (s *DockerSuite) TestBuildFailsGitNotCallable(c *check.C) { } // TestBuildWorkdirWindowsPath tests that a Windows style path works as a workdir -func (s *DockerSuite) TestBuildWorkdirWindowsPath(c *check.C) { +func (s *DockerSuite) TestBuildWorkdirWindowsPath(c *testing.T) { testRequires(c, DaemonIsWindows) name := "testbuildworkdirwindowspath" buildImageSuccessfully(c, name, build.WithDockerfile(` @@ -4921,7 +4921,7 @@ func (s *DockerSuite) TestBuildWorkdirWindowsPath(c *check.C) { `)) } -func (s *DockerSuite) TestBuildLabel(c *check.C) { +func (s *DockerSuite) TestBuildLabel(c *testing.T) { name := "testbuildlabel" testLabel := "foo" @@ -4938,7 +4938,7 @@ func (s *DockerSuite) TestBuildLabel(c *check.C) { } } -func (s *DockerSuite) TestBuildLabelOneNode(c *check.C) { +func (s *DockerSuite) TestBuildLabelOneNode(c *testing.T) { name := "testbuildlabel" buildImageSuccessfully(c, name, cli.WithFlags("--label", "foo=bar"), build.WithDockerfile("FROM busybox")) @@ -4952,7 +4952,7 @@ func (s *DockerSuite) TestBuildLabelOneNode(c *check.C) { assert.Assert(c, v, checker.Equals, "bar") } -func (s *DockerSuite) TestBuildLabelCacheCommit(c *check.C) { +func (s *DockerSuite) TestBuildLabelCacheCommit(c *testing.T) { name := "testbuildlabelcachecommit" testLabel := "foo" @@ -4973,7 +4973,7 @@ func (s *DockerSuite) TestBuildLabelCacheCommit(c *check.C) { } } -func (s *DockerSuite) TestBuildLabelMultiple(c *check.C) { +func (s *DockerSuite) TestBuildLabelMultiple(c *testing.T) { name := "testbuildlabelmultiple" testLabels := map[string]string{ "foo": "bar", @@ -4999,7 +4999,7 @@ func (s *DockerSuite) TestBuildLabelMultiple(c *check.C) { } } -func (s *DockerRegistryAuthHtpasswdSuite) TestBuildFromAuthenticatedRegistry(c *check.C) { +func (s *DockerRegistryAuthHtpasswdSuite) TestBuildFromAuthenticatedRegistry(c *testing.T) { dockerCmd(c, "login", "-u", s.reg.Username(), "-p", s.reg.Password(), privateRegistryURL) baseImage := privateRegistryURL + "/baseimage" @@ -5017,7 +5017,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestBuildFromAuthenticatedRegistry(c * `, baseImage))) } -func (s *DockerRegistryAuthHtpasswdSuite) TestBuildWithExternalAuth(c *check.C) { +func (s *DockerRegistryAuthHtpasswdSuite) TestBuildWithExternalAuth(c *testing.T) { osPath := os.Getenv("PATH") defer os.Setenv("PATH", osPath) @@ -5059,7 +5059,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestBuildWithExternalAuth(c *check.C) } // Test cases in #22036 -func (s *DockerSuite) TestBuildLabelsOverride(c *check.C) { +func (s *DockerSuite) TestBuildLabelsOverride(c *testing.T) { // Command line option labels will always override name := "scratchy" expected := `{"bar":"from-flag","foo":"from-flag"}` @@ -5138,7 +5138,7 @@ func (s *DockerSuite) TestBuildLabelsOverride(c *check.C) { } // Test case for #22855 -func (s *DockerSuite) TestBuildDeleteCommittedFile(c *check.C) { +func (s *DockerSuite) TestBuildDeleteCommittedFile(c *testing.T) { name := "test-delete-committed-file" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox RUN echo test > file @@ -5148,7 +5148,7 @@ func (s *DockerSuite) TestBuildDeleteCommittedFile(c *check.C) { } // #20083 -func (s *DockerSuite) TestBuildDockerignoreComment(c *check.C) { +func (s *DockerSuite) TestBuildDockerignoreComment(c *testing.T) { // TODO Windows: Figure out why this test is flakey on TP5. If you add // something like RUN sleep 5, or even RUN ls /tmp after the ADD line, // it is more reliable, but that's not a good fix. @@ -5182,7 +5182,7 @@ foo2 } // Test case for #23221 -func (s *DockerSuite) TestBuildWithUTF8BOM(c *check.C) { +func (s *DockerSuite) TestBuildWithUTF8BOM(c *testing.T) { name := "test-with-utf8-bom" dockerfile := []byte(`FROM busybox`) bomDockerfile := append([]byte{0xEF, 0xBB, 0xBF}, dockerfile...) @@ -5192,7 +5192,7 @@ func (s *DockerSuite) TestBuildWithUTF8BOM(c *check.C) { } // Test case for UTF-8 BOM in .dockerignore, related to #23221 -func (s *DockerSuite) TestBuildWithUTF8BOMDockerignore(c *check.C) { +func (s *DockerSuite) TestBuildWithUTF8BOMDockerignore(c *testing.T) { name := "test-with-utf8-bom-dockerignore" dockerfile := ` FROM busybox @@ -5209,7 +5209,7 @@ func (s *DockerSuite) TestBuildWithUTF8BOMDockerignore(c *check.C) { } // #22489 Shell test to confirm config gets updated correctly -func (s *DockerSuite) TestBuildShellUpdatesConfig(c *check.C) { +func (s *DockerSuite) TestBuildShellUpdatesConfig(c *testing.T) { name := "testbuildshellupdatesconfig" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM `+minimalBaseImage()+` @@ -5226,7 +5226,7 @@ func (s *DockerSuite) TestBuildShellUpdatesConfig(c *check.C) { } // #22489 Changing the shell multiple times and CMD after. -func (s *DockerSuite) TestBuildShellMultiple(c *check.C) { +func (s *DockerSuite) TestBuildShellMultiple(c *testing.T) { name := "testbuildshellmultiple" result := buildImage(name, build.WithDockerfile(`FROM busybox @@ -5262,7 +5262,7 @@ func (s *DockerSuite) TestBuildShellMultiple(c *check.C) { } // #22489. Changed SHELL with ENTRYPOINT -func (s *DockerSuite) TestBuildShellEntrypoint(c *check.C) { +func (s *DockerSuite) TestBuildShellEntrypoint(c *testing.T) { name := "testbuildshellentrypoint" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox @@ -5277,7 +5277,7 @@ func (s *DockerSuite) TestBuildShellEntrypoint(c *check.C) { } // #22489 Shell test to confirm shell is inherited in a subsequent build -func (s *DockerSuite) TestBuildShellInherited(c *check.C) { +func (s *DockerSuite) TestBuildShellInherited(c *testing.T) { name1 := "testbuildshellinherited1" buildImageSuccessfully(c, name1, build.WithDockerfile(`FROM busybox SHELL ["ls"]`)) @@ -5290,7 +5290,7 @@ func (s *DockerSuite) TestBuildShellInherited(c *check.C) { } // #22489 Shell test to confirm non-JSON doesn't work -func (s *DockerSuite) TestBuildShellNotJSON(c *check.C) { +func (s *DockerSuite) TestBuildShellNotJSON(c *testing.T) { name := "testbuildshellnotjson" buildImage(name, build.WithDockerfile(`FROM `+minimalBaseImage()+` @@ -5303,7 +5303,7 @@ func (s *DockerSuite) TestBuildShellNotJSON(c *check.C) { // #22489 Windows shell test to confirm native is powershell if executing a PS command // This would error if the default shell were still cmd. -func (s *DockerSuite) TestBuildShellWindowsPowershell(c *check.C) { +func (s *DockerSuite) TestBuildShellWindowsPowershell(c *testing.T) { testRequires(c, DaemonIsWindows) name := "testbuildshellpowershell" buildImage(name, build.WithDockerfile(`FROM `+minimalBaseImage()+` @@ -5315,7 +5315,7 @@ func (s *DockerSuite) TestBuildShellWindowsPowershell(c *check.C) { // Verify that escape is being correctly applied to words when escape directive is not \. // Tests WORKDIR, ADD -func (s *DockerSuite) TestBuildEscapeNotBackslashWordTest(c *check.C) { +func (s *DockerSuite) TestBuildEscapeNotBackslashWordTest(c *testing.T) { testRequires(c, DaemonIsWindows) name := "testbuildescapenotbackslashwordtesta" buildImage(name, build.WithDockerfile(`# escape= `+"`"+` @@ -5338,7 +5338,7 @@ func (s *DockerSuite) TestBuildEscapeNotBackslashWordTest(c *check.C) { // #22868. Make sure shell-form CMD is not marked as escaped in the config of the image, // but an exec-form CMD is marked. -func (s *DockerSuite) TestBuildCmdShellArgsEscaped(c *check.C) { +func (s *DockerSuite) TestBuildCmdShellArgsEscaped(c *testing.T) { testRequires(c, DaemonIsWindows) name1 := "testbuildcmdshellescapedshellform" buildImageSuccessfully(c, name1, build.WithDockerfile(` @@ -5378,7 +5378,7 @@ func (s *DockerSuite) TestBuildCmdShellArgsEscaped(c *check.C) { } // Test case for #24912. -func (s *DockerSuite) TestBuildStepsWithProgress(c *check.C) { +func (s *DockerSuite) TestBuildStepsWithProgress(c *testing.T) { name := "testbuildstepswithprogress" totalRun := 5 result := buildImage(name, build.WithDockerfile("FROM busybox\n"+strings.Repeat("RUN echo foo\n", totalRun))) @@ -5389,7 +5389,7 @@ func (s *DockerSuite) TestBuildStepsWithProgress(c *check.C) { } } -func (s *DockerSuite) TestBuildWithFailure(c *check.C) { +func (s *DockerSuite) TestBuildWithFailure(c *testing.T) { name := "testbuildwithfailure" // First test case can only detect `nobody` in runtime so all steps will show up @@ -5407,7 +5407,7 @@ func (s *DockerSuite) TestBuildWithFailure(c *check.C) { assert.Assert(c, result.Stdout(), checker.Not(checker.Contains), "Step 2/2 : RUN nobody") } -func (s *DockerSuite) TestBuildCacheFromEqualDiffIDsLength(c *check.C) { +func (s *DockerSuite) TestBuildCacheFromEqualDiffIDsLength(c *testing.T) { dockerfile := ` FROM busybox RUN echo "test" @@ -5429,7 +5429,7 @@ func (s *DockerSuite) TestBuildCacheFromEqualDiffIDsLength(c *check.C) { assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 2) } -func (s *DockerSuite) TestBuildCacheFrom(c *check.C) { +func (s *DockerSuite) TestBuildCacheFrom(c *testing.T) { testRequires(c, DaemonIsLinux) // All tests that do save are skipped in windows dockerfile := ` FROM busybox @@ -5523,7 +5523,7 @@ func (s *DockerSuite) TestBuildCacheFrom(c *check.C) { assert.Assert(c, layers1[len(layers1)-1], checker.Not(checker.Equals), layers2[len(layers1)-1]) } -func (s *DockerSuite) TestBuildMultiStageCache(c *check.C) { +func (s *DockerSuite) TestBuildMultiStageCache(c *testing.T) { testRequires(c, DaemonIsLinux) // All tests that do save are skipped in windows dockerfile := ` FROM busybox @@ -5547,7 +5547,7 @@ func (s *DockerSuite) TestBuildMultiStageCache(c *check.C) { assert.Assert(c, strings.Count(result.Combined(), "Using cache"), checker.Equals, 2) } -func (s *DockerSuite) TestBuildNetNone(c *check.C) { +func (s *DockerSuite) TestBuildNetNone(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildnetnone" buildImage(name, cli.WithFlags("--network=none"), build.WithDockerfile(` @@ -5559,7 +5559,7 @@ func (s *DockerSuite) TestBuildNetNone(c *check.C) { }) } -func (s *DockerSuite) TestBuildNetContainer(c *check.C) { +func (s *DockerSuite) TestBuildNetContainer(c *testing.T) { testRequires(c, DaemonIsLinux) id, _ := dockerCmd(c, "run", "--hostname", "foobar", "-d", "busybox", "nc", "-ll", "-p", "1234", "-e", "hostname") @@ -5575,7 +5575,7 @@ func (s *DockerSuite) TestBuildNetContainer(c *check.C) { assert.Assert(c, strings.TrimSpace(host), check.Equals, "foobar") } -func (s *DockerSuite) TestBuildWithExtraHost(c *check.C) { +func (s *DockerSuite) TestBuildWithExtraHost(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildwithextrahost" @@ -5591,7 +5591,7 @@ func (s *DockerSuite) TestBuildWithExtraHost(c *check.C) { `)) } -func (s *DockerSuite) TestBuildWithExtraHostInvalidFormat(c *check.C) { +func (s *DockerSuite) TestBuildWithExtraHostInvalidFormat(c *testing.T) { testRequires(c, DaemonIsLinux) dockerfile := ` FROM busybox @@ -5618,7 +5618,7 @@ func (s *DockerSuite) TestBuildWithExtraHostInvalidFormat(c *check.C) { } -func (s *DockerSuite) TestBuildContChar(c *check.C) { +func (s *DockerSuite) TestBuildContChar(c *testing.T) { name := "testbuildcontchar" buildImage(name, build.WithDockerfile(`FROM busybox\`)).Assert(c, icmd.Expected{ @@ -5644,7 +5644,7 @@ func (s *DockerSuite) TestBuildContChar(c *check.C) { assert.Assert(c, result.Combined(), checker.Contains, "Step 2/2 : RUN echo hi \\\\\n") } -func (s *DockerSuite) TestBuildMultiStageCopyFromSyntax(c *check.C) { +func (s *DockerSuite) TestBuildMultiStageCopyFromSyntax(c *testing.T) { dockerfile := ` FROM busybox AS first COPY foo bar @@ -5702,7 +5702,7 @@ func (s *DockerSuite) TestBuildMultiStageCopyFromSyntax(c *check.C) { cli.DockerCmd(c, "run", "build4", "cat", "baz").Assert(c, icmd.Expected{Out: "pqr"}) } -func (s *DockerSuite) TestBuildMultiStageCopyFromErrors(c *check.C) { +func (s *DockerSuite) TestBuildMultiStageCopyFromErrors(c *testing.T) { testCases := []struct { dockerfile string expectedError string @@ -5749,7 +5749,7 @@ func (s *DockerSuite) TestBuildMultiStageCopyFromErrors(c *check.C) { } } -func (s *DockerSuite) TestBuildMultiStageMultipleBuilds(c *check.C) { +func (s *DockerSuite) TestBuildMultiStageMultipleBuilds(c *testing.T) { dockerfile := ` FROM busybox COPY foo bar` @@ -5782,7 +5782,7 @@ func (s *DockerSuite) TestBuildMultiStageMultipleBuilds(c *check.C) { assert.Assert(c, strings.TrimSpace(out), check.Equals, "def") } -func (s *DockerSuite) TestBuildMultiStageImplicitFrom(c *check.C) { +func (s *DockerSuite) TestBuildMultiStageImplicitFrom(c *testing.T) { dockerfile := ` FROM busybox COPY --from=busybox /etc/passwd /mypasswd @@ -5809,7 +5809,7 @@ func (s *DockerSuite) TestBuildMultiStageImplicitFrom(c *check.C) { } } -func (s *DockerRegistrySuite) TestBuildMultiStageImplicitPull(c *check.C) { +func (s *DockerRegistrySuite) TestBuildMultiStageImplicitPull(c *testing.T) { repoName := fmt.Sprintf("%v/dockercli/testf", privateRegistryURL) dockerfile := ` @@ -5839,7 +5839,7 @@ func (s *DockerRegistrySuite) TestBuildMultiStageImplicitPull(c *check.C) { cli.Docker(cli.Args("run", "build1", "cat", "baz")).Assert(c, icmd.Expected{Out: "abc"}) } -func (s *DockerSuite) TestBuildMultiStageNameVariants(c *check.C) { +func (s *DockerSuite) TestBuildMultiStageNameVariants(c *testing.T) { dockerfile := ` FROM busybox as foo COPY foo / @@ -5864,7 +5864,7 @@ func (s *DockerSuite) TestBuildMultiStageNameVariants(c *check.C) { cli.Docker(cli.Args("run", "build1", "cat", "f2")).Assert(c, icmd.Expected{Out: "bar2"}) } -func (s *DockerSuite) TestBuildMultiStageMultipleBuildsWindows(c *check.C) { +func (s *DockerSuite) TestBuildMultiStageMultipleBuildsWindows(c *testing.T) { testRequires(c, DaemonIsWindows) dockerfile := ` FROM ` + testEnv.PlatformDefaults.BaseImage + ` @@ -5898,7 +5898,7 @@ func (s *DockerSuite) TestBuildMultiStageMultipleBuildsWindows(c *check.C) { assert.Assert(c, strings.TrimSpace(out), check.Equals, "def") } -func (s *DockerSuite) TestBuildCopyFromForbidWindowsSystemPaths(c *check.C) { +func (s *DockerSuite) TestBuildCopyFromForbidWindowsSystemPaths(c *testing.T) { testRequires(c, DaemonIsWindows) dockerfile := ` FROM ` + testEnv.PlatformDefaults.BaseImage + ` @@ -5915,7 +5915,7 @@ func (s *DockerSuite) TestBuildCopyFromForbidWindowsSystemPaths(c *check.C) { buildImage("testforbidsystempaths4", build.WithDockerfile(fmt.Sprintf(dockerfile, "c:\\\\wInDows"))).Assert(c, exp) } -func (s *DockerSuite) TestBuildCopyFromForbidWindowsRelativePaths(c *check.C) { +func (s *DockerSuite) TestBuildCopyFromForbidWindowsRelativePaths(c *testing.T) { testRequires(c, DaemonIsWindows) dockerfile := ` FROM ` + testEnv.PlatformDefaults.BaseImage + ` @@ -5933,7 +5933,7 @@ func (s *DockerSuite) TestBuildCopyFromForbidWindowsRelativePaths(c *check.C) { buildImage("testforbidsystempaths5", build.WithDockerfile(fmt.Sprintf(dockerfile, "\\\\windows"))).Assert(c, exp) } -func (s *DockerSuite) TestBuildCopyFromWindowsIsCaseInsensitive(c *check.C) { +func (s *DockerSuite) TestBuildCopyFromWindowsIsCaseInsensitive(c *testing.T) { testRequires(c, DaemonIsWindows) dockerfile := ` FROM ` + testEnv.PlatformDefaults.BaseImage + ` @@ -5952,7 +5952,7 @@ func (s *DockerSuite) TestBuildCopyFromWindowsIsCaseInsensitive(c *check.C) { } // #33176 -func (s *DockerSuite) TestBuildMultiStageResetScratch(c *check.C) { +func (s *DockerSuite) TestBuildMultiStageResetScratch(c *testing.T) { testRequires(c, DaemonIsLinux) dockerfile := ` @@ -5972,7 +5972,7 @@ func (s *DockerSuite) TestBuildMultiStageResetScratch(c *check.C) { assert.Assert(c, strings.TrimSpace(res), checker.Equals, "") } -func (s *DockerSuite) TestBuildIntermediateTarget(c *check.C) { +func (s *DockerSuite) TestBuildIntermediateTarget(c *testing.T) { //todo: need to be removed after 18.06 release if strings.Contains(testEnv.DaemonInfo.ServerVersion, "18.05.0") { c.Skip(fmt.Sprintf("Bug fixed in 18.06 or higher.Skipping it for %s", testEnv.DaemonInfo.ServerVersion)) @@ -6010,7 +6010,7 @@ func (s *DockerSuite) TestBuildIntermediateTarget(c *check.C) { // TestBuildOpaqueDirectory tests that a build succeeds which // creates opaque directories. // See https://github.com/docker/docker/issues/25244 -func (s *DockerSuite) TestBuildOpaqueDirectory(c *check.C) { +func (s *DockerSuite) TestBuildOpaqueDirectory(c *testing.T) { testRequires(c, DaemonIsLinux) dockerFile := ` FROM busybox @@ -6025,7 +6025,7 @@ func (s *DockerSuite) TestBuildOpaqueDirectory(c *check.C) { } // Windows test for USER in dockerfile -func (s *DockerSuite) TestBuildWindowsUser(c *check.C) { +func (s *DockerSuite) TestBuildWindowsUser(c *testing.T) { testRequires(c, DaemonIsWindows) name := "testbuildwindowsuser" buildImage(name, build.WithDockerfile(`FROM `+testEnv.PlatformDefaults.BaseImage+` @@ -6042,7 +6042,7 @@ func (s *DockerSuite) TestBuildWindowsUser(c *check.C) { // as opposed to the file being copied as a file with the name of the // directory. Fix for 27545 (found on Windows, but regression good for Linux too). // Note 27545 was reverted in 28505, but a new fix was added subsequently in 28514. -func (s *DockerSuite) TestBuildCopyFileDotWithWorkdir(c *check.C) { +func (s *DockerSuite) TestBuildCopyFileDotWithWorkdir(c *testing.T) { name := "testbuildcopyfiledotwithworkdir" buildImageSuccessfully(c, name, build.WithBuildContext(c, build.WithFile("Dockerfile", `FROM busybox @@ -6055,7 +6055,7 @@ RUN ["cat", "/foo/file"] } // Case-insensitive environment variables on Windows -func (s *DockerSuite) TestBuildWindowsEnvCaseInsensitive(c *check.C) { +func (s *DockerSuite) TestBuildWindowsEnvCaseInsensitive(c *testing.T) { testRequires(c, DaemonIsWindows) name := "testbuildwindowsenvcaseinsensitive" buildImageSuccessfully(c, name, build.WithDockerfile(` @@ -6069,7 +6069,7 @@ func (s *DockerSuite) TestBuildWindowsEnvCaseInsensitive(c *check.C) { } // Test case for 29667 -func (s *DockerSuite) TestBuildWorkdirImageCmd(c *check.C) { +func (s *DockerSuite) TestBuildWorkdirImageCmd(c *testing.T) { image := "testworkdirimagecmd" buildImageSuccessfully(c, image, build.WithDockerfile(` FROM busybox @@ -6090,7 +6090,7 @@ LABEL a=b } // Test case for 28902/28909 -func (s *DockerSuite) TestBuildWorkdirCmd(c *check.C) { +func (s *DockerSuite) TestBuildWorkdirCmd(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildworkdircmd" dockerFile := ` @@ -6104,7 +6104,7 @@ func (s *DockerSuite) TestBuildWorkdirCmd(c *check.C) { } // FIXME(vdemeester) should be a unit test -func (s *DockerSuite) TestBuildLineErrorOnBuild(c *check.C) { +func (s *DockerSuite) TestBuildLineErrorOnBuild(c *testing.T) { name := "test_build_line_error_onbuild" buildImage(name, build.WithDockerfile(`FROM busybox ONBUILD @@ -6115,7 +6115,7 @@ func (s *DockerSuite) TestBuildLineErrorOnBuild(c *check.C) { } // FIXME(vdemeester) should be a unit test -func (s *DockerSuite) TestBuildLineErrorUnknownInstruction(c *check.C) { +func (s *DockerSuite) TestBuildLineErrorUnknownInstruction(c *testing.T) { name := "test_build_line_error_unknown_instruction" cli.Docker(cli.Build(name), build.WithDockerfile(`FROM busybox RUN echo hello world @@ -6129,7 +6129,7 @@ func (s *DockerSuite) TestBuildLineErrorUnknownInstruction(c *check.C) { } // FIXME(vdemeester) should be a unit test -func (s *DockerSuite) TestBuildLineErrorWithEmptyLines(c *check.C) { +func (s *DockerSuite) TestBuildLineErrorWithEmptyLines(c *testing.T) { name := "test_build_line_error_with_empty_lines" cli.Docker(cli.Build(name), build.WithDockerfile(` FROM busybox @@ -6146,7 +6146,7 @@ func (s *DockerSuite) TestBuildLineErrorWithEmptyLines(c *check.C) { } // FIXME(vdemeester) should be a unit test -func (s *DockerSuite) TestBuildLineErrorWithComments(c *check.C) { +func (s *DockerSuite) TestBuildLineErrorWithComments(c *testing.T) { name := "test_build_line_error_with_comments" cli.Docker(cli.Build(name), build.WithDockerfile(`FROM busybox # This will print hello world @@ -6160,7 +6160,7 @@ func (s *DockerSuite) TestBuildLineErrorWithComments(c *check.C) { } // #31957 -func (s *DockerSuite) TestBuildSetCommandWithDefinedShell(c *check.C) { +func (s *DockerSuite) TestBuildSetCommandWithDefinedShell(c *testing.T) { buildImageSuccessfully(c, "build1", build.WithDockerfile(` FROM busybox SHELL ["/bin/sh", "-c"] @@ -6179,7 +6179,7 @@ CMD echo foo } // FIXME(vdemeester) should migrate to docker/cli tests -func (s *DockerSuite) TestBuildIidFile(c *check.C) { +func (s *DockerSuite) TestBuildIidFile(c *testing.T) { tmpDir, err := ioutil.TempDir("", "TestBuildIidFile") if err != nil { c.Fatal(err) @@ -6204,7 +6204,7 @@ ENV BAR BAZ`), } // FIXME(vdemeester) should migrate to docker/cli tests -func (s *DockerSuite) TestBuildIidFileCleanupOnFail(c *check.C) { +func (s *DockerSuite) TestBuildIidFileCleanupOnFail(c *testing.T) { tmpDir, err := ioutil.TempDir("", "TestBuildIidFileCleanupOnFail") if err != nil { c.Fatal(err) diff --git a/integration-cli/docker_cli_build_unix_test.go b/integration-cli/docker_cli_build_unix_test.go index 65e6435b21..7cb6819be4 100644 --- a/integration-cli/docker_cli_build_unix_test.go +++ b/integration-cli/docker_cli_build_unix_test.go @@ -25,7 +25,7 @@ import ( "gotest.tools/icmd" ) -func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) { +func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *testing.T) { testRequires(c, cpuCfsQuota) name := "testbuildresourceconstraints" buildLabel := "DockerSuite.TestBuildResourceConstraintsAreUsed" @@ -85,7 +85,7 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) { assert.Assert(c, c2.Ulimits, checker.IsNil, check.Commentf("resource leaked from build for Ulimits")) } -func (s *DockerSuite) TestBuildAddChangeOwnership(c *check.C) { +func (s *DockerSuite) TestBuildAddChangeOwnership(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testbuildaddown" @@ -131,7 +131,7 @@ func (s *DockerSuite) TestBuildAddChangeOwnership(c *check.C) { // TODO(buildkit): this test needs to be rewritten for buildkit. // It has been manually tested positive. Confirmed issue: docker build output parsing. // Potential issue: newEventObserver uses docker events, which is not hooked up to buildkit. -func (s *DockerSuite) TestBuildCancellationKillsSleep(c *check.C) { +func (s *DockerSuite) TestBuildCancellationKillsSleep(c *testing.T) { testRequires(c, DaemonIsLinux, TODOBuildkit) name := "testbuildcancellation" diff --git a/integration-cli/docker_cli_by_digest_test.go b/integration-cli/docker_cli_by_digest_test.go index 6bcdc1c9d5..e2b32a703e 100644 --- a/integration-cli/docker_cli_by_digest_test.go +++ b/integration-cli/docker_cli_by_digest_test.go @@ -27,11 +27,11 @@ var ( digestRegex = regexp.MustCompile("Digest: ([\\S]+)") ) -func setupImage(c *check.C) (digest.Digest, error) { +func setupImage(c *testing.T) (digest.Digest, error) { return setupImageWithTag(c, "latest") } -func setupImageWithTag(c *check.C, tag string) (digest.Digest, error) { +func setupImageWithTag(c *testing.T, tag string) (digest.Digest, error) { containerName := "busyboxbydigest" // new file is committed because this layer is used for detecting malicious @@ -59,7 +59,7 @@ func setupImageWithTag(c *check.C, tag string) (digest.Digest, error) { return digest.Digest(pushDigest), nil } -func testPullByTagDisplaysDigest(c *check.C) { +func testPullByTagDisplaysDigest(c *testing.T) { testRequires(c, DaemonIsLinux) pushDigest, err := setupImage(c) assert.NilError(c, err, "error setting up image") @@ -76,15 +76,15 @@ func testPullByTagDisplaysDigest(c *check.C) { assert.Assert(c, pushDigest.String(), checker.Equals, pullDigest) } -func (s *DockerRegistrySuite) TestPullByTagDisplaysDigest(c *check.C) { +func (s *DockerRegistrySuite) TestPullByTagDisplaysDigest(c *testing.T) { testPullByTagDisplaysDigest(c) } -func (s *DockerSchema1RegistrySuite) TestPullByTagDisplaysDigest(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPullByTagDisplaysDigest(c *testing.T) { testPullByTagDisplaysDigest(c) } -func testPullByDigest(c *check.C) { +func testPullByDigest(c *testing.T) { testRequires(c, DaemonIsLinux) pushDigest, err := setupImage(c) assert.NilError(c, err, "error setting up image") @@ -102,15 +102,15 @@ func testPullByDigest(c *check.C) { assert.Assert(c, pushDigest.String(), checker.Equals, pullDigest) } -func (s *DockerRegistrySuite) TestPullByDigest(c *check.C) { +func (s *DockerRegistrySuite) TestPullByDigest(c *testing.T) { testPullByDigest(c) } -func (s *DockerSchema1RegistrySuite) TestPullByDigest(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPullByDigest(c *testing.T) { testPullByDigest(c) } -func testPullByDigestNoFallback(c *check.C) { +func testPullByDigestNoFallback(c *testing.T) { testRequires(c, DaemonIsLinux) // pull from the registry using the @ reference imageReference := fmt.Sprintf("%s@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", repoName) @@ -119,15 +119,15 @@ func testPullByDigestNoFallback(c *check.C) { assert.Assert(c, out, checker.Contains, fmt.Sprintf("manifest for %s not found", imageReference), check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image")) } -func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *check.C) { +func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *testing.T) { testPullByDigestNoFallback(c) } -func (s *DockerSchema1RegistrySuite) TestPullByDigestNoFallback(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPullByDigestNoFallback(c *testing.T) { testPullByDigestNoFallback(c) } -func (s *DockerRegistrySuite) TestCreateByDigest(c *check.C) { +func (s *DockerRegistrySuite) TestCreateByDigest(c *testing.T) { pushDigest, err := setupImage(c) assert.NilError(c, err, "error setting up image") @@ -140,7 +140,7 @@ func (s *DockerRegistrySuite) TestCreateByDigest(c *check.C) { assert.Equal(c, res, imageReference) } -func (s *DockerRegistrySuite) TestRunByDigest(c *check.C) { +func (s *DockerRegistrySuite) TestRunByDigest(c *testing.T) { pushDigest, err := setupImage(c) assert.NilError(c, err) @@ -158,7 +158,7 @@ func (s *DockerRegistrySuite) TestRunByDigest(c *check.C) { assert.Equal(c, res, imageReference) } -func (s *DockerRegistrySuite) TestRemoveImageByDigest(c *check.C) { +func (s *DockerRegistrySuite) TestRemoveImageByDigest(c *testing.T) { digest, err := setupImage(c) assert.NilError(c, err, "error setting up image") @@ -180,7 +180,7 @@ func (s *DockerRegistrySuite) TestRemoveImageByDigest(c *check.C) { assert.ErrorContains(c, err, "No such object") } -func (s *DockerRegistrySuite) TestBuildByDigest(c *check.C) { +func (s *DockerRegistrySuite) TestBuildByDigest(c *testing.T) { digest, err := setupImage(c) assert.NilError(c, err, "error setting up image") @@ -205,7 +205,7 @@ func (s *DockerRegistrySuite) TestBuildByDigest(c *check.C) { assert.Equal(c, res, imageID) } -func (s *DockerRegistrySuite) TestTagByDigest(c *check.C) { +func (s *DockerRegistrySuite) TestTagByDigest(c *testing.T) { digest, err := setupImage(c) assert.NilError(c, err, "error setting up image") @@ -224,7 +224,7 @@ func (s *DockerRegistrySuite) TestTagByDigest(c *check.C) { assert.Equal(c, tagID, expectedID) } -func (s *DockerRegistrySuite) TestListImagesWithoutDigests(c *check.C) { +func (s *DockerRegistrySuite) TestListImagesWithoutDigests(c *testing.T) { digest, err := setupImage(c) assert.NilError(c, err, "error setting up image") @@ -237,7 +237,7 @@ func (s *DockerRegistrySuite) TestListImagesWithoutDigests(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), "DIGEST", check.Commentf("list output should not have contained DIGEST header")) } -func (s *DockerRegistrySuite) TestListImagesWithDigests(c *check.C) { +func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) { // setup image1 digest1, err := setupImageWithTag(c, "tag1") @@ -314,7 +314,7 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *check.C) { assert.Assert(c, busyboxRe.MatchString(out), checker.True, check.Commentf("expected %q: %s", busyboxRe.String(), out)) } -func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *check.C) { +func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) { // setup image1 digest1, err := setupImageWithTag(c, "dangle1") assert.NilError(c, err, "error setting up image") @@ -387,7 +387,7 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *check.C) { assert.Assert(c, reWithDigest2.MatchString(out), checker.False, check.Commentf("unexpected %q: %s", reWithDigest2.String(), out)) } -func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *check.C) { +func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *testing.T) { digest, err := setupImage(c) assert.Assert(c, err, check.IsNil, check.Commentf("error setting up image")) @@ -406,7 +406,7 @@ func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *check.C) { assert.Check(c, is.Contains(imageJSON[0].RepoDigests, imageReference)) } -func (s *DockerRegistrySuite) TestPsListContainersFilterAncestorImageByDigest(c *check.C) { +func (s *DockerRegistrySuite) TestPsListContainersFilterAncestorImageByDigest(c *testing.T) { existingContainers := ExistingContainerIDs(c) digest, err := setupImage(c) @@ -442,7 +442,7 @@ func (s *DockerRegistrySuite) TestPsListContainersFilterAncestorImageByDigest(c checkPsAncestorFilterOutput(c, RemoveOutputForExistingElements(out, existingContainers), imageReference, expectedIDs) } -func (s *DockerRegistrySuite) TestDeleteImageByIDOnlyPulledByDigest(c *check.C) { +func (s *DockerRegistrySuite) TestDeleteImageByIDOnlyPulledByDigest(c *testing.T) { pushDigest, err := setupImage(c) assert.NilError(c, err, "error setting up image") @@ -461,7 +461,7 @@ func (s *DockerRegistrySuite) TestDeleteImageByIDOnlyPulledByDigest(c *check.C) assert.ErrorContains(c, err, "", "image should have been deleted") } -func (s *DockerRegistrySuite) TestDeleteImageWithDigestAndTag(c *check.C) { +func (s *DockerRegistrySuite) TestDeleteImageWithDigestAndTag(c *testing.T) { pushDigest, err := setupImage(c) assert.NilError(c, err, "error setting up image") @@ -488,7 +488,7 @@ func (s *DockerRegistrySuite) TestDeleteImageWithDigestAndTag(c *check.C) { assert.ErrorContains(c, err, "", "image should have been deleted") } -func (s *DockerRegistrySuite) TestDeleteImageWithDigestAndMultiRepoTag(c *check.C) { +func (s *DockerRegistrySuite) TestDeleteImageWithDigestAndMultiRepoTag(c *testing.T) { pushDigest, err := setupImage(c) assert.NilError(c, err, "error setting up image") @@ -525,7 +525,7 @@ func (s *DockerRegistrySuite) TestDeleteImageWithDigestAndMultiRepoTag(c *check. // TestPullFailsWithAlteredManifest tests that a `docker pull` fails when // we have modified a manifest blob and its digest cannot be verified. // This is the schema2 version of the test. -func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) { +func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *testing.T) { testRequires(c, DaemonIsLinux) manifestDigest, err := setupImage(c) assert.NilError(c, err, "error setting up image") @@ -565,7 +565,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) { // TestPullFailsWithAlteredManifest tests that a `docker pull` fails when // we have modified a manifest blob and its digest cannot be verified. // This is the schema1 version of the test. -func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *testing.T) { testRequires(c, DaemonIsLinux) manifestDigest, err := setupImage(c) assert.Assert(c, err, checker.IsNil, check.Commentf("error setting up image")) @@ -607,7 +607,7 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *check.C // TestPullFailsWithAlteredLayer tests that a `docker pull` fails when // we have modified a layer blob and its digest cannot be verified. // This is the schema2 version of the test. -func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) { +func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) { testRequires(c, DaemonIsLinux) manifestDigest, err := setupImage(c) assert.Assert(c, err, checker.IsNil) @@ -650,7 +650,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) { // TestPullFailsWithAlteredLayer tests that a `docker pull` fails when // we have modified a layer blob and its digest cannot be verified. // This is the schema1 version of the test. -func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) { testRequires(c, DaemonIsLinux) manifestDigest, err := setupImage(c) assert.Assert(c, err, checker.IsNil) diff --git a/integration-cli/docker_cli_commit_test.go b/integration-cli/docker_cli_commit_test.go index cbd69c478f..9c2bc5092a 100644 --- a/integration-cli/docker_cli_commit_test.go +++ b/integration-cli/docker_cli_commit_test.go @@ -9,7 +9,7 @@ import ( "github.com/go-check/check" ) -func (s *DockerSuite) TestCommitAfterContainerIsDone(c *check.C) { +func (s *DockerSuite) TestCommitAfterContainerIsDone(c *testing.T) { out := cli.DockerCmd(c, "run", "-i", "-a", "stdin", "busybox", "echo", "foo").Combined() cleanedContainerID := strings.TrimSpace(out) @@ -23,7 +23,7 @@ func (s *DockerSuite) TestCommitAfterContainerIsDone(c *check.C) { cli.DockerCmd(c, "inspect", cleanedImageID) } -func (s *DockerSuite) TestCommitWithoutPause(c *check.C) { +func (s *DockerSuite) TestCommitWithoutPause(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-i", "-a", "stdin", "busybox", "echo", "foo") @@ -39,7 +39,7 @@ func (s *DockerSuite) TestCommitWithoutPause(c *check.C) { } //test commit a paused container should not unpause it after commit -func (s *DockerSuite) TestCommitPausedContainer(c *check.C) { +func (s *DockerSuite) TestCommitPausedContainer(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-i", "-d", "busybox") @@ -53,7 +53,7 @@ func (s *DockerSuite) TestCommitPausedContainer(c *check.C) { assert.Assert(c, out, checker.Contains, "true") } -func (s *DockerSuite) TestCommitNewFile(c *check.C) { +func (s *DockerSuite) TestCommitNewFile(c *testing.T) { dockerCmd(c, "run", "--name", "committer", "busybox", "/bin/sh", "-c", "echo koye > /foo") imageID, _ := dockerCmd(c, "commit", "committer") @@ -64,7 +64,7 @@ func (s *DockerSuite) TestCommitNewFile(c *check.C) { assert.Assert(c, actual, checker.Equals, "koye") } -func (s *DockerSuite) TestCommitHardlink(c *check.C) { +func (s *DockerSuite) TestCommitHardlink(c *testing.T) { testRequires(c, DaemonIsLinux) firstOutput, _ := dockerCmd(c, "run", "-t", "--name", "hardlinks", "busybox", "sh", "-c", "touch file1 && ln file1 file2 && ls -di file1 file2") @@ -84,7 +84,7 @@ func (s *DockerSuite) TestCommitHardlink(c *check.C) { assert.Assert(c, chunks[1], checker.Contains, chunks[0], check.Commentf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:])) } -func (s *DockerSuite) TestCommitTTY(c *check.C) { +func (s *DockerSuite) TestCommitTTY(c *testing.T) { dockerCmd(c, "run", "-t", "--name", "tty", "busybox", "/bin/ls") imageID, _ := dockerCmd(c, "commit", "tty", "ttytest") @@ -93,7 +93,7 @@ func (s *DockerSuite) TestCommitTTY(c *check.C) { dockerCmd(c, "run", imageID, "/bin/ls") } -func (s *DockerSuite) TestCommitWithHostBindMount(c *check.C) { +func (s *DockerSuite) TestCommitWithHostBindMount(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "--name", "bind-commit", "-v", "/dev/null:/winning", "busybox", "true") @@ -103,7 +103,7 @@ func (s *DockerSuite) TestCommitWithHostBindMount(c *check.C) { dockerCmd(c, "run", imageID, "true") } -func (s *DockerSuite) TestCommitChange(c *check.C) { +func (s *DockerSuite) TestCommitChange(c *testing.T) { dockerCmd(c, "run", "--name", "test", "busybox", "true") imageID, _ := dockerCmd(c, "commit", @@ -153,7 +153,7 @@ func (s *DockerSuite) TestCommitChange(c *check.C) { } } -func (s *DockerSuite) TestCommitChangeLabels(c *check.C) { +func (s *DockerSuite) TestCommitChangeLabels(c *testing.T) { dockerCmd(c, "run", "--name", "test", "--label", "some=label", "busybox", "true") imageID, _ := dockerCmd(c, "commit", diff --git a/integration-cli/docker_cli_cp_from_container_test.go b/integration-cli/docker_cli_cp_from_container_test.go index d841a9a4a8..2405c50b29 100644 --- a/integration-cli/docker_cli_cp_from_container_test.go +++ b/integration-cli/docker_cli_cp_from_container_test.go @@ -22,7 +22,7 @@ import ( // Check that copying from a container to a local symlink copies to the symlink // target and does not overwrite the local symlink itself. // TODO: move to docker/cli and/or integration/container/copy_test.go -func (s *DockerSuite) TestCpFromSymlinkDestination(c *check.C) { +func (s *DockerSuite) TestCpFromSymlinkDestination(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{addContent: true}) @@ -117,7 +117,7 @@ func (s *DockerSuite) TestCpFromSymlinkDestination(c *check.C) { // A. SRC specifies a file and DST (no trailing path separator) doesn't // exist. This should create a file with the name DST and copy the // contents of the source file into it. -func (s *DockerSuite) TestCpFromCaseA(c *check.C) { +func (s *DockerSuite) TestCpFromCaseA(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{ addContent: true, workDir: "/root", @@ -137,7 +137,7 @@ func (s *DockerSuite) TestCpFromCaseA(c *check.C) { // B. SRC specifies a file and DST (with trailing path separator) doesn't // exist. This should cause an error because the copy operation cannot // create a directory when copying a single file. -func (s *DockerSuite) TestCpFromCaseB(c *check.C) { +func (s *DockerSuite) TestCpFromCaseB(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{addContent: true}) @@ -155,7 +155,7 @@ func (s *DockerSuite) TestCpFromCaseB(c *check.C) { // C. SRC specifies a file and DST exists as a file. This should overwrite // the file at DST with the contents of the source file. -func (s *DockerSuite) TestCpFromCaseC(c *check.C) { +func (s *DockerSuite) TestCpFromCaseC(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{ addContent: true, workDir: "/root", @@ -180,7 +180,7 @@ func (s *DockerSuite) TestCpFromCaseC(c *check.C) { // D. SRC specifies a file and DST exists as a directory. This should place // a copy of the source file inside it using the basename from SRC. Ensure // this works whether DST has a trailing path separator or not. -func (s *DockerSuite) TestCpFromCaseD(c *check.C) { +func (s *DockerSuite) TestCpFromCaseD(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{addContent: true}) @@ -220,7 +220,7 @@ func (s *DockerSuite) TestCpFromCaseD(c *check.C) { // directory at DST and copy the contents of the SRC directory into the DST // directory. Ensure this works whether DST has a trailing path separator or // not. -func (s *DockerSuite) TestCpFromCaseE(c *check.C) { +func (s *DockerSuite) TestCpFromCaseE(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{addContent: true}) @@ -249,7 +249,7 @@ func (s *DockerSuite) TestCpFromCaseE(c *check.C) { // F. SRC specifies a directory and DST exists as a file. This should cause an // error as it is not possible to overwrite a file with a directory. -func (s *DockerSuite) TestCpFromCaseF(c *check.C) { +func (s *DockerSuite) TestCpFromCaseF(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{ addContent: true, workDir: "/root", @@ -272,7 +272,7 @@ func (s *DockerSuite) TestCpFromCaseF(c *check.C) { // G. SRC specifies a directory and DST exists as a directory. This should copy // the SRC directory and all its contents to the DST directory. Ensure this // works whether DST has a trailing path separator or not. -func (s *DockerSuite) TestCpFromCaseG(c *check.C) { +func (s *DockerSuite) TestCpFromCaseG(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{ addContent: true, workDir: "/root", @@ -311,7 +311,7 @@ func (s *DockerSuite) TestCpFromCaseG(c *check.C) { // should create a directory at DST and copy the contents of the SRC // directory (but not the directory itself) into the DST directory. Ensure // this works whether DST has a trailing path separator or not. -func (s *DockerSuite) TestCpFromCaseH(c *check.C) { +func (s *DockerSuite) TestCpFromCaseH(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{addContent: true}) @@ -341,7 +341,7 @@ func (s *DockerSuite) TestCpFromCaseH(c *check.C) { // I. SRC specifies a directory's contents only and DST exists as a file. This // should cause an error as it is not possible to overwrite a file with a // directory. -func (s *DockerSuite) TestCpFromCaseI(c *check.C) { +func (s *DockerSuite) TestCpFromCaseI(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{ addContent: true, workDir: "/root", @@ -365,7 +365,7 @@ func (s *DockerSuite) TestCpFromCaseI(c *check.C) { // This should copy the contents of the SRC directory (but not the directory // itself) into the DST directory. Ensure this works whether DST has a // trailing path separator or not. -func (s *DockerSuite) TestCpFromCaseJ(c *check.C) { +func (s *DockerSuite) TestCpFromCaseJ(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{ addContent: true, workDir: "/root", diff --git a/integration-cli/docker_cli_cp_test.go b/integration-cli/docker_cli_cp_test.go index 9e84ee2698..d3bc81a80e 100644 --- a/integration-cli/docker_cli_cp_test.go +++ b/integration-cli/docker_cli_cp_test.go @@ -27,14 +27,14 @@ const ( ) // Ensure that an all-local path case returns an error. -func (s *DockerSuite) TestCpLocalOnly(c *check.C) { +func (s *DockerSuite) TestCpLocalOnly(c *testing.T) { err := runDockerCp(c, "foo", "bar", nil) assert.ErrorContains(c, err, "must specify at least one container source") } // Test for #5656 // Check that garbage paths don't escape the container's rootfs -func (s *DockerSuite) TestCpGarbagePath(c *check.C) { +func (s *DockerSuite) TestCpGarbagePath(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) containerID := strings.TrimSpace(out) @@ -70,7 +70,7 @@ func (s *DockerSuite) TestCpGarbagePath(c *check.C) { } // Check that relative paths are relative to the container's rootfs -func (s *DockerSuite) TestCpRelativePath(c *check.C) { +func (s *DockerSuite) TestCpRelativePath(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) containerID := strings.TrimSpace(out) @@ -112,7 +112,7 @@ func (s *DockerSuite) TestCpRelativePath(c *check.C) { } // Check that absolute paths are relative to the container's rootfs -func (s *DockerSuite) TestCpAbsolutePath(c *check.C) { +func (s *DockerSuite) TestCpAbsolutePath(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) containerID := strings.TrimSpace(out) @@ -149,7 +149,7 @@ func (s *DockerSuite) TestCpAbsolutePath(c *check.C) { // Test for #5619 // Check that absolute symlinks are still relative to the container's rootfs -func (s *DockerSuite) TestCpAbsoluteSymlink(c *check.C) { +func (s *DockerSuite) TestCpAbsoluteSymlink(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpFullPath+" container_path") @@ -185,7 +185,7 @@ func (s *DockerSuite) TestCpAbsoluteSymlink(c *check.C) { // Check that symlinks to a directory behave as expected when copying one from // a container. -func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *check.C) { +func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPathParent+" /dir_link") @@ -231,7 +231,7 @@ func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *check.C) { // Check that symlinks to a directory behave as expected when copying one to a // container. -func (s *DockerSuite) TestCpToSymlinkToDirectory(c *check.C) { +func (s *DockerSuite) TestCpToSymlinkToDirectory(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, testEnv.IsLocalDaemon) // Requires local volume mount bind. @@ -308,7 +308,7 @@ func (s *DockerSuite) TestCpToSymlinkToDirectory(c *check.C) { // Test for #5619 // Check that symlinks which are part of the resource path are still relative to the container's rootfs -func (s *DockerSuite) TestCpSymlinkComponent(c *check.C) { +func (s *DockerSuite) TestCpSymlinkComponent(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPath+" container_path") @@ -347,7 +347,7 @@ func (s *DockerSuite) TestCpSymlinkComponent(c *check.C) { } // Check that cp with unprivileged user doesn't return any error -func (s *DockerSuite) TestCpUnprivilegedUser(c *check.C) { +func (s *DockerSuite) TestCpUnprivilegedUser(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) testRequires(c, UnixCli) // uses chmod/su: not available on windows @@ -371,7 +371,7 @@ func (s *DockerSuite) TestCpUnprivilegedUser(c *check.C) { result.Assert(c, icmd.Expected{}) } -func (s *DockerSuite) TestCpSpecialFiles(c *check.C) { +func (s *DockerSuite) TestCpSpecialFiles(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, testEnv.IsLocalDaemon) @@ -411,7 +411,7 @@ func (s *DockerSuite) TestCpSpecialFiles(c *check.C) { assert.Assert(c, bytes.Equal(actual, expected), "Expected copied file to be duplicate of the container hostname") } -func (s *DockerSuite) TestCpVolumePath(c *check.C) { +func (s *DockerSuite) TestCpVolumePath(c *testing.T) { // stat /tmp/cp-test-volumepath851508420/test gets permission denied for the user testRequires(c, NotUserNamespace) testRequires(c, DaemonIsLinux) @@ -474,7 +474,7 @@ func (s *DockerSuite) TestCpVolumePath(c *check.C) { assert.Assert(c, bytes.Equal(fb, fb2), "Expected copied file to be duplicate of bind-mounted file") } -func (s *DockerSuite) TestCpToDot(c *check.C) { +func (s *DockerSuite) TestCpToDot(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test") containerID := strings.TrimSpace(out) @@ -497,7 +497,7 @@ func (s *DockerSuite) TestCpToDot(c *check.C) { assert.Equal(c, string(content), "lololol\n") } -func (s *DockerSuite) TestCpToStdout(c *check.C) { +func (s *DockerSuite) TestCpToStdout(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test") containerID := strings.TrimSpace(out) @@ -514,7 +514,7 @@ func (s *DockerSuite) TestCpToStdout(c *check.C) { assert.Check(c, is.Contains(out, "-rw")) } -func (s *DockerSuite) TestCpNameHasColon(c *check.C) { +func (s *DockerSuite) TestCpNameHasColon(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /te:s:t") @@ -533,7 +533,7 @@ func (s *DockerSuite) TestCpNameHasColon(c *check.C) { assert.Equal(c, string(content), "lololol\n") } -func (s *DockerSuite) TestCopyAndRestart(c *check.C) { +func (s *DockerSuite) TestCopyAndRestart(c *testing.T) { testRequires(c, DaemonIsLinux) expectedMsg := "hello" out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", expectedMsg) @@ -552,7 +552,7 @@ func (s *DockerSuite) TestCopyAndRestart(c *check.C) { assert.Equal(c, strings.TrimSpace(out), expectedMsg) } -func (s *DockerSuite) TestCopyCreatedContainer(c *check.C) { +func (s *DockerSuite) TestCopyCreatedContainer(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "create", "--name", "test_cp", "-v", "/test", "busybox") @@ -565,7 +565,7 @@ func (s *DockerSuite) TestCopyCreatedContainer(c *check.C) { // test copy with option `-L`: following symbol link // Check that symlinks to a file behave as expected when copying one from // a container to host following symbol link -func (s *DockerSuite) TestCpSymlinkFromConToHostFollowSymlink(c *check.C) { +func (s *DockerSuite) TestCpSymlinkFromConToHostFollowSymlink(c *testing.T) { testRequires(c, DaemonIsLinux) out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpFullPath+" /dir_link") assert.Equal(c, exitCode, 0, "failed to set up container: %s", out) diff --git a/integration-cli/docker_cli_cp_to_container_test.go b/integration-cli/docker_cli_cp_to_container_test.go index 2cfb73c697..923c03c8e8 100644 --- a/integration-cli/docker_cli_cp_to_container_test.go +++ b/integration-cli/docker_cli_cp_to_container_test.go @@ -20,7 +20,7 @@ import ( // Check that copying from a local path to a symlink in a container copies to // the symlink target and does not overwrite the container symlink itself. -func (s *DockerSuite) TestCpToSymlinkDestination(c *check.C) { +func (s *DockerSuite) TestCpToSymlinkDestination(c *testing.T) { // stat /tmp/test-cp-to-symlink-destination-262430901/vol3 gets permission denied for the user testRequires(c, NotUserNamespace) testRequires(c, DaemonIsLinux) @@ -121,7 +121,7 @@ func (s *DockerSuite) TestCpToSymlinkDestination(c *check.C) { // A. SRC specifies a file and DST (no trailing path separator) doesn't // exist. This should create a file with the name DST and copy the // contents of the source file into it. -func (s *DockerSuite) TestCpToCaseA(c *check.C) { +func (s *DockerSuite) TestCpToCaseA(c *testing.T) { containerID := makeTestContainer(c, testContainerOptions{ workDir: "/root", command: makeCatFileCommand("itWorks.txt"), }) @@ -142,7 +142,7 @@ func (s *DockerSuite) TestCpToCaseA(c *check.C) { // B. SRC specifies a file and DST (with trailing path separator) doesn't // exist. This should cause an error because the copy operation cannot // create a directory when copying a single file. -func (s *DockerSuite) TestCpToCaseB(c *check.C) { +func (s *DockerSuite) TestCpToCaseB(c *testing.T) { containerID := makeTestContainer(c, testContainerOptions{ command: makeCatFileCommand("testDir/file1"), }) @@ -163,7 +163,7 @@ func (s *DockerSuite) TestCpToCaseB(c *check.C) { // C. SRC specifies a file and DST exists as a file. This should overwrite // the file at DST with the contents of the source file. -func (s *DockerSuite) TestCpToCaseC(c *check.C) { +func (s *DockerSuite) TestCpToCaseC(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{ addContent: true, workDir: "/root", @@ -190,7 +190,7 @@ func (s *DockerSuite) TestCpToCaseC(c *check.C) { // D. SRC specifies a file and DST exists as a directory. This should place // a copy of the source file inside it using the basename from SRC. Ensure // this works whether DST has a trailing path separator or not. -func (s *DockerSuite) TestCpToCaseD(c *check.C) { +func (s *DockerSuite) TestCpToCaseD(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{ addContent: true, @@ -236,7 +236,7 @@ func (s *DockerSuite) TestCpToCaseD(c *check.C) { // directory at DST and copy the contents of the SRC directory into the DST // directory. Ensure this works whether DST has a trailing path separator or // not. -func (s *DockerSuite) TestCpToCaseE(c *check.C) { +func (s *DockerSuite) TestCpToCaseE(c *testing.T) { containerID := makeTestContainer(c, testContainerOptions{ command: makeCatFileCommand("/testDir/file1-1"), }) @@ -271,7 +271,7 @@ func (s *DockerSuite) TestCpToCaseE(c *check.C) { // F. SRC specifies a directory and DST exists as a file. This should cause an // error as it is not possible to overwrite a file with a directory. -func (s *DockerSuite) TestCpToCaseF(c *check.C) { +func (s *DockerSuite) TestCpToCaseF(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{ addContent: true, workDir: "/root", @@ -294,7 +294,7 @@ func (s *DockerSuite) TestCpToCaseF(c *check.C) { // G. SRC specifies a directory and DST exists as a directory. This should copy // the SRC directory and all its contents to the DST directory. Ensure this // works whether DST has a trailing path separator or not. -func (s *DockerSuite) TestCpToCaseG(c *check.C) { +func (s *DockerSuite) TestCpToCaseG(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{ addContent: true, workDir: "/root", @@ -340,7 +340,7 @@ func (s *DockerSuite) TestCpToCaseG(c *check.C) { // should create a directory at DST and copy the contents of the SRC // directory (but not the directory itself) into the DST directory. Ensure // this works whether DST has a trailing path separator or not. -func (s *DockerSuite) TestCpToCaseH(c *check.C) { +func (s *DockerSuite) TestCpToCaseH(c *testing.T) { containerID := makeTestContainer(c, testContainerOptions{ command: makeCatFileCommand("/testDir/file1-1"), }) @@ -376,7 +376,7 @@ func (s *DockerSuite) TestCpToCaseH(c *check.C) { // I. SRC specifies a directory's contents only and DST exists as a file. This // should cause an error as it is not possible to overwrite a file with a // directory. -func (s *DockerSuite) TestCpToCaseI(c *check.C) { +func (s *DockerSuite) TestCpToCaseI(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{ addContent: true, workDir: "/root", @@ -400,7 +400,7 @@ func (s *DockerSuite) TestCpToCaseI(c *check.C) { // This should copy the contents of the SRC directory (but not the directory // itself) into the DST directory. Ensure this works whether DST has a // trailing path separator or not. -func (s *DockerSuite) TestCpToCaseJ(c *check.C) { +func (s *DockerSuite) TestCpToCaseJ(c *testing.T) { testRequires(c, DaemonIsLinux) containerID := makeTestContainer(c, testContainerOptions{ addContent: true, workDir: "/root", @@ -443,7 +443,7 @@ func (s *DockerSuite) TestCpToCaseJ(c *check.C) { // The `docker cp` command should also ensure that you cannot // write to a container rootfs that is marked as read-only. -func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *check.C) { +func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *testing.T) { // --read-only + userns has remount issues testRequires(c, DaemonIsLinux, NotUserNamespace) tmpDir := getTestDir(c, "test-cp-to-err-read-only-rootfs") @@ -470,7 +470,7 @@ func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *check.C) { // The `docker cp` command should also ensure that you // cannot write to a volume that is mounted as read-only. -func (s *DockerSuite) TestCpToErrReadOnlyVolume(c *check.C) { +func (s *DockerSuite) TestCpToErrReadOnlyVolume(c *testing.T) { // --read-only + userns has remount issues testRequires(c, DaemonIsLinux, NotUserNamespace) tmpDir := getTestDir(c, "test-cp-to-err-read-only-volume") diff --git a/integration-cli/docker_cli_cp_to_container_unix_test.go b/integration-cli/docker_cli_cp_to_container_unix_test.go index bbf0040f12..6490c75126 100644 --- a/integration-cli/docker_cli_cp_to_container_unix_test.go +++ b/integration-cli/docker_cli_cp_to_container_unix_test.go @@ -14,7 +14,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSuite) TestCpToContainerWithPermissions(c *check.C) { +func (s *DockerSuite) TestCpToContainerWithPermissions(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) tmpDir := getTestDir(c, "test-cp-to-host-with-permissions") @@ -38,7 +38,7 @@ func (s *DockerSuite) TestCpToContainerWithPermissions(c *check.C) { } // Check ownership is root, both in non-userns and userns enabled modes -func (s *DockerSuite) TestCpCheckDestOwnership(c *check.C) { +func (s *DockerSuite) TestCpCheckDestOwnership(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) tmpVolDir := getTestDir(c, "test-cp-tmpvol") containerID := makeTestContainer(c, diff --git a/integration-cli/docker_cli_cp_utils_test.go b/integration-cli/docker_cli_cp_utils_test.go index 3215c8f9d4..b781709bd0 100644 --- a/integration-cli/docker_cli_cp_utils_test.go +++ b/integration-cli/docker_cli_cp_utils_test.go @@ -92,7 +92,7 @@ func defaultMkContentCommand() string { return mkFilesCommand(defaultFileData) } -func makeTestContentInDir(c *check.C, dir string) { +func makeTestContentInDir(c *testing.T, dir string) { for _, fd := range defaultFileData { path := filepath.Join(dir, filepath.FromSlash(fd.path)) switch fd.filetype { @@ -118,7 +118,7 @@ type testContainerOptions struct { command string } -func makeTestContainer(c *check.C, options testContainerOptions) (containerID string) { +func makeTestContainer(c *testing.T, options testContainerOptions) (containerID string) { if options.addContent { mkContentCmd := defaultMkContentCommand() if options.command == "" { @@ -188,7 +188,7 @@ func containerCpPathTrailingSep(containerID string, pathElements ...string) stri return fmt.Sprintf("%s/", containerCpPath(containerID, pathElements...)) } -func runDockerCp(c *check.C, src, dst string, params []string) (err error) { +func runDockerCp(c *testing.T, src, dst string, params []string) (err error) { c.Logf("running `docker cp %s %s %s`", strings.Join(params, " "), src, dst) args := []string{"cp"} @@ -205,7 +205,7 @@ func runDockerCp(c *check.C, src, dst string, params []string) (err error) { return } -func startContainerGetOutput(c *check.C, containerID string) (out string, err error) { +func startContainerGetOutput(c *testing.T, containerID string) (out string, err error) { c.Logf("running `docker start -a %s`", containerID) args := []string{"start", "-a", containerID} @@ -218,7 +218,7 @@ func startContainerGetOutput(c *check.C, containerID string) (out string, err er return } -func getTestDir(c *check.C, label string) (tmpDir string) { +func getTestDir(c *testing.T, label string) (tmpDir string) { var err error tmpDir, err = ioutil.TempDir("", label) @@ -240,7 +240,7 @@ func isCpCannotCopyReadOnly(err error) bool { return strings.Contains(err.Error(), "marked read-only") } -func fileContentEquals(c *check.C, filename, contents string) (err error) { +func fileContentEquals(c *testing.T, filename, contents string) (err error) { c.Logf("checking that file %q contains %q\n", filename, contents) fileBytes, err := ioutil.ReadFile(filename) @@ -260,7 +260,7 @@ func fileContentEquals(c *check.C, filename, contents string) (err error) { return } -func symlinkTargetEquals(c *check.C, symlink, expectedTarget string) (err error) { +func symlinkTargetEquals(c *testing.T, symlink, expectedTarget string) (err error) { c.Logf("checking that the symlink %q points to %q\n", symlink, expectedTarget) actualTarget, err := os.Readlink(symlink) @@ -275,7 +275,7 @@ func symlinkTargetEquals(c *check.C, symlink, expectedTarget string) (err error) return } -func containerStartOutputEquals(c *check.C, containerID, contents string) (err error) { +func containerStartOutputEquals(c *testing.T, containerID, contents string) (err error) { c.Logf("checking that container %q start output contains %q\n", containerID, contents) out, err := startContainerGetOutput(c, containerID) diff --git a/integration-cli/docker_cli_create_test.go b/integration-cli/docker_cli_create_test.go index 4f33289b8e..5eaea7418d 100644 --- a/integration-cli/docker_cli_create_test.go +++ b/integration-cli/docker_cli_create_test.go @@ -20,7 +20,7 @@ import ( ) // Make sure we can create a simple container with some args -func (s *DockerSuite) TestCreateArgs(c *check.C) { +func (s *DockerSuite) TestCreateArgs(c *testing.T) { // Intentionally clear entrypoint, as the Windows busybox image needs an entrypoint, which breaks this test out, _ := dockerCmd(c, "create", "--entrypoint=", "busybox", "command", "arg1", "arg2", "arg with space", "-c", "flags") @@ -58,7 +58,7 @@ func (s *DockerSuite) TestCreateArgs(c *check.C) { } // Make sure we can grow the container's rootfs at creation time. -func (s *DockerSuite) TestCreateGrowRootfs(c *check.C) { +func (s *DockerSuite) TestCreateGrowRootfs(c *testing.T) { // Windows and Devicemapper support growing the rootfs if testEnv.OSType != "windows" { testRequires(c, Devicemapper) @@ -72,7 +72,7 @@ func (s *DockerSuite) TestCreateGrowRootfs(c *check.C) { } // Make sure we cannot shrink the container's rootfs at creation time. -func (s *DockerSuite) TestCreateShrinkRootfs(c *check.C) { +func (s *DockerSuite) TestCreateShrinkRootfs(c *testing.T) { testRequires(c, Devicemapper) // Ensure this fails because of the defaultBaseFsSize is 10G @@ -82,7 +82,7 @@ func (s *DockerSuite) TestCreateShrinkRootfs(c *check.C) { } // Make sure we can set hostconfig options too -func (s *DockerSuite) TestCreateHostConfig(c *check.C) { +func (s *DockerSuite) TestCreateHostConfig(c *testing.T) { out, _ := dockerCmd(c, "create", "-P", "busybox", "echo") cleanedContainerID := strings.TrimSpace(out) @@ -104,7 +104,7 @@ func (s *DockerSuite) TestCreateHostConfig(c *check.C) { assert.Assert(c, cont.HostConfig.PublishAllPorts, checker.True, check.Commentf("Expected PublishAllPorts, got false")) } -func (s *DockerSuite) TestCreateWithPortRange(c *check.C) { +func (s *DockerSuite) TestCreateWithPortRange(c *testing.T) { out, _ := dockerCmd(c, "create", "-p", "3300-3303:3300-3303/tcp", "busybox", "echo") cleanedContainerID := strings.TrimSpace(out) @@ -133,7 +133,7 @@ func (s *DockerSuite) TestCreateWithPortRange(c *check.C) { } -func (s *DockerSuite) TestCreateWithLargePortRange(c *check.C) { +func (s *DockerSuite) TestCreateWithLargePortRange(c *testing.T) { out, _ := dockerCmd(c, "create", "-p", "1-65535:1-65535/tcp", "busybox", "echo") cleanedContainerID := strings.TrimSpace(out) @@ -162,7 +162,7 @@ func (s *DockerSuite) TestCreateWithLargePortRange(c *check.C) { } // "test123" should be printed by docker create + start -func (s *DockerSuite) TestCreateEchoStdout(c *check.C) { +func (s *DockerSuite) TestCreateEchoStdout(c *testing.T) { out, _ := dockerCmd(c, "create", "busybox", "echo", "test123") cleanedContainerID := strings.TrimSpace(out) @@ -171,7 +171,7 @@ func (s *DockerSuite) TestCreateEchoStdout(c *check.C) { assert.Equal(c, out, "test123\n", "container should've printed 'test123', got %q", out) } -func (s *DockerSuite) TestCreateVolumesCreated(c *check.C) { +func (s *DockerSuite) TestCreateVolumesCreated(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) prefix, slash := getPrefixAndSlashFromDaemonPlatform() @@ -190,7 +190,7 @@ func (s *DockerSuite) TestCreateVolumesCreated(c *check.C) { } -func (s *DockerSuite) TestCreateLabels(c *check.C) { +func (s *DockerSuite) TestCreateLabels(c *testing.T) { name := "test_create_labels" expected := map[string]string{"k1": "v1", "k2": "v2"} dockerCmd(c, "create", "--name", name, "-l", "k1=v1", "--label", "k2=v2", "busybox") @@ -203,7 +203,7 @@ func (s *DockerSuite) TestCreateLabels(c *check.C) { } } -func (s *DockerSuite) TestCreateLabelFromImage(c *check.C) { +func (s *DockerSuite) TestCreateLabelFromImage(c *testing.T) { imageName := "testcreatebuildlabel" buildImageSuccessfully(c, imageName, build.WithDockerfile(`FROM busybox LABEL k1=v1 k2=v2`)) @@ -220,7 +220,7 @@ func (s *DockerSuite) TestCreateLabelFromImage(c *check.C) { } } -func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) { +func (s *DockerSuite) TestCreateHostnameWithNumber(c *testing.T) { image := "busybox" // Busybox on Windows does not implement hostname command if testEnv.OSType == "windows" { @@ -230,7 +230,7 @@ func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "web.0", "hostname not set, expected `web.0`, got: %s", out) } -func (s *DockerSuite) TestCreateRM(c *check.C) { +func (s *DockerSuite) TestCreateRM(c *testing.T) { // Test to make sure we can 'rm' a new container that is in // "Created" state, and has ever been run. Test "rm -f" too. @@ -247,7 +247,7 @@ func (s *DockerSuite) TestCreateRM(c *check.C) { dockerCmd(c, "rm", "-f", cID) } -func (s *DockerSuite) TestCreateModeIpcContainer(c *check.C) { +func (s *DockerSuite) TestCreateModeIpcContainer(c *testing.T) { // Uses Linux specific functionality (--ipc) testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) @@ -257,7 +257,7 @@ func (s *DockerSuite) TestCreateModeIpcContainer(c *check.C) { dockerCmd(c, "create", fmt.Sprintf("--ipc=container:%s", id), "busybox") } -func (s *DockerSuite) TestCreateByImageID(c *check.C) { +func (s *DockerSuite) TestCreateByImageID(c *testing.T) { imageName := "testcreatebyimageid" buildImageSuccessfully(c, imageName, build.WithDockerfile(`FROM busybox MAINTAINER dockerio`)) @@ -290,7 +290,7 @@ func (s *DockerSuite) TestCreateByImageID(c *check.C) { } } -func (s *DockerSuite) TestCreateStopSignal(c *check.C) { +func (s *DockerSuite) TestCreateStopSignal(c *testing.T) { name := "test_create_stop_signal" dockerCmd(c, "create", "--name", name, "--stop-signal", "9", "busybox") @@ -299,7 +299,7 @@ func (s *DockerSuite) TestCreateStopSignal(c *check.C) { } -func (s *DockerSuite) TestCreateWithWorkdir(c *check.C) { +func (s *DockerSuite) TestCreateWithWorkdir(c *testing.T) { name := "foo" prefix, slash := getPrefixAndSlashFromDaemonPlatform() @@ -313,7 +313,7 @@ func (s *DockerSuite) TestCreateWithWorkdir(c *check.C) { dockerCmd(c, "cp", fmt.Sprintf("%s:%s", name, dir), prefix+slash+"tmp") } -func (s *DockerSuite) TestCreateWithInvalidLogOpts(c *check.C) { +func (s *DockerSuite) TestCreateWithInvalidLogOpts(c *testing.T) { name := "test-invalidate-log-opts" out, _, err := dockerCmdWithError("create", "--name", name, "--log-opt", "invalid=true", "busybox") assert.ErrorContains(c, err, "") @@ -325,7 +325,7 @@ func (s *DockerSuite) TestCreateWithInvalidLogOpts(c *check.C) { } // #20972 -func (s *DockerSuite) TestCreate64ByteHexID(c *check.C) { +func (s *DockerSuite) TestCreate64ByteHexID(c *testing.T) { out := inspectField(c, "busybox", "Id") imageID := strings.TrimPrefix(strings.TrimSpace(string(out)), "sha256:") @@ -333,7 +333,7 @@ func (s *DockerSuite) TestCreate64ByteHexID(c *check.C) { } // Test case for #23498 -func (s *DockerSuite) TestCreateUnsetEntrypoint(c *check.C) { +func (s *DockerSuite) TestCreateUnsetEntrypoint(c *testing.T) { name := "test-entrypoint" dockerfile := `FROM busybox ADD entrypoint.sh /entrypoint.sh @@ -360,7 +360,7 @@ exec "$@"`, } // #22471 -func (s *DockerSuite) TestCreateStopTimeout(c *check.C) { +func (s *DockerSuite) TestCreateStopTimeout(c *testing.T) { name1 := "test_create_stop_timeout_1" dockerCmd(c, "create", "--name", name1, "--stop-timeout", "15", "busybox") diff --git a/integration-cli/docker_cli_daemon_plugins_test.go b/integration-cli/docker_cli_daemon_plugins_test.go index 033db85d70..1ff9eaebbe 100644 --- a/integration-cli/docker_cli_daemon_plugins_test.go +++ b/integration-cli/docker_cli_daemon_plugins_test.go @@ -13,7 +13,7 @@ import ( ) // TestDaemonRestartWithPluginEnabled tests state restore for an enabled plugin -func (s *DockerDaemonSuite) TestDaemonRestartWithPluginEnabled(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithPluginEnabled(c *testing.T) { testRequires(c, IsAmd64, Network) s.d.Start(c) @@ -42,7 +42,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithPluginEnabled(c *check.C) { } // TestDaemonRestartWithPluginDisabled tests state restore for a disabled plugin -func (s *DockerDaemonSuite) TestDaemonRestartWithPluginDisabled(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithPluginDisabled(c *testing.T) { testRequires(c, IsAmd64, Network) s.d.Start(c) @@ -69,7 +69,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithPluginDisabled(c *check.C) { // TestDaemonKillLiveRestoreWithPlugins SIGKILLs daemon started with --live-restore. // Plugins should continue to run. -func (s *DockerDaemonSuite) TestDaemonKillLiveRestoreWithPlugins(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonKillLiveRestoreWithPlugins(c *testing.T) { testRequires(c, IsAmd64, Network) s.d.Start(c, "--live-restore") @@ -95,7 +95,7 @@ func (s *DockerDaemonSuite) TestDaemonKillLiveRestoreWithPlugins(c *check.C) { // TestDaemonShutdownLiveRestoreWithPlugins SIGTERMs daemon started with --live-restore. // Plugins should continue to run. -func (s *DockerDaemonSuite) TestDaemonShutdownLiveRestoreWithPlugins(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonShutdownLiveRestoreWithPlugins(c *testing.T) { testRequires(c, IsAmd64, Network) s.d.Start(c, "--live-restore") @@ -120,7 +120,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownLiveRestoreWithPlugins(c *check.C) } // TestDaemonShutdownWithPlugins shuts down running plugins. -func (s *DockerDaemonSuite) TestDaemonShutdownWithPlugins(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonShutdownWithPlugins(c *testing.T) { testRequires(c, IsAmd64, Network) s.d.Start(c) @@ -158,7 +158,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownWithPlugins(c *check.C) { } // TestDaemonKillWithPlugins leaves plugins running. -func (s *DockerDaemonSuite) TestDaemonKillWithPlugins(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonKillWithPlugins(c *testing.T) { testRequires(c, IsAmd64, Network) s.d.Start(c) @@ -185,7 +185,7 @@ func (s *DockerDaemonSuite) TestDaemonKillWithPlugins(c *check.C) { } // TestVolumePlugin tests volume creation using a plugin. -func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) { +func (s *DockerDaemonSuite) TestVolumePlugin(c *testing.T) { testRequires(c, IsAmd64, Network) volName := "plugin-volume" @@ -231,7 +231,7 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) { assert.NilError(c, err, out) } -func (s *DockerDaemonSuite) TestPluginVolumeRemoveOnRestart(c *check.C) { +func (s *DockerDaemonSuite) TestPluginVolumeRemoveOnRestart(c *testing.T) { testRequires(c, IsAmd64, Network) s.d.Start(c, "--live-restore=true") @@ -272,7 +272,7 @@ func existsMountpointWithPrefix(mountpointPrefix string) (bool, error) { return false, nil } -func (s *DockerDaemonSuite) TestPluginListFilterEnabled(c *check.C) { +func (s *DockerDaemonSuite) TestPluginListFilterEnabled(c *testing.T) { testRequires(c, IsAmd64, Network) s.d.Start(c) @@ -300,7 +300,7 @@ func (s *DockerDaemonSuite) TestPluginListFilterEnabled(c *check.C) { assert.Assert(c, strings.Contains(out, pName)) } -func (s *DockerDaemonSuite) TestPluginListFilterCapability(c *check.C) { +func (s *DockerDaemonSuite) TestPluginListFilterCapability(c *testing.T) { testRequires(c, IsAmd64, Network) s.d.Start(c) diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index 0c5b70d0ef..f99107e81d 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/integration-cli/docker_cli_daemon_test.go @@ -46,7 +46,7 @@ const containerdSocket = "/var/run/docker/containerd/containerd.sock" // TestLegacyDaemonCommand test starting docker daemon using "deprecated" docker daemon // command. Remove this test when we remove this. -func (s *DockerDaemonSuite) TestLegacyDaemonCommand(c *check.C) { +func (s *DockerDaemonSuite) TestLegacyDaemonCommand(c *testing.T) { cmd := exec.Command(dockerBinary, "daemon", "--storage-driver=vfs", "--debug") err := cmd.Start() go cmd.Wait() @@ -54,7 +54,7 @@ func (s *DockerDaemonSuite) TestLegacyDaemonCommand(c *check.C) { assert.NilError(c, cmd.Process.Kill()) } -func (s *DockerDaemonSuite) TestDaemonRestartWithRunningContainersPorts(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithRunningContainersPorts(c *testing.T) { s.d.StartWithBusybox(c) cli.Docker( @@ -88,7 +88,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithRunningContainersPorts(c *check testRun(map[string]bool{"top1": true, "top2": false}, "After daemon restart: ") } -func (s *DockerDaemonSuite) TestDaemonRestartWithVolumesRefs(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithVolumesRefs(c *testing.T) { s.d.StartWithBusybox(c) if out, err := s.d.Cmd("run", "--name", "volrestarttest1", "-v", "/foo", "busybox"); err != nil { @@ -114,7 +114,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithVolumesRefs(c *check.C) { } // #11008 -func (s *DockerDaemonSuite) TestDaemonRestartUnlessStopped(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartUnlessStopped(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("run", "-d", "--name", "top1", "--restart", "always", "busybox:latest", "top") @@ -173,7 +173,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartUnlessStopped(c *check.C) { } -func (s *DockerDaemonSuite) TestDaemonRestartOnFailure(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartOnFailure(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("run", "-d", "--name", "test1", "--restart", "on-failure:3", "busybox:latest", "false") @@ -202,12 +202,12 @@ func (s *DockerDaemonSuite) TestDaemonRestartOnFailure(c *check.C) { assert.Equal(c, out, lastStartTime, "test1 shouldn't start after daemon restarts") } -func (s *DockerDaemonSuite) TestDaemonStartIptablesFalse(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonStartIptablesFalse(c *testing.T) { s.d.Start(c, "--iptables=false") } // Make sure we cannot shrink base device at daemon restart. -func (s *DockerDaemonSuite) TestDaemonRestartWithInvalidBasesize(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithInvalidBasesize(c *testing.T) { testRequires(c, Devicemapper) s.d.Start(c) @@ -227,7 +227,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithInvalidBasesize(c *check.C) { } // Make sure we can grow base device at daemon restart. -func (s *DockerDaemonSuite) TestDaemonRestartWithIncreasedBasesize(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithIncreasedBasesize(c *testing.T) { testRequires(c, Devicemapper) s.d.Start(c) @@ -249,7 +249,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithIncreasedBasesize(c *check.C) { s.d.Stop(c) } -func getBaseDeviceSize(c *check.C, d *daemon.Daemon) int64 { +func getBaseDeviceSize(c *testing.T, d *daemon.Daemon) int64 { info := d.Info(c) for _, statusLine := range info.DriverStatus { key, value := statusLine[0], statusLine[1] @@ -261,7 +261,7 @@ func getBaseDeviceSize(c *check.C, d *daemon.Daemon) int64 { return int64(0) } -func parseDeviceSize(c *check.C, raw string) int64 { +func parseDeviceSize(c *testing.T, raw string) int64 { size, err := units.RAMInBytes(strings.TrimSpace(raw)) assert.NilError(c, err) return size @@ -280,7 +280,7 @@ func convertBasesize(basesizeBytes int64) (int64, error) { // Issue #8444: If docker0 bridge is modified (intentionally or unintentionally) and // no longer has an IP associated, we should gracefully handle that case and associate // an IP with it rather than fail daemon start -func (s *DockerDaemonSuite) TestDaemonStartBridgeWithoutIPAssociation(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonStartBridgeWithoutIPAssociation(c *testing.T) { // rather than depending on brctl commands to verify docker0 is created and up // let's start the daemon and stop it, and then make a modification to run the // actual test @@ -296,7 +296,7 @@ func (s *DockerDaemonSuite) TestDaemonStartBridgeWithoutIPAssociation(c *check.C } } -func (s *DockerDaemonSuite) TestDaemonIptablesClean(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonIptablesClean(c *testing.T) { s.d.StartWithBusybox(c) if out, err := s.d.Cmd("run", "-d", "--name", "top", "-p", "80", "busybox:latest", "top"); err != nil { @@ -314,7 +314,7 @@ func (s *DockerDaemonSuite) TestDaemonIptablesClean(c *check.C) { verifyIPTablesDoesNotContains(c, ipTablesSearchString) } -func (s *DockerDaemonSuite) TestDaemonIptablesCreate(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonIptablesCreate(c *testing.T) { s.d.StartWithBusybox(c) if out, err := s.d.Cmd("run", "-d", "--name", "top", "--restart=always", "-p", "80", "busybox:latest", "top"); err != nil { @@ -340,7 +340,7 @@ func (s *DockerDaemonSuite) TestDaemonIptablesCreate(c *check.C) { verifyIPTablesContains(c, ipTablesSearchString) } -func verifyIPTablesContains(c *check.C, ipTablesSearchString string) { +func verifyIPTablesContains(c *testing.T, ipTablesSearchString string) { result := icmd.RunCommand("iptables", "-nvL") result.Assert(c, icmd.Success) if !strings.Contains(result.Combined(), ipTablesSearchString) { @@ -348,7 +348,7 @@ func verifyIPTablesContains(c *check.C, ipTablesSearchString string) { } } -func verifyIPTablesDoesNotContains(c *check.C, ipTablesSearchString string) { +func verifyIPTablesDoesNotContains(c *testing.T, ipTablesSearchString string) { result := icmd.RunCommand("iptables", "-nvL") result.Assert(c, icmd.Success) if strings.Contains(result.Combined(), ipTablesSearchString) { @@ -358,7 +358,7 @@ func verifyIPTablesDoesNotContains(c *check.C, ipTablesSearchString string) { // TestDaemonIPv6Enabled checks that when the daemon is started with --ipv6=true that the docker0 bridge // has the fe80::1 address and that a container is assigned a link-local address -func (s *DockerDaemonSuite) TestDaemonIPv6Enabled(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonIPv6Enabled(c *testing.T) { testRequires(c, IPv6) setupV6(c) @@ -417,7 +417,7 @@ func (s *DockerDaemonSuite) TestDaemonIPv6Enabled(c *check.C) { // TestDaemonIPv6FixedCIDR checks that when the daemon is started with --ipv6=true and a fixed CIDR // that running containers are given a link-local and global IPv6 address -func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDR(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDR(c *testing.T) { // IPv6 setup is messing with local bridge address. testRequires(c, testEnv.IsLocalDaemon) // Delete the docker0 bridge if its left around from previous daemon. It has to be recreated with @@ -444,7 +444,7 @@ func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDR(c *check.C) { // TestDaemonIPv6FixedCIDRAndMac checks that when the daemon is started with ipv6 fixed CIDR // the running containers are given an IPv6 address derived from the MAC address and the ipv6 fixed CIDR -func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDRAndMac(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDRAndMac(c *testing.T) { // IPv6 setup is messing with local bridge address. testRequires(c, testEnv.IsLocalDaemon) // Delete the docker0 bridge if its left around from previous daemon. It has to be recreated with @@ -463,7 +463,7 @@ func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDRAndMac(c *check.C) { // TestDaemonIPv6HostMode checks that when the running a container with // network=host the host ipv6 addresses are not removed -func (s *DockerDaemonSuite) TestDaemonIPv6HostMode(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonIPv6HostMode(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) deleteInterface(c, "docker0") @@ -476,11 +476,11 @@ func (s *DockerDaemonSuite) TestDaemonIPv6HostMode(c *check.C) { assert.Assert(c, strings.Trim(out, " \r\n'"), checker.Contains, "2001:db8:2::1") } -func (s *DockerDaemonSuite) TestDaemonLogLevelWrong(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonLogLevelWrong(c *testing.T) { assert.Assert(c, s.d.StartWithError("--log-level=bogus"), check.NotNil, check.Commentf("Daemon shouldn't start with wrong log level")) } -func (s *DockerDaemonSuite) TestDaemonLogLevelDebug(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonLogLevelDebug(c *testing.T) { s.d.Start(c, "--log-level=debug") content, err := s.d.ReadLogFile() assert.NilError(c, err) @@ -489,7 +489,7 @@ func (s *DockerDaemonSuite) TestDaemonLogLevelDebug(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonLogLevelFatal(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonLogLevelFatal(c *testing.T) { // we creating new daemons to create new logFile s.d.Start(c, "--log-level=fatal") content, err := s.d.ReadLogFile() @@ -499,7 +499,7 @@ func (s *DockerDaemonSuite) TestDaemonLogLevelFatal(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonFlagD(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonFlagD(c *testing.T) { s.d.Start(c, "-D") content, err := s.d.ReadLogFile() assert.NilError(c, err) @@ -508,7 +508,7 @@ func (s *DockerDaemonSuite) TestDaemonFlagD(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonFlagDebug(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonFlagDebug(c *testing.T) { s.d.Start(c, "--debug") content, err := s.d.ReadLogFile() assert.NilError(c, err) @@ -517,7 +517,7 @@ func (s *DockerDaemonSuite) TestDaemonFlagDebug(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonFlagDebugLogLevelFatal(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonFlagDebugLogLevelFatal(c *testing.T) { s.d.Start(c, "--debug", "--log-level=fatal") content, err := s.d.ReadLogFile() assert.NilError(c, err) @@ -526,7 +526,7 @@ func (s *DockerDaemonSuite) TestDaemonFlagDebugLogLevelFatal(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonAllocatesListeningPort(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonAllocatesListeningPort(c *testing.T) { listeningPorts := [][]string{ {"0.0.0.0", "0.0.0.0", "5678"}, {"127.0.0.1", "127.0.0.1", "1234"}, @@ -550,7 +550,7 @@ func (s *DockerDaemonSuite) TestDaemonAllocatesListeningPort(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonKeyGeneration(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonKeyGeneration(c *testing.T) { // TODO: skip or update for Windows daemon os.Remove("/etc/docker/key.json") s.d.Start(c) @@ -570,7 +570,7 @@ func (s *DockerDaemonSuite) TestDaemonKeyGeneration(c *check.C) { // GH#11320 - verify that the daemon exits on failure properly // Note that this explicitly tests the conflict of {-b,--bridge} and {--bip} options as the means // to get a daemon init failure; no other tests for -b/--bip conflict are therefore required -func (s *DockerDaemonSuite) TestDaemonExitOnFailure(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonExitOnFailure(c *testing.T) { //attempt to start daemon with incorrect flags (we know -b and --bip conflict) if err := s.d.StartWithError("--bridge", "nosuchbridge", "--bip", "1.1.1.1"); err != nil { //verify we got the right error @@ -585,7 +585,7 @@ func (s *DockerDaemonSuite) TestDaemonExitOnFailure(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonBridgeExternal(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonBridgeExternal(c *testing.T) { d := s.d err := d.StartWithError("--bridge", "nosuchbridge") assert.ErrorContains(c, err, "", `--bridge option with an invalid bridge should cause the daemon to fail`) @@ -613,7 +613,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeExternal(c *check.C) { assert.Assert(c, bridgeIPNet.Contains(ip), "Container IP-Address must be in the same subnet range : %s", containerIP) } -func (s *DockerDaemonSuite) TestDaemonBridgeNone(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonBridgeNone(c *testing.T) { // start with bridge none d := s.d d.StartWithBusybox(c, "--bridge", "none") @@ -632,18 +632,18 @@ func (s *DockerDaemonSuite) TestDaemonBridgeNone(c *check.C) { assert.Assert(c, strings.Contains(out, "No such network")) } -func createInterface(c *check.C, ifType string, ifName string, ipNet string) { +func createInterface(c *testing.T, ifType string, ifName string, ipNet string) { icmd.RunCommand("ip", "link", "add", "name", ifName, "type", ifType).Assert(c, icmd.Success) icmd.RunCommand("ifconfig", ifName, ipNet, "up").Assert(c, icmd.Success) } -func deleteInterface(c *check.C, ifName string) { +func deleteInterface(c *testing.T, ifName string) { icmd.RunCommand("ip", "link", "delete", ifName).Assert(c, icmd.Success) icmd.RunCommand("iptables", "-t", "nat", "--flush").Assert(c, icmd.Success) icmd.RunCommand("iptables", "--flush").Assert(c, icmd.Success) } -func (s *DockerDaemonSuite) TestDaemonBridgeIP(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonBridgeIP(c *testing.T) { // TestDaemonBridgeIP Steps // 1. Delete the existing docker0 Bridge // 2. Set --bip daemon configuration and start the new Docker Daemon @@ -683,7 +683,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeIP(c *check.C) { deleteInterface(c, defaultNetworkBridge) } -func (s *DockerDaemonSuite) TestDaemonRestartWithBridgeIPChange(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithBridgeIPChange(c *testing.T) { s.d.Start(c) defer s.d.Restart(c) s.d.Stop(c) @@ -703,7 +703,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithBridgeIPChange(c *check.C) { }) } -func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr(c *testing.T) { d := s.d bridgeName := "external-bridge" @@ -725,7 +725,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr2(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr2(c *testing.T) { d := s.d bridgeName := "external-bridge" @@ -750,7 +750,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr2(c *check.C) { assert.Equal(c, out, "10.2.2.2\n") } -func (s *DockerDaemonSuite) TestDaemonBridgeFixedCIDREqualBridgeNetwork(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonBridgeFixedCIDREqualBridgeNetwork(c *testing.T) { d := s.d bridgeName := "external-bridge" @@ -768,7 +768,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeFixedCIDREqualBridgeNetwork(c *check defer d.Cmd("stop", cid1) } -func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Implicit(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Implicit(c *testing.T) { defaultNetworkBridge := "docker0" deleteInterface(c, defaultNetworkBridge) @@ -787,7 +787,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Implicit(c *check.C) { deleteInterface(c, defaultNetworkBridge) } -func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Explicit(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Explicit(c *testing.T) { defaultNetworkBridge := "docker0" deleteInterface(c, defaultNetworkBridge) @@ -807,7 +807,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Explicit(c *check.C) { deleteInterface(c, defaultNetworkBridge) } -func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4ExplicitOutsideContainerSubnet(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4ExplicitOutsideContainerSubnet(c *testing.T) { defaultNetworkBridge := "docker0" deleteInterface(c, defaultNetworkBridge) @@ -818,7 +818,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4ExplicitOutsideContainer s.d.Restart(c) } -func (s *DockerDaemonSuite) TestDaemonDefaultNetworkInvalidClusterConfig(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonDefaultNetworkInvalidClusterConfig(c *testing.T) { // Start daemon without docker0 bridge defaultNetworkBridge := "docker0" @@ -834,7 +834,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultNetworkInvalidClusterConfig(c *chec s.d.Restart(c, fmt.Sprintf("--cluster-store=%s", discoveryBackend)) } -func (s *DockerDaemonSuite) TestDaemonIP(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonIP(c *testing.T) { d := s.d ipStr := "192.170.1.1/24" @@ -861,7 +861,7 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *check.C) { assert.Assert(c, matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined())) } -func (s *DockerDaemonSuite) TestDaemonICCPing(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonICCPing(c *testing.T) { testRequires(c, bridgeNfIptables) d := s.d @@ -895,7 +895,7 @@ func (s *DockerDaemonSuite) TestDaemonICCPing(c *check.C) { assert.NilError(c, err, out) } -func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *testing.T) { d := s.d bridgeName := "external-bridge" @@ -919,7 +919,7 @@ func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *check.C) { assert.NilError(c, err, out) } -func (s *DockerDaemonSuite) TestDaemonLinksIpTablesRulesWhenLinkAndUnlink(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonLinksIpTablesRulesWhenLinkAndUnlink(c *testing.T) { bridgeName := "external-bridge" bridgeIP := "192.169.1.1/24" @@ -952,7 +952,7 @@ func (s *DockerDaemonSuite) TestDaemonLinksIpTablesRulesWhenLinkAndUnlink(c *che s.d.Cmd("kill", "parent") } -func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *testing.T) { s.d.StartWithBusybox(c, "--default-ulimit", "nofile=42:42", "--default-ulimit", "nproc=1024:1024") @@ -999,7 +999,7 @@ func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *check.C) { } // #11315 -func (s *DockerDaemonSuite) TestDaemonRestartRenameContainer(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartRenameContainer(c *testing.T) { s.d.StartWithBusybox(c) if out, err := s.d.Cmd("run", "--name=test", "busybox"); err != nil { @@ -1017,7 +1017,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartRenameContainer(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonLoggingDriverDefault(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonLoggingDriverDefault(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("run", "--name=test", "busybox", "echo", "testline") @@ -1055,7 +1055,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverDefault(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonLoggingDriverDefaultOverride(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonLoggingDriverDefaultOverride(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("run", "--name=test", "--log-driver=none", "busybox", "echo", "testline") @@ -1072,7 +1072,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverDefaultOverride(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonLoggingDriverNone(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonLoggingDriverNone(c *testing.T) { s.d.StartWithBusybox(c, "--log-driver=none") out, err := s.d.Cmd("run", "--name=test", "busybox", "echo", "testline") @@ -1089,7 +1089,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNone(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneOverride(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneOverride(c *testing.T) { s.d.StartWithBusybox(c, "--log-driver=none") out, err := s.d.Cmd("run", "--name=test", "--log-driver=json-file", "busybox", "echo", "testline") @@ -1129,7 +1129,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneOverride(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneLogsError(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneLogsError(c *testing.T) { s.d.StartWithBusybox(c, "--log-driver=none") out, err := s.d.Cmd("run", "--name=test", "busybox", "echo", "testline") @@ -1141,7 +1141,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneLogsError(c *check.C) { assert.Assert(c, strings.Contains(out, expected)) } -func (s *DockerDaemonSuite) TestDaemonLoggingDriverShouldBeIgnoredForBuild(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonLoggingDriverShouldBeIgnoredForBuild(c *testing.T) { s.d.StartWithBusybox(c, "--log-driver=splunk") result := cli.BuildCmd(c, "busyboxs", cli.Daemon(s.d), @@ -1156,7 +1156,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverShouldBeIgnoredForBuild(c *ch assert.Assert(c, result.Combined(), checker.Contains, "foo", comment) } -func (s *DockerDaemonSuite) TestDaemonUnixSockCleanedUp(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonUnixSockCleanedUp(c *testing.T) { dir, err := ioutil.TempDir("", "socket-cleanup-test") if err != nil { c.Fatal(err) @@ -1177,7 +1177,7 @@ func (s *DockerDaemonSuite) TestDaemonUnixSockCleanedUp(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonWithWrongkey(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonWithWrongkey(c *testing.T) { type Config struct { Crv string `json:"crv"` D string `json:"d"` @@ -1230,7 +1230,7 @@ func (s *DockerDaemonSuite) TestDaemonWithWrongkey(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonRestartKillWait(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartKillWait(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("run", "-id", "busybox", "/bin/cat") @@ -1264,7 +1264,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartKillWait(c *check.C) { } // TestHTTPSInfo connects via two-way authenticated HTTPS to the info endpoint -func (s *DockerDaemonSuite) TestHTTPSInfo(c *check.C) { +func (s *DockerDaemonSuite) TestHTTPSInfo(c *testing.T) { const ( testDaemonHTTPSAddr = "tcp://localhost:4271" ) @@ -1292,7 +1292,7 @@ func (s *DockerDaemonSuite) TestHTTPSInfo(c *check.C) { // TestHTTPSRun connects via two-way authenticated HTTPS to the create, attach, start, and wait endpoints. // https://github.com/docker/docker/issues/19280 -func (s *DockerDaemonSuite) TestHTTPSRun(c *check.C) { +func (s *DockerDaemonSuite) TestHTTPSRun(c *testing.T) { const ( testDaemonHTTPSAddr = "tcp://localhost:4271" ) @@ -1318,7 +1318,7 @@ func (s *DockerDaemonSuite) TestHTTPSRun(c *check.C) { } // TestTLSVerify verifies that --tlsverify=false turns on tls -func (s *DockerDaemonSuite) TestTLSVerify(c *check.C) { +func (s *DockerDaemonSuite) TestTLSVerify(c *testing.T) { out, err := exec.Command(dockerdBinary, "--tlsverify=false").CombinedOutput() if err == nil || !strings.Contains(string(out), "Could not load X509 key pair") { c.Fatalf("Daemon should not have started due to missing certs: %v\n%s", err, string(out)) @@ -1327,7 +1327,7 @@ func (s *DockerDaemonSuite) TestTLSVerify(c *check.C) { // TestHTTPSInfoRogueCert connects via two-way authenticated HTTPS to the info endpoint // by using a rogue client certificate and checks that it fails with the expected error. -func (s *DockerDaemonSuite) TestHTTPSInfoRogueCert(c *check.C) { +func (s *DockerDaemonSuite) TestHTTPSInfoRogueCert(c *testing.T) { const ( errBadCertificate = "bad certificate" testDaemonHTTPSAddr = "tcp://localhost:4271" @@ -1356,7 +1356,7 @@ func (s *DockerDaemonSuite) TestHTTPSInfoRogueCert(c *check.C) { // TestHTTPSInfoRogueServerCert connects via two-way authenticated HTTPS to the info endpoint // which provides a rogue server certificate and checks that it fails with the expected error -func (s *DockerDaemonSuite) TestHTTPSInfoRogueServerCert(c *check.C) { +func (s *DockerDaemonSuite) TestHTTPSInfoRogueServerCert(c *testing.T) { const ( errCaUnknown = "x509: certificate signed by unknown authority" testDaemonRogueHTTPSAddr = "tcp://localhost:4272" @@ -1382,7 +1382,7 @@ func (s *DockerDaemonSuite) TestHTTPSInfoRogueServerCert(c *check.C) { } } -func pingContainers(c *check.C, d *daemon.Daemon, expectFailure bool) { +func pingContainers(c *testing.T, d *daemon.Daemon, expectFailure bool) { var dargs []string if d != nil { dargs = []string{"--host", d.Sock()} @@ -1406,7 +1406,7 @@ func pingContainers(c *check.C, d *daemon.Daemon, expectFailure bool) { dockerCmd(c, args...) } -func (s *DockerDaemonSuite) TestDaemonRestartWithSocketAsVolume(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithSocketAsVolume(c *testing.T) { s.d.StartWithBusybox(c) socket := filepath.Join(s.d.Folder, "docker.sock") @@ -1418,7 +1418,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithSocketAsVolume(c *check.C) { // os.Kill should kill daemon ungracefully, leaving behind container mounts. // A subsequent daemon restart should clean up said mounts. -func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonAndContainerKill(c *check.C) { +func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonAndContainerKill(c *testing.T) { d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) d.StartWithBusybox(c) @@ -1456,7 +1456,7 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonAndContainerKill(c *chec } // os.Interrupt should perform a graceful daemon shutdown and hence cleanup mounts. -func (s *DockerDaemonSuite) TestCleanupMountsAfterGracefulShutdown(c *check.C) { +func (s *DockerDaemonSuite) TestCleanupMountsAfterGracefulShutdown(c *testing.T) { d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) d.StartWithBusybox(c) @@ -1475,7 +1475,7 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterGracefulShutdown(c *check.C) { assert.Assert(c, !strings.Contains(string(mountOut), id), "%s is still mounted from older daemon start:\nDaemon root repository %s\n%s", id, d.Root, mountOut) } -func (s *DockerDaemonSuite) TestDaemonRestartWithContainerRunning(t *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithContainerRunning(t *testing.T) { s.d.StartWithBusybox(t) if out, err := s.d.Cmd("run", "-d", "--name", "test", "busybox", "top"); err != nil { t.Fatal(out, err) @@ -1488,7 +1488,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithContainerRunning(t *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonRestartCleanupNetns(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartCleanupNetns(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("run", "--name", "netns", "-d", "busybox", "top") if err != nil { @@ -1526,7 +1526,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartCleanupNetns(c *check.C) { } // tests regression detailed in #13964 where DOCKER_TLS_VERIFY env is ignored -func (s *DockerDaemonSuite) TestDaemonTLSVerifyIssue13964(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonTLSVerifyIssue13964(c *testing.T) { host := "tcp://localhost:4271" s.d.Start(c, "-H", host) icmd.RunCmd(icmd.Cmd{ @@ -1538,18 +1538,18 @@ func (s *DockerDaemonSuite) TestDaemonTLSVerifyIssue13964(c *check.C) { }) } -func setupV6(c *check.C) { +func setupV6(c *testing.T) { // Hack to get the right IPv6 address on docker0, which has already been created result := icmd.RunCommand("ip", "addr", "add", "fe80::1/64", "dev", "docker0") result.Assert(c, icmd.Success) } -func teardownV6(c *check.C) { +func teardownV6(c *testing.T) { result := icmd.RunCommand("ip", "addr", "del", "fe80::1/64", "dev", "docker0") result.Assert(c, icmd.Success) } -func (s *DockerDaemonSuite) TestDaemonRestartWithContainerWithRestartPolicyAlways(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithContainerWithRestartPolicyAlways(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("run", "-d", "--restart", "always", "busybox", "top") @@ -1572,7 +1572,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithContainerWithRestartPolicyAlway assert.Assert(c, strings.TrimSpace(out), check.Equals, id[:12]) } -func (s *DockerDaemonSuite) TestDaemonWideLogConfig(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonWideLogConfig(c *testing.T) { s.d.StartWithBusybox(c, "--log-opt=max-size=1k") name := "logtest" out, err := s.d.Cmd("run", "-d", "--log-opt=max-file=5", "--name", name, "busybox", "top") @@ -1588,7 +1588,7 @@ func (s *DockerDaemonSuite) TestDaemonWideLogConfig(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "json-file") } -func (s *DockerDaemonSuite) TestDaemonRestartWithPausedContainer(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithPausedContainer(c *testing.T) { s.d.StartWithBusybox(c) if out, err := s.d.Cmd("run", "-i", "-d", "--name", "test", "busybox", "top"); err != nil { c.Fatal(err, out) @@ -1621,7 +1621,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithPausedContainer(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("create", "-v", "test:/foo", "busybox") @@ -1634,7 +1634,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *check.C) { assert.Assert(c, out, checker.Contains, "in use") } -func (s *DockerDaemonSuite) TestDaemonRestartLocalVolumes(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartLocalVolumes(c *testing.T) { s.d.Start(c) out, err := s.d.Cmd("volume", "create", "test") @@ -1646,7 +1646,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartLocalVolumes(c *check.C) { } // FIXME(vdemeester) should be a unit test -func (s *DockerDaemonSuite) TestDaemonCorruptedLogDriverAddress(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonCorruptedLogDriverAddress(c *testing.T) { d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) assert.Assert(c, d.StartWithError("--log-driver=syslog", "--log-opt", "syslog-address=corrupted:42"), check.NotNil) expected := "syslog-address should be in form proto://address" @@ -1654,7 +1654,7 @@ func (s *DockerDaemonSuite) TestDaemonCorruptedLogDriverAddress(c *check.C) { } // FIXME(vdemeester) should be a unit test -func (s *DockerDaemonSuite) TestDaemonCorruptedFluentdAddress(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonCorruptedFluentdAddress(c *testing.T) { d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) assert.Assert(c, d.StartWithError("--log-driver=fluentd", "--log-opt", "fluentd-address=corrupted:c"), check.NotNil) expected := "invalid fluentd-address corrupted:c: " @@ -1662,7 +1662,7 @@ func (s *DockerDaemonSuite) TestDaemonCorruptedFluentdAddress(c *check.C) { } // FIXME(vdemeester) Use a new daemon instance instead of the Suite one -func (s *DockerDaemonSuite) TestDaemonStartWithoutHost(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonStartWithoutHost(c *testing.T) { s.d.UseDefaultHost = true defer func() { s.d.UseDefaultHost = false @@ -1671,7 +1671,7 @@ func (s *DockerDaemonSuite) TestDaemonStartWithoutHost(c *check.C) { } // FIXME(vdemeester) Use a new daemon instance instead of the Suite one -func (s *DockerDaemonSuite) TestDaemonStartWithDefaultTLSHost(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonStartWithDefaultTLSHost(c *testing.T) { s.d.UseDefaultTLSHost = true defer func() { s.d.UseDefaultTLSHost = false @@ -1730,7 +1730,7 @@ func (s *DockerDaemonSuite) TestDaemonStartWithDefaultTLSHost(c *check.C) { assert.Assert(c, certRequestInfo.AcceptableCAs[0], checker.DeepEquals, rootCert.RawSubject) } -func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *check.C) { +func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *testing.T) { defaultNetworkBridge := "docker0" deleteInterface(c, defaultNetworkBridge) @@ -1757,7 +1757,7 @@ func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *check.C) } // Test daemon for no space left on device error -func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, Network) testDir, err := ioutil.TempDir("", "no-space-left-on-device-test") @@ -1784,7 +1784,7 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *check.C) { } // Test daemon restart with container links + auto restart -func (s *DockerDaemonSuite) TestDaemonRestartContainerLinksRestart(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartContainerLinksRestart(c *testing.T) { s.d.StartWithBusybox(c) var parent1Args []string @@ -1842,7 +1842,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartContainerLinksRestart(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonCgroupParent(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonCgroupParent(c *testing.T) { testRequires(c, DaemonIsLinux) cgroupParent := "test" @@ -1869,7 +1869,7 @@ func (s *DockerDaemonSuite) TestDaemonCgroupParent(c *check.C) { assert.Assert(c, found, checker.True, check.Commentf("Cgroup path for container (%s) doesn't found in cgroups file: %s", expectedCgroup, cgroupPaths)) } -func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support links s.d.StartWithBusybox(c) @@ -1892,7 +1892,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *check.C) { assert.Assert(c, strings.Contains(out, "1 packets transmitted, 1 packets received"), check.Equals, true, check.Commentf("%s", out)) } -func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support links s.d.StartWithBusybox(c) @@ -1940,7 +1940,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *check.C) { } // TestDaemonRestartWithKilledRunningContainer requires live restore of running containers -func (s *DockerDaemonSuite) TestDaemonRestartWithKilledRunningContainer(t *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithKilledRunningContainer(t *testing.T) { testRequires(t, DaemonIsLinux) s.d.StartWithBusybox(t) @@ -1990,7 +1990,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithKilledRunningContainer(t *check // os.Kill should kill daemon ungracefully, leaving behind live containers. // The live containers should be known to the restarted daemon. Stopping // them now, should remove the mounts. -func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonCrash(c *check.C) { +func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonCrash(c *testing.T) { testRequires(c, DaemonIsLinux) s.d.StartWithBusybox(c, "--live-restore") @@ -2037,7 +2037,7 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonCrash(c *check.C) { } // TestDaemonRestartWithUnpausedRunningContainer requires live restore of running containers. -func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *testing.T) { testRequires(t, DaemonIsLinux) s.d.StartWithBusybox(t, "--live-restore") @@ -2071,7 +2071,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *che // Give time to containerd to process the command if we don't // the resume event might be received after we do the inspect - waitAndAssert(t, defaultReconciliationTimeout, func(*check.C) (interface{}, check.CommentInterface) { + waitAndAssert(t, defaultReconciliationTimeout, func(*testing.T) (interface{}, check.CommentInterface) { result := icmd.RunCommand("kill", "-0", strings.TrimSpace(pid)) return result.ExitCode, nil }, checker.Equals, 0) @@ -2094,7 +2094,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *che // TestRunLinksChanged checks that creating a new container with the same name does not update links // this ensures that the old, pre gh#16032 functionality continues on -func (s *DockerDaemonSuite) TestRunLinksChanged(c *check.C) { +func (s *DockerDaemonSuite) TestRunLinksChanged(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support links s.d.StartWithBusybox(c) @@ -2120,7 +2120,7 @@ func (s *DockerDaemonSuite) TestRunLinksChanged(c *check.C) { assert.Assert(c, out, check.Not(checker.Contains), "1 packets transmitted, 1 packets received") } -func (s *DockerDaemonSuite) TestDaemonStartWithoutColors(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonStartWithoutColors(c *testing.T) { testRequires(c, DaemonIsLinux) infoLog := "\x1b[36mINFO\x1b" @@ -2170,7 +2170,7 @@ func (s *DockerDaemonSuite) TestDaemonStartWithoutColors(c *check.C) { assert.Assert(c, b.String(), check.Not(checker.Contains), infoLog) } -func (s *DockerDaemonSuite) TestDaemonDebugLog(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonDebugLog(c *testing.T) { testRequires(c, DaemonIsLinux) debugLog := "\x1b[37mDEBU\x1b" @@ -2190,7 +2190,7 @@ func (s *DockerDaemonSuite) TestDaemonDebugLog(c *check.C) { assert.Assert(c, b.String(), checker.Contains, debugLog) } -func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) // daemon config file @@ -2236,7 +2236,7 @@ func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *check.C) { } // Test for #21956 -func (s *DockerDaemonSuite) TestDaemonLogOptions(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonLogOptions(c *testing.T) { s.d.StartWithBusybox(c, "--log-driver=syslog", "--log-opt=syslog-address=udp://127.0.0.1:514") out, err := s.d.Cmd("run", "-d", "--log-driver=json-file", "busybox", "top") @@ -2249,7 +2249,7 @@ func (s *DockerDaemonSuite) TestDaemonLogOptions(c *check.C) { } // Test case for #20936, #22443 -func (s *DockerDaemonSuite) TestDaemonMaxConcurrency(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonMaxConcurrency(c *testing.T) { s.d.Start(c, "--max-concurrent-uploads=6", "--max-concurrent-downloads=8") expectedMaxConcurrentUploads := `level=debug msg="Max Concurrent Uploads: 6"` @@ -2261,7 +2261,7 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrency(c *check.C) { } // Test case for #20936, #22443 -func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFile(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFile(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) // daemon config file @@ -2302,7 +2302,7 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFile(c *check.C) { } // Test case for #20936, #22443 -func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) // daemon config file @@ -2359,7 +2359,7 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *chec assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) } -func (s *DockerDaemonSuite) TestBuildOnDisabledBridgeNetworkDaemon(c *check.C) { +func (s *DockerDaemonSuite) TestBuildOnDisabledBridgeNetworkDaemon(c *testing.T) { s.d.StartWithBusybox(c, "-b=none", "--iptables=false") result := cli.BuildCmd(c, "busyboxs", cli.Daemon(s.d), @@ -2374,7 +2374,7 @@ func (s *DockerDaemonSuite) TestBuildOnDisabledBridgeNetworkDaemon(c *check.C) { } // Test case for #21976 -func (s *DockerDaemonSuite) TestDaemonDNSFlagsInHostMode(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonDNSFlagsInHostMode(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) s.d.StartWithBusybox(c, "--dns", "1.2.3.4", "--dns-search", "example.com", "--dns-opt", "timeout:3") @@ -2388,7 +2388,7 @@ func (s *DockerDaemonSuite) TestDaemonDNSFlagsInHostMode(c *check.C) { assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out)) } -func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) { +func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *testing.T) { conf, err := ioutil.TempFile("", "config-file-") assert.NilError(c, err) configName := conf.Name() @@ -2506,7 +2506,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) { assert.NilError(c, err, out) } -func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) { +func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *testing.T) { s.d.StartWithBusybox(c, "--add-runtime", "oci=runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") // Run with default runtime @@ -2565,7 +2565,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) { assert.NilError(c, err, out) } -func (s *DockerDaemonSuite) TestDaemonRestartWithAutoRemoveContainer(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartWithAutoRemoveContainer(c *testing.T) { s.d.StartWithBusybox(c) // top1 will exist after daemon restarts @@ -2589,7 +2589,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithAutoRemoveContainer(c *check.C) assert.Assert(c, out, checker.Not(checker.Contains), "top2", check.Commentf("top2 should be removed after daemon restarts")) } -func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *testing.T) { s.d.StartWithBusybox(c) containerName := "error-values" @@ -2630,7 +2630,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) { assert.Equal(c, out, errMsg1) } -func (s *DockerDaemonSuite) TestDaemonWithUserlandProxyPath(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonWithUserlandProxyPath(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) dockerProxyPath, err := exec.LookPath("docker-proxy") @@ -2661,7 +2661,7 @@ func (s *DockerDaemonSuite) TestDaemonWithUserlandProxyPath(c *check.C) { } // Test case for #22471 -func (s *DockerDaemonSuite) TestDaemonShutdownTimeout(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonShutdownTimeout(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) s.d.StartWithBusybox(c, "--shutdown-timeout=3") @@ -2682,7 +2682,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownTimeout(c *check.C) { } // Test case for #22471 -func (s *DockerDaemonSuite) TestDaemonShutdownTimeoutWithConfigFile(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonShutdownTimeoutWithConfigFile(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) // daemon config file @@ -2716,7 +2716,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownTimeoutWithConfigFile(c *check.C) } // Test case for 29342 -func (s *DockerDaemonSuite) TestExecWithUserAfterLiveRestore(c *check.C) { +func (s *DockerDaemonSuite) TestExecWithUserAfterLiveRestore(c *testing.T) { testRequires(c, DaemonIsLinux) s.d.StartWithBusybox(c, "--live-restore") @@ -2744,7 +2744,7 @@ func (s *DockerDaemonSuite) TestExecWithUserAfterLiveRestore(c *check.C) { assert.NilError(c, err, "Output: %s", out) } -func (s *DockerDaemonSuite) TestRemoveContainerAfterLiveRestore(c *check.C) { +func (s *DockerDaemonSuite) TestRemoveContainerAfterLiveRestore(c *testing.T) { testRequires(c, DaemonIsLinux, overlayFSSupported, testEnv.IsLocalDaemon) s.d.StartWithBusybox(c, "--live-restore", "--storage-driver", "overlay") out, err := s.d.Cmd("run", "-d", "--name=top", "busybox", "top") @@ -2777,7 +2777,7 @@ func (s *DockerDaemonSuite) TestRemoveContainerAfterLiveRestore(c *check.C) { } // #29598 -func (s *DockerDaemonSuite) TestRestartPolicyWithLiveRestore(c *check.C) { +func (s *DockerDaemonSuite) TestRestartPolicyWithLiveRestore(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) s.d.StartWithBusybox(c, "--live-restore") @@ -2834,7 +2834,7 @@ func (s *DockerDaemonSuite) TestRestartPolicyWithLiveRestore(c *check.C) { assert.NilError(c, err, "Output: %s", out) } -func (s *DockerDaemonSuite) TestShmSize(c *check.C) { +func (s *DockerDaemonSuite) TestShmSize(c *testing.T) { testRequires(c, DaemonIsLinux) size := 67108864 * 2 @@ -2851,7 +2851,7 @@ func (s *DockerDaemonSuite) TestShmSize(c *check.C) { assert.Assert(c, strings.TrimSpace(out), check.Equals, fmt.Sprintf("%v", size)) } -func (s *DockerDaemonSuite) TestShmSizeReload(c *check.C) { +func (s *DockerDaemonSuite) TestShmSizeReload(c *testing.T) { testRequires(c, DaemonIsLinux) configPath, err := ioutil.TempDir("", "test-daemon-shm-size-reload-config") @@ -2891,7 +2891,7 @@ func (s *DockerDaemonSuite) TestShmSizeReload(c *check.C) { assert.Assert(c, strings.TrimSpace(out), check.Equals, fmt.Sprintf("%v", size)) } -func testDaemonStartIpcMode(c *check.C, from, mode string, valid bool) { +func testDaemonStartIpcMode(c *testing.T, from, mode string, valid bool) { d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) c.Logf("Checking IpcMode %s set from %s\n", mode, from) var serr error @@ -2926,7 +2926,7 @@ func testDaemonStartIpcMode(c *check.C, from, mode string, valid bool) { // TestDaemonStartWithIpcModes checks that daemon starts fine given correct // arguments for default IPC mode, and bails out with incorrect ones. // Both CLI option (--default-ipc-mode) and config parameter are tested. -func (s *DockerDaemonSuite) TestDaemonStartWithIpcModes(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonStartWithIpcModes(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) ipcModes := []struct { @@ -2950,7 +2950,7 @@ func (s *DockerDaemonSuite) TestDaemonStartWithIpcModes(c *check.C) { // TestFailedPluginRemove makes sure that a failed plugin remove does not block // the daemon from starting -func (s *DockerDaemonSuite) TestFailedPluginRemove(c *check.C) { +func (s *DockerDaemonSuite) TestFailedPluginRemove(c *testing.T) { testRequires(c, DaemonIsLinux, IsAmd64, testEnv.IsLocalDaemon) d := daemon.New(c, dockerBinary, dockerdBinary) d.Start(c) diff --git a/integration-cli/docker_cli_events_test.go b/integration-cli/docker_cli_events_test.go index 611ae3c7d2..9f611cdcbb 100644 --- a/integration-cli/docker_cli_events_test.go +++ b/integration-cli/docker_cli_events_test.go @@ -25,7 +25,7 @@ import ( "gotest.tools/icmd" ) -func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) { +func (s *DockerSuite) TestEventsTimestampFormats(c *testing.T) { name := "events-time-format-test" // Start stopwatch, generate an event @@ -54,7 +54,7 @@ func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) { } } -func (s *DockerSuite) TestEventsUntag(c *check.C) { +func (s *DockerSuite) TestEventsUntag(c *testing.T) { image := "busybox" dockerCmd(c, "tag", image, "utest:tag1") dockerCmd(c, "tag", image, "utest:tag2") @@ -77,7 +77,7 @@ func (s *DockerSuite) TestEventsUntag(c *check.C) { } } -func (s *DockerSuite) TestEventsContainerEvents(c *check.C) { +func (s *DockerSuite) TestEventsContainerEvents(c *testing.T) { dockerCmd(c, "run", "--rm", "--name", "container-events-test", "busybox", "true") out, _ := dockerCmd(c, "events", "--until", daemonUnixTime(c)) @@ -89,7 +89,7 @@ func (s *DockerSuite) TestEventsContainerEvents(c *check.C) { assert.Assert(c, is.DeepEqual(containerEvents[:5], []string{"create", "attach", "start", "die", "destroy"}), out) } -func (s *DockerSuite) TestEventsContainerEventsAttrSort(c *check.C) { +func (s *DockerSuite) TestEventsContainerEventsAttrSort(c *testing.T) { since := daemonUnixTime(c) dockerCmd(c, "run", "--rm", "--name", "container-events-test", "busybox", "true") @@ -113,7 +113,7 @@ func (s *DockerSuite) TestEventsContainerEventsAttrSort(c *check.C) { assert.Equal(c, matchedEvents, 2, "missing events for container container-events-test:\n%s", out) } -func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *check.C) { +func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *testing.T) { dockerCmd(c, "run", "--rm", "--name", "since-epoch-test", "busybox", "true") timeBeginning := time.Unix(0, 0).Format(time.RFC3339Nano) timeBeginning = strings.Replace(timeBeginning, "Z", ".000000000Z", -1) @@ -127,7 +127,7 @@ func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *check.C) { assert.Assert(c, is.DeepEqual(containerEvents, []string{"create", "attach", "start", "die", "destroy"}), out) } -func (s *DockerSuite) TestEventsImageTag(c *check.C) { +func (s *DockerSuite) TestEventsImageTag(c *testing.T) { time.Sleep(1 * time.Second) // because API has seconds granularity since := daemonUnixTime(c) image := "testimageevents:tag" @@ -145,7 +145,7 @@ func (s *DockerSuite) TestEventsImageTag(c *check.C) { assert.Equal(c, matches["action"], "tag") } -func (s *DockerSuite) TestEventsImagePull(c *check.C) { +func (s *DockerSuite) TestEventsImagePull(c *testing.T) { // TODO Windows: Enable this test once pull and reliable image names are available testRequires(c, DaemonIsLinux) since := daemonUnixTime(c) @@ -163,7 +163,7 @@ func (s *DockerSuite) TestEventsImagePull(c *check.C) { assert.Equal(c, matches["action"], "pull") } -func (s *DockerSuite) TestEventsImageImport(c *check.C) { +func (s *DockerSuite) TestEventsImageImport(c *testing.T) { // TODO Windows CI. This should be portable once export/import are // more reliable (@swernli) testRequires(c, DaemonIsLinux) @@ -187,7 +187,7 @@ func (s *DockerSuite) TestEventsImageImport(c *check.C) { assert.Equal(c, matches["action"], "import", "matches: %v\nout:\n%s\n", matches, out) } -func (s *DockerSuite) TestEventsImageLoad(c *check.C) { +func (s *DockerSuite) TestEventsImageLoad(c *testing.T) { testRequires(c, DaemonIsLinux) myImageName := "footest:v1" dockerCmd(c, "tag", "busybox", myImageName) @@ -226,7 +226,7 @@ func (s *DockerSuite) TestEventsImageLoad(c *check.C) { assert.Equal(c, matches["action"], "save", "matches: %v\nout:\n%s\n", matches, out) } -func (s *DockerSuite) TestEventsPluginOps(c *check.C) { +func (s *DockerSuite) TestEventsPluginOps(c *testing.T) { testRequires(c, DaemonIsLinux, IsAmd64, Network) since := daemonUnixTime(c) @@ -245,7 +245,7 @@ func (s *DockerSuite) TestEventsPluginOps(c *check.C) { assert.Assert(c, is.DeepEqual(pluginEvents, []string{"pull", "enable", "disable", "remove"}), out) } -func (s *DockerSuite) TestEventsFilters(c *check.C) { +func (s *DockerSuite) TestEventsFilters(c *testing.T) { since := daemonUnixTime(c) dockerCmd(c, "run", "--rm", "busybox", "true") dockerCmd(c, "run", "--rm", "busybox", "true") @@ -260,7 +260,7 @@ func (s *DockerSuite) TestEventsFilters(c *check.C) { assert.Assert(c, count >= 2, "should have had 2 start events but had %d, out: %s", count, out) } -func (s *DockerSuite) TestEventsFilterImageName(c *check.C) { +func (s *DockerSuite) TestEventsFilterImageName(c *testing.T) { since := daemonUnixTime(c) out, _ := dockerCmd(c, "run", "--name", "container_1", "-d", "busybox:latest", "true") @@ -288,7 +288,7 @@ func (s *DockerSuite) TestEventsFilterImageName(c *check.C) { assert.Assert(c, count2 != 0, "Expected event from container but got %d from %s", count2, container2) } -func (s *DockerSuite) TestEventsFilterLabels(c *check.C) { +func (s *DockerSuite) TestEventsFilterLabels(c *testing.T) { since := strconv.FormatUint(uint64(daemonTime(c).Unix()), 10) label := "io.docker.testing=foo" @@ -323,7 +323,7 @@ func (s *DockerSuite) TestEventsFilterLabels(c *check.C) { assert.Assert(c, found) } -func (s *DockerSuite) TestEventsFilterImageLabels(c *check.C) { +func (s *DockerSuite) TestEventsFilterImageLabels(c *testing.T) { since := daemonUnixTime(c) name := "labelfiltertest" label := "io.docker.testing=image" @@ -353,7 +353,7 @@ func (s *DockerSuite) TestEventsFilterImageLabels(c *check.C) { } } -func (s *DockerSuite) TestEventsFilterContainer(c *check.C) { +func (s *DockerSuite) TestEventsFilterContainer(c *testing.T) { since := daemonUnixTime(c) nameID := make(map[string]string) @@ -391,7 +391,7 @@ func (s *DockerSuite) TestEventsFilterContainer(c *check.C) { } } -func (s *DockerSuite) TestEventsCommit(c *check.C) { +func (s *DockerSuite) TestEventsCommit(c *testing.T) { // Problematic on Windows as cannot commit a running container testRequires(c, DaemonIsLinux) @@ -408,7 +408,7 @@ func (s *DockerSuite) TestEventsCommit(c *check.C) { assert.Assert(c, strings.Contains(out, "commit"), "Missing 'commit' log event") } -func (s *DockerSuite) TestEventsCopy(c *check.C) { +func (s *DockerSuite) TestEventsCopy(c *testing.T) { // Build a test image. buildImageSuccessfully(c, "cpimg", build.WithDockerfile(` FROM busybox @@ -437,7 +437,7 @@ func (s *DockerSuite) TestEventsCopy(c *check.C) { assert.Assert(c, strings.Contains(out, "extract-to-dir"), "Missing 'extract-to-dir' log event") } -func (s *DockerSuite) TestEventsResize(c *check.C) { +func (s *DockerSuite) TestEventsResize(c *testing.T) { out := runSleepingContainer(c, "-d") cID := strings.TrimSpace(out) assert.NilError(c, waitRun(cID)) @@ -460,7 +460,7 @@ func (s *DockerSuite) TestEventsResize(c *check.C) { assert.Assert(c, strings.Contains(out, "resize"), "Missing 'resize' log event") } -func (s *DockerSuite) TestEventsAttach(c *check.C) { +func (s *DockerSuite) TestEventsAttach(c *testing.T) { // TODO Windows CI: Figure out why this test fails intermittently (TP5). testRequires(c, DaemonIsLinux) @@ -498,7 +498,7 @@ func (s *DockerSuite) TestEventsAttach(c *check.C) { assert.Assert(c, strings.Contains(out, "attach"), "Missing 'attach' log event") } -func (s *DockerSuite) TestEventsRename(c *check.C) { +func (s *DockerSuite) TestEventsRename(c *testing.T) { out, _ := dockerCmd(c, "run", "--name", "oldName", "busybox", "true") cID := strings.TrimSpace(out) dockerCmd(c, "rename", "oldName", "newName") @@ -509,7 +509,7 @@ func (s *DockerSuite) TestEventsRename(c *check.C) { assert.Assert(c, strings.Contains(out, "rename"), "Missing 'rename' log event") } -func (s *DockerSuite) TestEventsTop(c *check.C) { +func (s *DockerSuite) TestEventsTop(c *testing.T) { // Problematic on Windows as Windows does not support top testRequires(c, DaemonIsLinux) @@ -526,7 +526,7 @@ func (s *DockerSuite) TestEventsTop(c *check.C) { } // #14316 -func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *check.C) { +func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *testing.T) { // Problematic to port for Windows CI during TP5 timeframe until // supporting push testRequires(c, DaemonIsLinux) @@ -546,7 +546,7 @@ func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *check.C) { assert.Assert(c, strings.Contains(out, repoName), "Missing 'push' log event for %s", repoName) } -func (s *DockerSuite) TestEventsFilterType(c *check.C) { +func (s *DockerSuite) TestEventsFilterType(c *testing.T) { // FIXME(vdemeester) fails on e2e run testRequires(c, testEnv.IsLocalDaemon) since := daemonUnixTime(c) @@ -600,7 +600,7 @@ func (s *DockerSuite) TestEventsFilterType(c *check.C) { } // #25798 -func (s *DockerSuite) TestEventsSpecialFiltersWithExecCreate(c *check.C) { +func (s *DockerSuite) TestEventsSpecialFiltersWithExecCreate(c *testing.T) { since := daemonUnixTime(c) runSleepingContainer(c, "--name", "test-container", "-d") waitRun("test-container") @@ -630,7 +630,7 @@ func (s *DockerSuite) TestEventsSpecialFiltersWithExecCreate(c *check.C) { assert.Equal(c, len(events), 1, out) } -func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *check.C) { +func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *testing.T) { since := daemonUnixTime(c) dockerCmd(c, "run", "--name", "test-container", "-d", "busybox", "true") waitRun("test-container") @@ -640,7 +640,7 @@ func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *check.C) { assert.Assert(c, len(events) > 1, out) } -func (s *DockerSuite) TestEventsContainerRestart(c *check.C) { +func (s *DockerSuite) TestEventsContainerRestart(c *testing.T) { dockerCmd(c, "run", "-d", "--name=testEvent", "--restart=on-failure:3", "busybox", "false") // wait until test2 is auto removed. @@ -680,7 +680,7 @@ func (s *DockerSuite) TestEventsContainerRestart(c *check.C) { assert.Equal(c, dieCount, 4, "testEvent should die 4 times: %v", actions) } -func (s *DockerSuite) TestEventsSinceInTheFuture(c *check.C) { +func (s *DockerSuite) TestEventsSinceInTheFuture(c *testing.T) { dockerCmd(c, "run", "--name", "test-container", "-d", "busybox", "true") waitRun("test-container") @@ -692,7 +692,7 @@ func (s *DockerSuite) TestEventsSinceInTheFuture(c *check.C) { assert.Assert(c, strings.Contains(out, "cannot be after `until`")) } -func (s *DockerSuite) TestEventsUntilInThePast(c *check.C) { +func (s *DockerSuite) TestEventsUntilInThePast(c *testing.T) { since := daemonUnixTime(c) dockerCmd(c, "run", "--name", "test-container", "-d", "busybox", "true") @@ -709,7 +709,7 @@ func (s *DockerSuite) TestEventsUntilInThePast(c *check.C) { assert.Assert(c, strings.Contains(out, "test-container")) } -func (s *DockerSuite) TestEventsFormat(c *check.C) { +func (s *DockerSuite) TestEventsFormat(c *testing.T) { since := daemonUnixTime(c) dockerCmd(c, "run", "--rm", "busybox", "true") dockerCmd(c, "run", "--rm", "busybox", "true") @@ -732,7 +732,7 @@ func (s *DockerSuite) TestEventsFormat(c *check.C) { assert.Equal(c, startCount, 2, "should have had 2 start events but had %d, out: %s", startCount, out) } -func (s *DockerSuite) TestEventsFormatBadFunc(c *check.C) { +func (s *DockerSuite) TestEventsFormatBadFunc(c *testing.T) { // make sure it fails immediately, without receiving any event result := dockerCmdWithResult("events", "--format", "{{badFuncString .}}") result.Assert(c, icmd.Expected{ @@ -742,7 +742,7 @@ func (s *DockerSuite) TestEventsFormatBadFunc(c *check.C) { }) } -func (s *DockerSuite) TestEventsFormatBadField(c *check.C) { +func (s *DockerSuite) TestEventsFormatBadField(c *testing.T) { // make sure it fails immediately, without receiving any event result := dockerCmdWithResult("events", "--format", "{{.badFieldString}}") result.Assert(c, icmd.Expected{ diff --git a/integration-cli/docker_cli_events_unix_test.go b/integration-cli/docker_cli_events_unix_test.go index 44252c9ac6..04abed1ae3 100644 --- a/integration-cli/docker_cli_events_unix_test.go +++ b/integration-cli/docker_cli_events_unix_test.go @@ -21,7 +21,7 @@ import ( ) // #5979 -func (s *DockerSuite) TestEventsRedirectStdout(c *check.C) { +func (s *DockerSuite) TestEventsRedirectStdout(c *testing.T) { since := daemonUnixTime(c) dockerCmd(c, "run", "busybox", "true") @@ -47,7 +47,7 @@ func (s *DockerSuite) TestEventsRedirectStdout(c *check.C) { assert.NilError(c, scanner.Err(), "Scan err for command %q", command) } -func (s *DockerSuite) TestEventsOOMDisableFalse(c *check.C) { +func (s *DockerSuite) TestEventsOOMDisableFalse(c *testing.T) { testRequires(c, DaemonIsLinux, oomControl, memoryLimitSupport, swapMemorySupport, NotPpc64le) errChan := make(chan error) @@ -77,7 +77,7 @@ func (s *DockerSuite) TestEventsOOMDisableFalse(c *check.C) { assert.Equal(c, parseEventAction(c, events[nEvents-1]), "die") } -func (s *DockerSuite) TestEventsOOMDisableTrue(c *check.C) { +func (s *DockerSuite) TestEventsOOMDisableTrue(c *testing.T) { testRequires(c, DaemonIsLinux, oomControl, memoryLimitSupport, NotArm, swapMemorySupport, NotPpc64le) errChan := make(chan error) @@ -125,7 +125,7 @@ func (s *DockerSuite) TestEventsOOMDisableTrue(c *check.C) { } // #18453 -func (s *DockerSuite) TestEventsContainerFilterByName(c *check.C) { +func (s *DockerSuite) TestEventsContainerFilterByName(c *testing.T) { testRequires(c, DaemonIsLinux) cOut, _ := dockerCmd(c, "run", "--name=foo", "-d", "busybox", "top") c1 := strings.TrimSpace(cOut) @@ -139,7 +139,7 @@ func (s *DockerSuite) TestEventsContainerFilterByName(c *check.C) { } // #18453 -func (s *DockerSuite) TestEventsContainerFilterBeforeCreate(c *check.C) { +func (s *DockerSuite) TestEventsContainerFilterBeforeCreate(c *testing.T) { testRequires(c, DaemonIsLinux) buf := &bytes.Buffer{} cmd := exec.Command(dockerBinary, "events", "-f", "container=foo", "--since=0") @@ -164,7 +164,7 @@ func (s *DockerSuite) TestEventsContainerFilterBeforeCreate(c *check.C) { } } -func (s *DockerSuite) TestVolumeEvents(c *check.C) { +func (s *DockerSuite) TestVolumeEvents(c *testing.T) { testRequires(c, DaemonIsLinux) since := daemonUnixTime(c) @@ -192,7 +192,7 @@ func (s *DockerSuite) TestVolumeEvents(c *check.C) { assert.Equal(c, volumeEvents[4], "destroy") } -func (s *DockerSuite) TestNetworkEvents(c *check.C) { +func (s *DockerSuite) TestNetworkEvents(c *testing.T) { testRequires(c, DaemonIsLinux) since := daemonUnixTime(c) @@ -219,7 +219,7 @@ func (s *DockerSuite) TestNetworkEvents(c *check.C) { assert.Equal(c, netEvents[3], "destroy") } -func (s *DockerSuite) TestEventsContainerWithMultiNetwork(c *check.C) { +func (s *DockerSuite) TestEventsContainerWithMultiNetwork(c *testing.T) { testRequires(c, DaemonIsLinux) // Observe create/connect network actions @@ -247,7 +247,7 @@ func (s *DockerSuite) TestEventsContainerWithMultiNetwork(c *check.C) { assert.Assert(c, strings.Contains(out, "test-event-network-local-2")) } -func (s *DockerSuite) TestEventsStreaming(c *check.C) { +func (s *DockerSuite) TestEventsStreaming(c *testing.T) { testRequires(c, DaemonIsLinux) observer, err := newEventObserver(c) @@ -301,7 +301,7 @@ func (s *DockerSuite) TestEventsStreaming(c *check.C) { } } -func (s *DockerSuite) TestEventsImageUntagDelete(c *check.C) { +func (s *DockerSuite) TestEventsImageUntagDelete(c *testing.T) { testRequires(c, DaemonIsLinux) observer, err := newEventObserver(c) @@ -340,7 +340,7 @@ func (s *DockerSuite) TestEventsImageUntagDelete(c *check.C) { } } -func (s *DockerSuite) TestEventsFilterVolumeAndNetworkType(c *check.C) { +func (s *DockerSuite) TestEventsFilterVolumeAndNetworkType(c *testing.T) { testRequires(c, DaemonIsLinux) since := daemonUnixTime(c) @@ -359,7 +359,7 @@ func (s *DockerSuite) TestEventsFilterVolumeAndNetworkType(c *check.C) { assert.Equal(c, networkActions[0], "create") } -func (s *DockerSuite) TestEventsFilterVolumeID(c *check.C) { +func (s *DockerSuite) TestEventsFilterVolumeID(c *testing.T) { testRequires(c, DaemonIsLinux) since := daemonUnixTime(c) @@ -374,7 +374,7 @@ func (s *DockerSuite) TestEventsFilterVolumeID(c *check.C) { assert.Assert(c, strings.Contains(events[0], "driver=local")) } -func (s *DockerSuite) TestEventsFilterNetworkID(c *check.C) { +func (s *DockerSuite) TestEventsFilterNetworkID(c *testing.T) { testRequires(c, DaemonIsLinux) since := daemonUnixTime(c) @@ -387,7 +387,7 @@ func (s *DockerSuite) TestEventsFilterNetworkID(c *check.C) { assert.Assert(c, strings.Contains(events[0], "type=bridge")) } -func (s *DockerDaemonSuite) TestDaemonEvents(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonEvents(c *testing.T) { // daemon config file configFilePath := "test.json" @@ -455,7 +455,7 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *check.C) { } } -func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *testing.T) { // daemon config file configFilePath := "test.json" diff --git a/integration-cli/docker_cli_exec_test.go b/integration-cli/docker_cli_exec_test.go index 72fa092824..8c0954717a 100644 --- a/integration-cli/docker_cli_exec_test.go +++ b/integration-cli/docker_cli_exec_test.go @@ -22,7 +22,7 @@ import ( "gotest.tools/icmd" ) -func (s *DockerSuite) TestExec(c *check.C) { +func (s *DockerSuite) TestExec(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top") assert.NilError(c, waitRun(strings.TrimSpace(out))) @@ -31,7 +31,7 @@ func (s *DockerSuite) TestExec(c *check.C) { assert.Equal(c, strings.Trim(out, "\r\n"), "test") } -func (s *DockerSuite) TestExecInteractive(c *check.C) { +func (s *DockerSuite) TestExecInteractive(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top") @@ -67,7 +67,7 @@ func (s *DockerSuite) TestExecInteractive(c *check.C) { } -func (s *DockerSuite) TestExecAfterContainerRestart(c *check.C) { +func (s *DockerSuite) TestExecAfterContainerRestart(c *testing.T) { out := runSleepingContainer(c) cleanedContainerID := strings.TrimSpace(out) assert.NilError(c, waitRun(cleanedContainerID)) @@ -78,7 +78,7 @@ func (s *DockerSuite) TestExecAfterContainerRestart(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "hello") } -func (s *DockerDaemonSuite) TestExecAfterDaemonRestart(c *check.C) { +func (s *DockerDaemonSuite) TestExecAfterDaemonRestart(c *testing.T) { // TODO Windows CI: DockerDaemonSuite doesn't run on Windows, and requires a little work to get this ported. s.d.StartWithBusybox(c) @@ -96,7 +96,7 @@ func (s *DockerDaemonSuite) TestExecAfterDaemonRestart(c *check.C) { } // Regression test for #9155, #9044 -func (s *DockerSuite) TestExecEnv(c *check.C) { +func (s *DockerSuite) TestExecEnv(c *testing.T) { // TODO Windows CI: This one is interesting and may just end up being a feature // difference between Windows and Linux. On Windows, the environment is passed // into the process that is launched, not into the machine environment. Hence @@ -111,7 +111,7 @@ func (s *DockerSuite) TestExecEnv(c *check.C) { assert.Check(c, strings.Contains(out, "HOME=/root")) } -func (s *DockerSuite) TestExecSetEnv(c *check.C) { +func (s *DockerSuite) TestExecSetEnv(c *testing.T) { testRequires(c, DaemonIsLinux) runSleepingContainer(c, "-e", "HOME=/root", "-d", "--name", "testing") assert.NilError(c, waitRun("testing")) @@ -122,14 +122,14 @@ func (s *DockerSuite) TestExecSetEnv(c *check.C) { assert.Check(c, strings.Contains(out, "ABC=xyz")) } -func (s *DockerSuite) TestExecExitStatus(c *check.C) { +func (s *DockerSuite) TestExecExitStatus(c *testing.T) { runSleepingContainer(c, "-d", "--name", "top") result := icmd.RunCommand(dockerBinary, "exec", "top", "sh", "-c", "exit 23") result.Assert(c, icmd.Expected{ExitCode: 23, Error: "exit status 23"}) } -func (s *DockerSuite) TestExecPausedContainer(c *check.C) { +func (s *DockerSuite) TestExecPausedContainer(c *testing.T) { testRequires(c, IsPausable) out := runSleepingContainer(c, "-d", "--name", "testing") @@ -144,7 +144,7 @@ func (s *DockerSuite) TestExecPausedContainer(c *check.C) { } // regression test for #9476 -func (s *DockerSuite) TestExecTTYCloseStdin(c *check.C) { +func (s *DockerSuite) TestExecTTYCloseStdin(c *testing.T) { // TODO Windows CI: This requires some work to port to Windows. testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "-d", "-it", "--name", "exec_tty_stdin", "busybox") @@ -165,7 +165,7 @@ func (s *DockerSuite) TestExecTTYCloseStdin(c *check.C) { assert.Assert(c, !strings.Contains(out, "nsenter-exec")) } -func (s *DockerSuite) TestExecTTYWithoutStdin(c *check.C) { +func (s *DockerSuite) TestExecTTYWithoutStdin(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "-ti", "busybox") id := strings.TrimSpace(out) assert.NilError(c, waitRun(id)) @@ -202,7 +202,7 @@ func (s *DockerSuite) TestExecTTYWithoutStdin(c *check.C) { } // FIXME(vdemeester) this should be a unit tests on cli/command/container package -func (s *DockerSuite) TestExecParseError(c *check.C) { +func (s *DockerSuite) TestExecParseError(c *testing.T) { // TODO Windows CI: Requires some extra work. Consider copying the // runSleepingContainer helper to have an exec version. testRequires(c, DaemonIsLinux) @@ -216,7 +216,7 @@ func (s *DockerSuite) TestExecParseError(c *check.C) { }) } -func (s *DockerSuite) TestExecStopNotHanging(c *check.C) { +func (s *DockerSuite) TestExecStopNotHanging(c *testing.T) { // TODO Windows CI: Requires some extra work. Consider copying the // runSleepingContainer helper to have an exec version. testRequires(c, DaemonIsLinux) @@ -244,7 +244,7 @@ func (s *DockerSuite) TestExecStopNotHanging(c *check.C) { } } -func (s *DockerSuite) TestExecCgroup(c *check.C) { +func (s *DockerSuite) TestExecCgroup(c *testing.T) { // Not applicable on Windows - using Linux specific functionality testRequires(c, NotUserNamespace) testRequires(c, DaemonIsLinux) @@ -297,7 +297,7 @@ func (s *DockerSuite) TestExecCgroup(c *check.C) { } } -func (s *DockerSuite) TestExecInspectID(c *check.C) { +func (s *DockerSuite) TestExecInspectID(c *testing.T) { out := runSleepingContainer(c, "-d") id := strings.TrimSuffix(out, "\n") @@ -364,7 +364,7 @@ func (s *DockerSuite) TestExecInspectID(c *check.C) { assert.ErrorContains(c, err, "No such exec instance") } -func (s *DockerSuite) TestLinksPingLinkedContainersOnRename(c *check.C) { +func (s *DockerSuite) TestLinksPingLinkedContainersOnRename(c *testing.T) { // Problematic on Windows as Windows does not support links testRequires(c, DaemonIsLinux) var out string @@ -380,7 +380,7 @@ func (s *DockerSuite) TestLinksPingLinkedContainersOnRename(c *check.C) { dockerCmd(c, "exec", "container2", "ping", "-c", "1", "alias1", "-W", "1") } -func (s *DockerSuite) TestRunMutableNetworkFiles(c *check.C) { +func (s *DockerSuite) TestRunMutableNetworkFiles(c *testing.T) { // Not applicable on Windows to Windows CI. testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) for _, fn := range []string{"resolv.conf", "hosts"} { @@ -421,7 +421,7 @@ func (s *DockerSuite) TestRunMutableNetworkFiles(c *check.C) { } } -func (s *DockerSuite) TestExecWithUser(c *check.C) { +func (s *DockerSuite) TestExecWithUser(c *testing.T) { // TODO Windows CI: This may be fixable in the future once Windows // supports users testRequires(c, DaemonIsLinux) @@ -434,7 +434,7 @@ func (s *DockerSuite) TestExecWithUser(c *check.C) { assert.Assert(c, strings.Contains(out, "uid=0(root) gid=0(root)"), "exec with user by id expected daemon user got %s", out) } -func (s *DockerSuite) TestExecWithPrivileged(c *check.C) { +func (s *DockerSuite) TestExecWithPrivileged(c *testing.T) { // Not applicable on Windows testRequires(c, DaemonIsLinux, NotUserNamespace) // Start main loop which attempts mknod repeatedly @@ -464,7 +464,7 @@ func (s *DockerSuite) TestExecWithPrivileged(c *check.C) { assert.Assert(c, !strings.Contains(result.Combined(), "Success")) } -func (s *DockerSuite) TestExecWithImageUser(c *check.C) { +func (s *DockerSuite) TestExecWithImageUser(c *testing.T) { // Not applicable on Windows testRequires(c, DaemonIsLinux) name := "testbuilduser" @@ -477,7 +477,7 @@ func (s *DockerSuite) TestExecWithImageUser(c *check.C) { assert.Assert(c, strings.Contains(out, "dockerio"), "exec with user by id expected dockerio user got %s", out) } -func (s *DockerSuite) TestExecOnReadonlyContainer(c *check.C) { +func (s *DockerSuite) TestExecOnReadonlyContainer(c *testing.T) { // Windows does not support read-only // --read-only + userns has remount issues testRequires(c, DaemonIsLinux, NotUserNamespace) @@ -485,7 +485,7 @@ func (s *DockerSuite) TestExecOnReadonlyContainer(c *check.C) { dockerCmd(c, "exec", "parent", "true") } -func (s *DockerSuite) TestExecUlimits(c *check.C) { +func (s *DockerSuite) TestExecUlimits(c *testing.T) { testRequires(c, DaemonIsLinux) name := "testexeculimits" runSleepingContainer(c, "-d", "--ulimit", "nofile=511:511", "--name", name) @@ -497,7 +497,7 @@ func (s *DockerSuite) TestExecUlimits(c *check.C) { } // #15750 -func (s *DockerSuite) TestExecStartFails(c *check.C) { +func (s *DockerSuite) TestExecStartFails(c *testing.T) { // TODO Windows CI. This test should be portable. Figure out why it fails // currently. testRequires(c, DaemonIsLinux) @@ -511,7 +511,7 @@ func (s *DockerSuite) TestExecStartFails(c *check.C) { } // Fix regression in https://github.com/docker/docker/pull/26461#issuecomment-250287297 -func (s *DockerSuite) TestExecWindowsPathNotWiped(c *check.C) { +func (s *DockerSuite) TestExecWindowsPathNotWiped(c *testing.T) { testRequires(c, DaemonIsWindows) out, _ := dockerCmd(c, "run", "-d", "--name", "testing", minimalBaseImage(), "powershell", "start-sleep", "60") assert.NilError(c, waitRun(strings.TrimSpace(out))) @@ -521,7 +521,7 @@ func (s *DockerSuite) TestExecWindowsPathNotWiped(c *check.C) { assert.Assert(c, strings.Contains(out, `windowspowershell\v1.0`)) } -func (s *DockerSuite) TestExecEnvLinksHost(c *check.C) { +func (s *DockerSuite) TestExecEnvLinksHost(c *testing.T) { testRequires(c, DaemonIsLinux) runSleepingContainer(c, "-d", "--name", "foo") runSleepingContainer(c, "-d", "--link", "foo:db", "--hostname", "myhost", "--name", "bar") diff --git a/integration-cli/docker_cli_exec_unix_test.go b/integration-cli/docker_cli_exec_unix_test.go index f2f89f2be0..1f145325b5 100644 --- a/integration-cli/docker_cli_exec_unix_test.go +++ b/integration-cli/docker_cli_exec_unix_test.go @@ -15,7 +15,7 @@ import ( ) // regression test for #12546 -func (s *DockerSuite) TestExecInteractiveStdinClose(c *check.C) { +func (s *DockerSuite) TestExecInteractiveStdinClose(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat") contID := strings.TrimSpace(out) @@ -44,7 +44,7 @@ func (s *DockerSuite) TestExecInteractiveStdinClose(c *check.C) { } } -func (s *DockerSuite) TestExecTTY(c *check.C) { +func (s *DockerSuite) TestExecTTY(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) dockerCmd(c, "run", "-d", "--name=test", "busybox", "sh", "-c", "echo hello > /foo && top") @@ -74,7 +74,7 @@ func (s *DockerSuite) TestExecTTY(c *check.C) { } // Test the TERM env var is set when -t is provided on exec -func (s *DockerSuite) TestExecWithTERM(c *check.C) { +func (s *DockerSuite) TestExecWithTERM(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) out, _ := dockerCmd(c, "run", "-id", "busybox", "/bin/cat") contID := strings.TrimSpace(out) @@ -86,7 +86,7 @@ func (s *DockerSuite) TestExecWithTERM(c *check.C) { // Test that the TERM env var is not set on exec when -t is not provided, even if it was set // on run -func (s *DockerSuite) TestExecWithNoTERM(c *check.C) { +func (s *DockerSuite) TestExecWithNoTERM(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat") contID := strings.TrimSpace(out) diff --git a/integration-cli/docker_cli_external_volume_driver_unix_test.go b/integration-cli/docker_cli_external_volume_driver_unix_test.go index 9b0744b6b4..a391c62eac 100644 --- a/integration-cli/docker_cli_external_volume_driver_unix_test.go +++ b/integration-cli/docker_cli_external_volume_driver_unix_test.go @@ -51,20 +51,20 @@ type DockerExternalVolumeSuite struct { *volumePlugin } -func (s *DockerExternalVolumeSuite) SetUpTest(c *check.C) { +func (s *DockerExternalVolumeSuite) SetUpTest(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) s.ec = &eventCounter{} } -func (s *DockerExternalVolumeSuite) TearDownTest(c *check.C) { +func (s *DockerExternalVolumeSuite) TearDownTest(c *testing.T) { if s.d != nil { s.d.Stop(c) s.ds.TearDownTest(c) } } -func (s *DockerExternalVolumeSuite) SetUpSuite(c *check.C) { +func (s *DockerExternalVolumeSuite) SetUpSuite(c *testing.T) { s.volumePlugin = newVolumePlugin(c, volumePluginName) } @@ -86,7 +86,7 @@ func (p *volumePlugin) Close() { p.Server.Close() } -func newVolumePlugin(c *check.C, name string) *volumePlugin { +func newVolumePlugin(c *testing.T, name string) *volumePlugin { mux := http.NewServeMux() s := &volumePlugin{Server: httptest.NewServer(mux), ec: &eventCounter{}, vols: make(map[string]vol)} @@ -276,14 +276,14 @@ func newVolumePlugin(c *check.C, name string) *volumePlugin { return s } -func (s *DockerExternalVolumeSuite) TearDownSuite(c *check.C) { +func (s *DockerExternalVolumeSuite) TearDownSuite(c *testing.T) { s.volumePlugin.Close() err := os.RemoveAll("/etc/docker/plugins") assert.NilError(c, err) } -func (s *DockerExternalVolumeSuite) TestVolumeCLICreateOptionConflict(c *check.C) { +func (s *DockerExternalVolumeSuite) TestVolumeCLICreateOptionConflict(c *testing.T) { dockerCmd(c, "volume", "create", "test") out, _, err := dockerCmdWithError("volume", "create", "test", "--driver", volumePluginName) @@ -295,7 +295,7 @@ func (s *DockerExternalVolumeSuite) TestVolumeCLICreateOptionConflict(c *check.C assert.NilError(c, err) } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test") @@ -317,7 +317,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *check.C) { assert.Assert(c, s.ec.unmounts, checker.Equals, 1) } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnnamed(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnnamed(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test") @@ -331,7 +331,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnnamed(c *check.C) assert.Assert(c, s.ec.unmounts, checker.Equals, 1) } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverVolumesFrom(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverVolumesFrom(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("run", "--name", "vol-test1", "-v", "/foo", "--volume-driver", volumePluginName, "busybox:latest") @@ -350,7 +350,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverVolumesFrom(c *check assert.Assert(c, s.ec.unmounts, checker.Equals, 2) } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverDeleteContainer(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverDeleteContainer(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("run", "--name", "vol-test1", "-v", "/foo", "--volume-driver", volumePluginName, "busybox:latest") @@ -371,7 +371,7 @@ func hostVolumePath(name string) string { } // Make sure a request to use a down driver doesn't block other requests -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverLookupNotBlocked(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverLookupNotBlocked(c *testing.T) { specPath := "/etc/docker/plugins/down-driver.spec" err := ioutil.WriteFile(specPath, []byte("tcp://127.0.0.7:9999"), 0644) assert.NilError(c, err) @@ -407,7 +407,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverLookupNotBlocked(c * } } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverRetryNotImmediatelyExists(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverRetryNotImmediatelyExists(c *testing.T) { s.d.StartWithBusybox(c) driverName := "test-external-volume-driver-retry" @@ -444,7 +444,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverRetryNotImmediatelyE assert.Assert(c, p.ec.unmounts, checker.Equals, 1) } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c *testing.T) { dockerCmd(c, "volume", "create", "-d", volumePluginName, "foo") dockerCmd(c, "run", "-d", "--name", "testing", "-v", "foo:/bar", "busybox", "top") @@ -459,7 +459,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c assert.Assert(c, mounts[0].Driver, checker.Equals, volumePluginName) } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverList(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverList(c *testing.T) { dockerCmd(c, "volume", "create", "-d", volumePluginName, "abc3") out, _ := dockerCmd(c, "volume", "ls") ls := strings.Split(strings.TrimSpace(out), "\n") @@ -473,7 +473,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverList(c *check.C) { assert.Assert(c, s.ec.lists, check.Equals, 1) } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *testing.T) { out, _, err := dockerCmdWithError("volume", "inspect", "dummy") assert.ErrorContains(c, err, "", out) assert.Assert(c, out, checker.Contains, "No such volume") @@ -493,7 +493,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *check.C) { assert.Assert(c, st[0].Status["Hello"], checker.Equals, "world", check.Commentf("%v", st[0].Status)) } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverWithDaemonRestart(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverWithDaemonRestart(c *testing.T) { dockerCmd(c, "volume", "create", "-d", volumePluginName, "abc1") s.d.Restart(c) @@ -506,7 +506,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverWithDaemonRestart(c // Ensures that the daemon handles when the plugin responds to a `Get` request with a null volume and a null error. // Prior the daemon would panic in this scenario. -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGetEmptyResponse(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGetEmptyResponse(c *testing.T) { s.d.Start(c) out, err := s.d.Cmd("volume", "create", "-d", volumePluginName, "abc2", "--opt", "ninja=1") @@ -521,7 +521,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGetEmptyResponse(c * // // TODO(@cpuguy83): This test is testing internal implementation. In all the cases here, there may not even be a path // available because the volume is not even mounted. Consider removing this test. -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverPathCalls(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverPathCalls(c *testing.T) { s.d.Start(c) assert.Assert(c, s.ec.paths, checker.Equals, 0) @@ -534,7 +534,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverPathCalls(c *check.C assert.Assert(c, s.ec.paths, checker.Equals, 0) } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverMountID(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverMountID(c *testing.T) { s.d.StartWithBusybox(c) out, err := s.d.Cmd("run", "--rm", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test") @@ -543,7 +543,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverMountID(c *check.C) } // Check that VolumeDriver.Capabilities gets called, and only called once -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverCapabilities(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverCapabilities(c *testing.T) { s.d.Start(c) assert.Assert(c, s.ec.caps, checker.Equals, 0) @@ -557,7 +557,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverCapabilities(c *chec } } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *testing.T) { driverName := stringid.GenerateRandomID() p := newVolumePlugin(c, driverName) defer p.Close() @@ -606,7 +606,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *c assert.Assert(c, vs[0].Driver, checker.Equals, "local") } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnMountFail(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnMountFail(c *testing.T) { s.d.StartWithBusybox(c) s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--opt=invalidOption=1", "--name=testumount") @@ -616,7 +616,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnMountFail(c assert.Assert(c, s.ec.unmounts, checker.Equals, 0, check.Commentf("%s", out)) } -func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *check.C) { +func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *testing.T) { s.d.StartWithBusybox(c) s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--name=test") diff --git a/integration-cli/docker_cli_health_test.go b/integration-cli/docker_cli_health_test.go index 08f23cc114..4f1df41c81 100644 --- a/integration-cli/docker_cli_health_test.go +++ b/integration-cli/docker_cli_health_test.go @@ -12,7 +12,7 @@ import ( "github.com/go-check/check" ) -func waitForHealthStatus(c *check.C, name string, prev string, expected string) { +func waitForHealthStatus(c *testing.T, name string, prev string, expected string) { prev = prev + "\n" expected = expected + "\n" for { @@ -28,7 +28,7 @@ func waitForHealthStatus(c *check.C, name string, prev string, expected string) } } -func getHealth(c *check.C, name string) *types.Health { +func getHealth(c *testing.T, name string) *types.Health { out, _ := dockerCmd(c, "inspect", "--format={{json .State.Health}}", name) var health types.Health err := json.Unmarshal([]byte(out), &health) @@ -36,7 +36,7 @@ func getHealth(c *check.C, name string) *types.Health { return &health } -func (s *DockerSuite) TestHealth(c *check.C) { +func (s *DockerSuite) TestHealth(c *testing.T) { testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows existingContainers := ExistingContainerIDs(c) @@ -144,7 +144,7 @@ func (s *DockerSuite) TestHealth(c *check.C) { } // GitHub #33021 -func (s *DockerSuite) TestUnsetEnvVarHealthCheck(c *check.C) { +func (s *DockerSuite) TestUnsetEnvVarHealthCheck(c *testing.T) { testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows imageName := "testhealth" diff --git a/integration-cli/docker_cli_history_test.go b/integration-cli/docker_cli_history_test.go index a6d6cccb72..bf16b260b6 100644 --- a/integration-cli/docker_cli_history_test.go +++ b/integration-cli/docker_cli_history_test.go @@ -13,7 +13,7 @@ import ( // This is a heisen-test. Because the created timestamp of images and the behavior of // sort is not predictable it doesn't always fail. -func (s *DockerSuite) TestBuildHistory(c *check.C) { +func (s *DockerSuite) TestBuildHistory(c *testing.T) { name := "testbuildhistory" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM `+minimalBaseImage()+` LABEL label.A="A" @@ -55,16 +55,16 @@ LABEL label.Z="Z"`)) } -func (s *DockerSuite) TestHistoryExistentImage(c *check.C) { +func (s *DockerSuite) TestHistoryExistentImage(c *testing.T) { dockerCmd(c, "history", "busybox") } -func (s *DockerSuite) TestHistoryNonExistentImage(c *check.C) { +func (s *DockerSuite) TestHistoryNonExistentImage(c *testing.T) { _, _, err := dockerCmdWithError("history", "testHistoryNonExistentImage") assert.Assert(c, err, checker.NotNil, check.Commentf("history on a non-existent image should fail.")) } -func (s *DockerSuite) TestHistoryImageWithComment(c *check.C) { +func (s *DockerSuite) TestHistoryImageWithComment(c *testing.T) { name := "testhistoryimagewithcomment" // make an image through docker commit [ -m messages ] @@ -83,7 +83,7 @@ func (s *DockerSuite) TestHistoryImageWithComment(c *check.C) { assert.Assert(c, actualValue, checker.Contains, comment) } -func (s *DockerSuite) TestHistoryHumanOptionFalse(c *check.C) { +func (s *DockerSuite) TestHistoryHumanOptionFalse(c *testing.T) { out, _ := dockerCmd(c, "history", "--human=false", "busybox") lines := strings.Split(out, "\n") sizeColumnRegex, _ := regexp.Compile("SIZE +") @@ -101,7 +101,7 @@ func (s *DockerSuite) TestHistoryHumanOptionFalse(c *check.C) { } } -func (s *DockerSuite) TestHistoryHumanOptionTrue(c *check.C) { +func (s *DockerSuite) TestHistoryHumanOptionTrue(c *testing.T) { out, _ := dockerCmd(c, "history", "--human=true", "busybox") lines := strings.Split(out, "\n") sizeColumnRegex, _ := regexp.Compile("SIZE +") diff --git a/integration-cli/docker_cli_images_test.go b/integration-cli/docker_cli_images_test.go index 6423b8ac20..011388d792 100644 --- a/integration-cli/docker_cli_images_test.go +++ b/integration-cli/docker_cli_images_test.go @@ -19,12 +19,12 @@ import ( "gotest.tools/icmd" ) -func (s *DockerSuite) TestImagesEnsureImageIsListed(c *check.C) { +func (s *DockerSuite) TestImagesEnsureImageIsListed(c *testing.T) { imagesOut, _ := dockerCmd(c, "images") assert.Assert(c, imagesOut, checker.Contains, "busybox") } -func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *check.C) { +func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *testing.T) { name := "imagewithtag" dockerCmd(c, "tag", "busybox", name+":v1") dockerCmd(c, "tag", "busybox", name+":v1v1") @@ -43,12 +43,12 @@ func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *check.C) { assert.Assert(c, imagesOut, checker.Contains, "v2") } -func (s *DockerSuite) TestImagesEnsureImageWithBadTagIsNotListed(c *check.C) { +func (s *DockerSuite) TestImagesEnsureImageWithBadTagIsNotListed(c *testing.T) { imagesOut, _ := dockerCmd(c, "images", "busybox:nonexistent") assert.Assert(c, imagesOut, checker.Not(checker.Contains), "busybox") } -func (s *DockerSuite) TestImagesOrderedByCreationDate(c *check.C) { +func (s *DockerSuite) TestImagesOrderedByCreationDate(c *testing.T) { buildImageSuccessfully(c, "order:test_a", build.WithDockerfile(`FROM busybox MAINTAINER dockerio1`)) id1 := getIDByName(c, "order:test_a") @@ -68,13 +68,13 @@ func (s *DockerSuite) TestImagesOrderedByCreationDate(c *check.C) { assert.Assert(c, imgs[2], checker.Equals, id1, check.Commentf("First image must be %s, got %s", id1, imgs[2])) } -func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *check.C) { +func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *testing.T) { out, _, err := dockerCmdWithError("images", "-f", "FOO=123") assert.ErrorContains(c, err, "") assert.Assert(c, out, checker.Contains, "Invalid filter") } -func (s *DockerSuite) TestImagesFilterLabelMatch(c *check.C) { +func (s *DockerSuite) TestImagesFilterLabelMatch(c *testing.T) { imageName1 := "images_filter_test1" imageName2 := "images_filter_test2" imageName3 := "images_filter_test3" @@ -102,7 +102,7 @@ func (s *DockerSuite) TestImagesFilterLabelMatch(c *check.C) { } // Regression : #15659 -func (s *DockerSuite) TestCommitWithFilterLabel(c *check.C) { +func (s *DockerSuite) TestCommitWithFilterLabel(c *testing.T) { // Create a container dockerCmd(c, "run", "--name", "bar", "busybox", "/bin/sh") // Commit with labels "using changes" @@ -114,7 +114,7 @@ func (s *DockerSuite) TestCommitWithFilterLabel(c *check.C) { assert.Equal(c, out, imageID) } -func (s *DockerSuite) TestImagesFilterSinceAndBefore(c *check.C) { +func (s *DockerSuite) TestImagesFilterSinceAndBefore(c *testing.T) { buildImageSuccessfully(c, "image:1", build.WithDockerfile(`FROM `+minimalBaseImage()+` LABEL number=1`)) imageID1 := getIDByName(c, "image:1") @@ -184,7 +184,7 @@ func assertImageList(out string, expected []string) bool { } // FIXME(vdemeester) should be a unit test on `docker image ls` -func (s *DockerSuite) TestImagesFilterSpaceTrimCase(c *check.C) { +func (s *DockerSuite) TestImagesFilterSpaceTrimCase(c *testing.T) { imageName := "images_filter_test" // Build a image and fail to build so that we have dangling images ? buildImage(imageName, build.WithDockerfile(`FROM busybox @@ -224,7 +224,7 @@ func (s *DockerSuite) TestImagesFilterSpaceTrimCase(c *check.C) { } } -func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *check.C) { +func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *testing.T) { testRequires(c, DaemonIsLinux) // create container 1 out, _ := dockerCmd(c, "run", "-d", "busybox", "true") @@ -252,13 +252,13 @@ func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *check.C) { } // FIXME(vdemeester) should be a unit test for `docker image ls` -func (s *DockerSuite) TestImagesWithIncorrectFilter(c *check.C) { +func (s *DockerSuite) TestImagesWithIncorrectFilter(c *testing.T) { out, _, err := dockerCmdWithError("images", "-f", "dangling=invalid") assert.ErrorContains(c, err, "") assert.Assert(c, out, checker.Contains, "Invalid filter") } -func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *check.C) { +func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *testing.T) { dockerfile := ` FROM busybox MAINTAINER docker @@ -281,7 +281,7 @@ func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *check.C) { assert.Assert(c, out, checker.Contains, stringid.TruncateID(id)) } -func (s *DockerSuite) TestImagesEnsureImagesFromScratchShown(c *check.C) { +func (s *DockerSuite) TestImagesEnsureImagesFromScratchShown(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support FROM scratch dockerfile := ` FROM scratch @@ -298,7 +298,7 @@ func (s *DockerSuite) TestImagesEnsureImagesFromScratchShown(c *check.C) { // For W2W - equivalent to TestImagesEnsureImagesFromScratchShown but Windows // doesn't support from scratch -func (s *DockerSuite) TestImagesEnsureImagesFromBusyboxShown(c *check.C) { +func (s *DockerSuite) TestImagesEnsureImagesFromBusyboxShown(c *testing.T) { dockerfile := ` FROM busybox MAINTAINER docker` @@ -313,7 +313,7 @@ func (s *DockerSuite) TestImagesEnsureImagesFromBusyboxShown(c *check.C) { } // #18181 -func (s *DockerSuite) TestImagesFilterNameWithPort(c *check.C) { +func (s *DockerSuite) TestImagesFilterNameWithPort(c *testing.T) { tag := "a.b.c.d:5000/hello" dockerCmd(c, "tag", "busybox", tag) out, _ := dockerCmd(c, "images", tag) @@ -326,7 +326,7 @@ func (s *DockerSuite) TestImagesFilterNameWithPort(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), tag) } -func (s *DockerSuite) TestImagesFormat(c *check.C) { +func (s *DockerSuite) TestImagesFormat(c *testing.T) { // testRequires(c, DaemonIsLinux) tag := "myimage" dockerCmd(c, "tag", "busybox", tag+":v1") @@ -342,7 +342,7 @@ func (s *DockerSuite) TestImagesFormat(c *check.C) { } // ImagesDefaultFormatAndQuiet -func (s *DockerSuite) TestImagesFormatDefaultFormat(c *check.C) { +func (s *DockerSuite) TestImagesFormatDefaultFormat(c *testing.T) { testRequires(c, DaemonIsLinux) // create container 1 diff --git a/integration-cli/docker_cli_import_test.go b/integration-cli/docker_cli_import_test.go index 8362826bc8..2f0ed5e183 100644 --- a/integration-cli/docker_cli_import_test.go +++ b/integration-cli/docker_cli_import_test.go @@ -16,7 +16,7 @@ import ( "gotest.tools/icmd" ) -func (s *DockerSuite) TestImportDisplay(c *check.C) { +func (s *DockerSuite) TestImportDisplay(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "true") cleanedContainerID := strings.TrimSpace(out) @@ -34,7 +34,7 @@ func (s *DockerSuite) TestImportDisplay(c *check.C) { assert.Equal(c, out, "", "command output should've been nothing.") } -func (s *DockerSuite) TestImportBadURL(c *check.C) { +func (s *DockerSuite) TestImportBadURL(c *testing.T) { out, _, err := dockerCmdWithError("import", "http://nourl/bad") assert.Assert(c, err, checker.NotNil, check.Commentf("import was supposed to fail but didn't")) // Depending on your system you can get either of these errors @@ -45,7 +45,7 @@ func (s *DockerSuite) TestImportBadURL(c *check.C) { } } -func (s *DockerSuite) TestImportFile(c *check.C) { +func (s *DockerSuite) TestImportFile(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "--name", "test-import", "busybox", "true") @@ -66,7 +66,7 @@ func (s *DockerSuite) TestImportFile(c *check.C) { assert.Equal(c, out, "", "command output should've been nothing.") } -func (s *DockerSuite) TestImportGzipped(c *check.C) { +func (s *DockerSuite) TestImportGzipped(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "--name", "test-import", "busybox", "true") @@ -89,7 +89,7 @@ func (s *DockerSuite) TestImportGzipped(c *check.C) { assert.Equal(c, out, "", "command output should've been nothing.") } -func (s *DockerSuite) TestImportFileWithMessage(c *check.C) { +func (s *DockerSuite) TestImportFileWithMessage(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "--name", "test-import", "busybox", "true") @@ -120,12 +120,12 @@ func (s *DockerSuite) TestImportFileWithMessage(c *check.C) { assert.Equal(c, out, "", "command output should've been nothing") } -func (s *DockerSuite) TestImportFileNonExistentFile(c *check.C) { +func (s *DockerSuite) TestImportFileNonExistentFile(c *testing.T) { _, _, err := dockerCmdWithError("import", "example.com/myImage.tar") assert.Assert(c, err, checker.NotNil, check.Commentf("import non-existing file must failed")) } -func (s *DockerSuite) TestImportWithQuotedChanges(c *check.C) { +func (s *DockerSuite) TestImportWithQuotedChanges(c *testing.T) { testRequires(c, DaemonIsLinux) cli.DockerCmd(c, "run", "--name", "test-import", "busybox", "true") diff --git a/integration-cli/docker_cli_info_test.go b/integration-cli/docker_cli_info_test.go index f4dbb56821..45572b4144 100644 --- a/integration-cli/docker_cli_info_test.go +++ b/integration-cli/docker_cli_info_test.go @@ -14,7 +14,7 @@ import ( ) // ensure docker info succeeds -func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) { +func (s *DockerSuite) TestInfoEnsureSucceeds(c *testing.T) { out, _ := dockerCmd(c, "info") // always shown fields @@ -58,7 +58,7 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) { } // TestInfoFormat tests `docker info --format` -func (s *DockerSuite) TestInfoFormat(c *check.C) { +func (s *DockerSuite) TestInfoFormat(c *testing.T) { out, status := dockerCmd(c, "info", "--format", "{{json .}}") assert.Assert(c, status, checker.Equals, 0) var m map[string]interface{} @@ -70,7 +70,7 @@ func (s *DockerSuite) TestInfoFormat(c *check.C) { // TestInfoDiscoveryBackend verifies that a daemon run with `--cluster-advertise` and // `--cluster-store` properly show the backend's endpoint in info output. -func (s *DockerSuite) TestInfoDiscoveryBackend(c *check.C) { +func (s *DockerSuite) TestInfoDiscoveryBackend(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) @@ -87,7 +87,7 @@ func (s *DockerSuite) TestInfoDiscoveryBackend(c *check.C) { // TestInfoDiscoveryInvalidAdvertise verifies that a daemon run with // an invalid `--cluster-advertise` configuration -func (s *DockerSuite) TestInfoDiscoveryInvalidAdvertise(c *check.C) { +func (s *DockerSuite) TestInfoDiscoveryInvalidAdvertise(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) @@ -104,7 +104,7 @@ func (s *DockerSuite) TestInfoDiscoveryInvalidAdvertise(c *check.C) { // TestInfoDiscoveryAdvertiseInterfaceName verifies that a daemon run with `--cluster-advertise` // configured with interface name properly show the advertise ip-address in info output. -func (s *DockerSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *check.C) { +func (s *DockerSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, Network, DaemonIsLinux) d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) @@ -128,7 +128,7 @@ func (s *DockerSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *check.C) { assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s:2375\n", ip.String())) } -func (s *DockerSuite) TestInfoDisplaysRunningContainers(c *check.C) { +func (s *DockerSuite) TestInfoDisplaysRunningContainers(c *testing.T) { testRequires(c, DaemonIsLinux) existing := existingContainerStates(c) @@ -141,7 +141,7 @@ func (s *DockerSuite) TestInfoDisplaysRunningContainers(c *check.C) { assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"])) } -func (s *DockerSuite) TestInfoDisplaysPausedContainers(c *check.C) { +func (s *DockerSuite) TestInfoDisplaysPausedContainers(c *testing.T) { testRequires(c, IsPausable) existing := existingContainerStates(c) @@ -158,7 +158,7 @@ func (s *DockerSuite) TestInfoDisplaysPausedContainers(c *check.C) { assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"])) } -func (s *DockerSuite) TestInfoDisplaysStoppedContainers(c *check.C) { +func (s *DockerSuite) TestInfoDisplaysStoppedContainers(c *testing.T) { testRequires(c, DaemonIsLinux) existing := existingContainerStates(c) @@ -175,7 +175,7 @@ func (s *DockerSuite) TestInfoDisplaysStoppedContainers(c *check.C) { assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"]+1)) } -func (s *DockerSuite) TestInfoDebug(c *check.C) { +func (s *DockerSuite) TestInfoDebug(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) @@ -193,7 +193,7 @@ func (s *DockerSuite) TestInfoDebug(c *check.C) { assert.Assert(c, out, checker.Contains, "Docker Root Dir") } -func (s *DockerSuite) TestInsecureRegistries(c *check.C) { +func (s *DockerSuite) TestInsecureRegistries(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) registryCIDR := "192.168.1.0/24" @@ -210,7 +210,7 @@ func (s *DockerSuite) TestInsecureRegistries(c *check.C) { assert.Assert(c, out, checker.Contains, fmt.Sprintf(" %s\n", registryCIDR)) } -func (s *DockerDaemonSuite) TestRegistryMirrors(c *check.C) { +func (s *DockerDaemonSuite) TestRegistryMirrors(c *testing.T) { registryMirror1 := "https://192.168.1.2" registryMirror2 := "http://registry.mirror.com:5000" @@ -224,7 +224,7 @@ func (s *DockerDaemonSuite) TestRegistryMirrors(c *check.C) { assert.Assert(c, out, checker.Contains, fmt.Sprintf(" %s", registryMirror2)) } -func existingContainerStates(c *check.C) map[string]int { +func existingContainerStates(c *testing.T) map[string]int { out, _ := dockerCmd(c, "info", "--format", "{{json .}}") var m map[string]interface{} err := json.Unmarshal([]byte(out), &m) diff --git a/integration-cli/docker_cli_info_unix_test.go b/integration-cli/docker_cli_info_unix_test.go index c99f52a31c..8992a8d10b 100644 --- a/integration-cli/docker_cli_info_unix_test.go +++ b/integration-cli/docker_cli_info_unix_test.go @@ -7,7 +7,7 @@ import ( "github.com/go-check/check" ) -func (s *DockerSuite) TestInfoSecurityOptions(c *check.C) { +func (s *DockerSuite) TestInfoSecurityOptions(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, Apparmor, DaemonIsLinux) out, _ := dockerCmd(c, "info") diff --git a/integration-cli/docker_cli_inspect_test.go b/integration-cli/docker_cli_inspect_test.go index caa8315e3c..589fc50612 100644 --- a/integration-cli/docker_cli_inspect_test.go +++ b/integration-cli/docker_cli_inspect_test.go @@ -16,13 +16,13 @@ import ( "gotest.tools/icmd" ) -func checkValidGraphDriver(c *check.C, name string) { +func checkValidGraphDriver(c *testing.T, name string) { if name != "devicemapper" && name != "overlay" && name != "vfs" && name != "zfs" && name != "btrfs" && name != "aufs" { c.Fatalf("%v is not a valid graph driver name", name) } } -func (s *DockerSuite) TestInspectImage(c *check.C) { +func (s *DockerSuite) TestInspectImage(c *testing.T) { testRequires(c, DaemonIsLinux) imageTest := "emptyfs" // It is important that this ID remain stable. If a code change causes @@ -36,13 +36,13 @@ func (s *DockerSuite) TestInspectImage(c *check.C) { assert.Assert(c, id, checker.Equals, imageTestID) } -func (s *DockerSuite) TestInspectInt64(c *check.C) { +func (s *DockerSuite) TestInspectInt64(c *testing.T) { dockerCmd(c, "run", "-d", "-m=300M", "--name", "inspectTest", "busybox", "true") inspectOut := inspectField(c, "inspectTest", "HostConfig.Memory") assert.Assert(c, inspectOut, checker.Equals, "314572800") } -func (s *DockerSuite) TestInspectDefault(c *check.C) { +func (s *DockerSuite) TestInspectDefault(c *testing.T) { //Both the container and image are named busybox. docker inspect will fetch the container JSON. //If the container JSON is not available, it will go for the image JSON. @@ -53,7 +53,7 @@ func (s *DockerSuite) TestInspectDefault(c *check.C) { assert.Assert(c, strings.TrimSpace(inspectOut), checker.Equals, containerID) } -func (s *DockerSuite) TestInspectStatus(c *check.C) { +func (s *DockerSuite) TestInspectStatus(c *testing.T) { out := runSleepingContainer(c, "-d") out = strings.TrimSpace(out) @@ -78,7 +78,7 @@ func (s *DockerSuite) TestInspectStatus(c *check.C) { } -func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) { +func (s *DockerSuite) TestInspectTypeFlagContainer(c *testing.T) { //Both the container and image are named busybox. docker inspect will fetch container //JSON State.Running field. If the field is true, it's a container. runSleepingContainer(c, "--name=busybox", "-d") @@ -88,7 +88,7 @@ func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) { assert.Equal(c, out, "true\n") // not a container JSON } -func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) { +func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *testing.T) { //Run this test on an image named busybox. docker inspect will try to fetch container //JSON. Since there is no container named busybox and --type=container, docker inspect will //not try to get the image JSON. It will throw an error. @@ -100,7 +100,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) { assert.ErrorContains(c, err, "") } -func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) { +func (s *DockerSuite) TestInspectTypeFlagWithImage(c *testing.T) { //Both the container and image are named busybox. docker inspect will fetch image //JSON as --type=image. if there is no image with name busybox, docker inspect //will throw an error. @@ -112,7 +112,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), "State") } -func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) { +func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *testing.T) { //Both the container and image are named busybox. docker inspect will fail //as --type=foobar is not a valid value for the flag. @@ -124,7 +124,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) { assert.Assert(c, out, checker.Contains, "not a valid value for --type") } -func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) { +func (s *DockerSuite) TestInspectImageFilterInt(c *testing.T) { testRequires(c, DaemonIsLinux) imageTest := "emptyfs" out := inspectField(c, imageTest, "Size") @@ -140,7 +140,7 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) { assert.Assert(c, result, checker.Equals, true) } -func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) { +func (s *DockerSuite) TestInspectContainerFilterInt(c *testing.T) { result := icmd.RunCmd(icmd.Cmd{ Command: []string{dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat"}, Stdin: strings.NewReader("blahblah"), @@ -162,7 +162,7 @@ func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) { assert.Assert(c, inspectResult, checker.Equals, true) } -func (s *DockerSuite) TestInspectImageGraphDriver(c *check.C) { +func (s *DockerSuite) TestInspectImageGraphDriver(c *testing.T) { testRequires(c, DaemonIsLinux, Devicemapper) imageTest := "emptyfs" name := inspectField(c, imageTest, "GraphDriver.Name") @@ -180,7 +180,7 @@ func (s *DockerSuite) TestInspectImageGraphDriver(c *check.C) { assert.Assert(c, err, checker.IsNil, check.Commentf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err)) } -func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) { +func (s *DockerSuite) TestInspectContainerGraphDriver(c *testing.T) { testRequires(c, DaemonIsLinux, Devicemapper) out, _ := dockerCmd(c, "run", "-d", "busybox", "true") @@ -205,7 +205,7 @@ func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) { assert.Assert(c, err, checker.IsNil, check.Commentf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err)) } -func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) { +func (s *DockerSuite) TestInspectBindMountPoint(c *testing.T) { modifier := ",z" prefix, slash := getPrefixAndSlashFromDaemonPlatform() if testEnv.OSType == "windows" { @@ -237,7 +237,7 @@ func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) { assert.Assert(c, m.RW, checker.Equals, false) } -func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) { +func (s *DockerSuite) TestInspectNamedMountPoint(c *testing.T) { prefix, slash := getPrefixAndSlashFromDaemonPlatform() dockerCmd(c, "run", "-d", "--name", "test", "-v", "data:"+prefix+slash+"data", "busybox", "cat") @@ -261,7 +261,7 @@ func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) { } // #14947 -func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) { +func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "true") id := strings.TrimSpace(out) startedAt := inspectField(c, id, "State.StartedAt") @@ -282,7 +282,7 @@ func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) { } // #15633 -func (s *DockerSuite) TestInspectLogConfigNoType(c *check.C) { +func (s *DockerSuite) TestInspectLogConfigNoType(c *testing.T) { dockerCmd(c, "create", "--name=test", "--log-opt", "max-file=42", "busybox") var logConfig container.LogConfig @@ -295,7 +295,7 @@ func (s *DockerSuite) TestInspectLogConfigNoType(c *check.C) { assert.Assert(c, logConfig.Config["max-file"], checker.Equals, "42", check.Commentf("%v", logConfig)) } -func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *check.C) { +func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *testing.T) { //Both the container and image are named busybox. docker inspect will fetch container //JSON SizeRw and SizeRootFs field. If there is no flag --size/-s, there are no size fields. @@ -307,7 +307,7 @@ func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *check.C) { assert.Assert(c, strings.TrimSpace(out), check.Equals, ",", check.Commentf("Expected not to display size info: %s", out)) } -func (s *DockerSuite) TestInspectSizeFlagContainer(c *check.C) { +func (s *DockerSuite) TestInspectSizeFlagContainer(c *testing.T) { runSleepingContainer(c, "--name=busybox", "-d") formatStr := "--format='{{.SizeRw}},{{.SizeRootFs}}'" @@ -318,7 +318,7 @@ func (s *DockerSuite) TestInspectSizeFlagContainer(c *check.C) { assert.Assert(c, strings.TrimSpace(sz[1]), check.Not(check.Equals), "") } -func (s *DockerSuite) TestInspectTemplateError(c *check.C) { +func (s *DockerSuite) TestInspectTemplateError(c *testing.T) { // Template parsing error for both the container and image. runSleepingContainer(c, "--name=container1", "-d") @@ -332,7 +332,7 @@ func (s *DockerSuite) TestInspectTemplateError(c *check.C) { assert.Assert(c, out, checker.Contains, "Template parsing error") } -func (s *DockerSuite) TestInspectJSONFields(c *check.C) { +func (s *DockerSuite) TestInspectJSONFields(c *testing.T) { runSleepingContainer(c, "--name=busybox", "-d") out, _, err := dockerCmdWithError("inspect", "--type=container", "--format={{.HostConfig.Dns}}", "busybox") @@ -340,7 +340,7 @@ func (s *DockerSuite) TestInspectJSONFields(c *check.C) { assert.Equal(c, out, "[]\n") } -func (s *DockerSuite) TestInspectByPrefix(c *check.C) { +func (s *DockerSuite) TestInspectByPrefix(c *testing.T) { id := inspectField(c, "busybox", "Id") assert.Assert(c, strings.HasPrefix(id, "sha256:")) @@ -351,7 +351,7 @@ func (s *DockerSuite) TestInspectByPrefix(c *check.C) { assert.Assert(c, id, checker.Equals, id3) } -func (s *DockerSuite) TestInspectStopWhenNotFound(c *check.C) { +func (s *DockerSuite) TestInspectStopWhenNotFound(c *testing.T) { runSleepingContainer(c, "--name=busybox1", "-d") runSleepingContainer(c, "--name=busybox2", "-d") result := dockerCmdWithResult("inspect", "--type=container", "--format='{{.Name}}'", "busybox1", "busybox2", "missing") @@ -370,7 +370,7 @@ func (s *DockerSuite) TestInspectStopWhenNotFound(c *check.C) { assert.Assert(c, result.Stderr(), checker.Contains, "Error: No such container: missing") } -func (s *DockerSuite) TestInspectHistory(c *check.C) { +func (s *DockerSuite) TestInspectHistory(c *testing.T) { dockerCmd(c, "run", "--name=testcont", "busybox", "echo", "hello") dockerCmd(c, "commit", "-m", "test comment", "testcont", "testimg") out, _, err := dockerCmdWithError("inspect", "--format='{{.Comment}}'", "testimg") @@ -378,7 +378,7 @@ func (s *DockerSuite) TestInspectHistory(c *check.C) { assert.Assert(c, out, checker.Contains, "test comment") } -func (s *DockerSuite) TestInspectContainerNetworkDefault(c *check.C) { +func (s *DockerSuite) TestInspectContainerNetworkDefault(c *testing.T) { testRequires(c, DaemonIsLinux) contName := "test1" @@ -390,7 +390,7 @@ func (s *DockerSuite) TestInspectContainerNetworkDefault(c *check.C) { assert.Equal(c, strings.TrimSpace(out), strings.TrimSpace(netOut)) } -func (s *DockerSuite) TestInspectContainerNetworkCustom(c *check.C) { +func (s *DockerSuite) TestInspectContainerNetworkCustom(c *testing.T) { testRequires(c, DaemonIsLinux) netOut, _ := dockerCmd(c, "network", "create", "net1") @@ -401,7 +401,7 @@ func (s *DockerSuite) TestInspectContainerNetworkCustom(c *check.C) { assert.Equal(c, strings.TrimSpace(out), strings.TrimSpace(netOut)) } -func (s *DockerSuite) TestInspectRootFS(c *check.C) { +func (s *DockerSuite) TestInspectRootFS(c *testing.T) { out, _, err := dockerCmdWithError("inspect", "busybox") assert.NilError(c, err) @@ -411,7 +411,7 @@ func (s *DockerSuite) TestInspectRootFS(c *check.C) { assert.Assert(c, len(imageJSON[0].RootFS.Layers) >= 1) } -func (s *DockerSuite) TestInspectAmpersand(c *check.C) { +func (s *DockerSuite) TestInspectAmpersand(c *testing.T) { testRequires(c, DaemonIsLinux) name := "test" @@ -421,7 +421,7 @@ func (s *DockerSuite) TestInspectAmpersand(c *check.C) { assert.Assert(c, out, checker.Contains, `soanni&rtr`) } -func (s *DockerSuite) TestInspectPlugin(c *check.C) { +func (s *DockerSuite) TestInspectPlugin(c *testing.T) { testRequires(c, DaemonIsLinux, IsAmd64, Network) _, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag) assert.NilError(c, err) @@ -452,7 +452,7 @@ func (s *DockerSuite) TestInspectPlugin(c *check.C) { } // Test case for 29185 -func (s *DockerSuite) TestInspectUnknownObject(c *check.C) { +func (s *DockerSuite) TestInspectUnknownObject(c *testing.T) { // This test should work on both Windows and Linux out, _, err := dockerCmdWithError("inspect", "foobar") assert.ErrorContains(c, err, "") diff --git a/integration-cli/docker_cli_links_test.go b/integration-cli/docker_cli_links_test.go index 3d8d3a8725..6d888694fb 100644 --- a/integration-cli/docker_cli_links_test.go +++ b/integration-cli/docker_cli_links_test.go @@ -13,7 +13,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *check.C) { +func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *testing.T) { testRequires(c, DaemonIsLinux) _, exitCode, err := dockerCmdWithError("run", "--rm", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1") @@ -22,7 +22,7 @@ func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *check.C) { } // Test for appropriate error when calling --link with an invalid target container -func (s *DockerSuite) TestLinksInvalidContainerTarget(c *check.C) { +func (s *DockerSuite) TestLinksInvalidContainerTarget(c *testing.T) { testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "--link", "bogus:alias", "busybox", "true") @@ -34,7 +34,7 @@ func (s *DockerSuite) TestLinksInvalidContainerTarget(c *check.C) { assert.Assert(c, strings.ToLower(out), checker.Contains, "could not get container") } -func (s *DockerSuite) TestLinksPingLinkedContainers(c *check.C) { +func (s *DockerSuite) TestLinksPingLinkedContainers(c *testing.T) { testRequires(c, DaemonIsLinux) // Test with the three different ways of specifying the default network on Linux testLinkPingOnNetwork(c, "") @@ -42,7 +42,7 @@ func (s *DockerSuite) TestLinksPingLinkedContainers(c *check.C) { testLinkPingOnNetwork(c, "bridge") } -func testLinkPingOnNetwork(c *check.C, network string) { +func testLinkPingOnNetwork(c *testing.T, network string) { var postArgs []string if network != "" { postArgs = append(postArgs, []string{"--net", network}...) @@ -78,7 +78,7 @@ func testLinkPingOnNetwork(c *check.C, network string) { dockerCmd(c, "rm", "-f", "container2") } -func (s *DockerSuite) TestLinksPingLinkedContainersAfterRename(c *check.C) { +func (s *DockerSuite) TestLinksPingLinkedContainersAfterRename(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top") idA := strings.TrimSpace(out) @@ -91,7 +91,7 @@ func (s *DockerSuite) TestLinksPingLinkedContainersAfterRename(c *check.C) { } -func (s *DockerSuite) TestLinksInspectLinksStarted(c *check.C) { +func (s *DockerSuite) TestLinksInspectLinksStarted(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top") dockerCmd(c, "run", "-d", "--name", "container2", "busybox", "top") @@ -110,7 +110,7 @@ func (s *DockerSuite) TestLinksInspectLinksStarted(c *check.C) { assert.DeepEqual(c, result, expected) } -func (s *DockerSuite) TestLinksInspectLinksStopped(c *check.C) { +func (s *DockerSuite) TestLinksInspectLinksStopped(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top") @@ -130,7 +130,7 @@ func (s *DockerSuite) TestLinksInspectLinksStopped(c *check.C) { assert.DeepEqual(c, result, expected) } -func (s *DockerSuite) TestLinksNotStartedParentNotFail(c *check.C) { +func (s *DockerSuite) TestLinksNotStartedParentNotFail(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "create", "--name=first", "busybox", "top") dockerCmd(c, "create", "--name=second", "--link=first:first", "busybox", "top") @@ -138,7 +138,7 @@ func (s *DockerSuite) TestLinksNotStartedParentNotFail(c *check.C) { } -func (s *DockerSuite) TestLinksHostsFilesInject(c *check.C) { +func (s *DockerSuite) TestLinksHostsFilesInject(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, testEnv.IsLocalDaemon) @@ -156,7 +156,7 @@ func (s *DockerSuite) TestLinksHostsFilesInject(c *check.C) { assert.Assert(c, string(contentTwo), checker.Contains, "onetwo") } -func (s *DockerSuite) TestLinksUpdateOnRestart(c *check.C) { +func (s *DockerSuite) TestLinksUpdateOnRestart(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, testEnv.IsLocalDaemon) dockerCmd(c, "run", "-d", "--name", "one", "busybox", "top") @@ -189,7 +189,7 @@ func (s *DockerSuite) TestLinksUpdateOnRestart(c *check.C) { assert.Assert(c, ip, checker.Equals, realIP) } -func (s *DockerSuite) TestLinksEnvs(c *check.C) { +func (s *DockerSuite) TestLinksEnvs(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "-d", "-e", "e1=", "-e", "e2=v2", "-e", "e3=v3=v3", "--name=first", "busybox", "top") out, _ := dockerCmd(c, "run", "--name=second", "--link=first:first", "busybox", "env") @@ -198,7 +198,7 @@ func (s *DockerSuite) TestLinksEnvs(c *check.C) { assert.Assert(c, out, checker.Contains, "FIRST_ENV_e3=v3=v3") } -func (s *DockerSuite) TestLinkShortDefinition(c *check.C) { +func (s *DockerSuite) TestLinkShortDefinition(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "--name", "shortlinkdef", "busybox", "top") @@ -214,7 +214,7 @@ func (s *DockerSuite) TestLinkShortDefinition(c *check.C) { assert.Assert(c, links, checker.Equals, "[\"/shortlinkdef:/link2/shortlinkdef\"]") } -func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) { +func (s *DockerSuite) TestLinksNetworkHostContainer(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) dockerCmd(c, "run", "-d", "--net", "host", "--name", "host_container", "busybox", "top") out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true") @@ -225,14 +225,14 @@ func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) { assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetworkAndLinks.Error()) } -func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *check.C) { +func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts") // /etc/hosts should be a regular file assert.Assert(c, out, checker.Matches, "^-.+\n") } -func (s *DockerSuite) TestLinksMultipleWithSameName(c *check.C) { +func (s *DockerSuite) TestLinksMultipleWithSameName(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "-d", "--name=upstream-a", "busybox", "top") dockerCmd(c, "run", "-d", "--name=upstream-b", "busybox", "top") diff --git a/integration-cli/docker_cli_login_test.go b/integration-cli/docker_cli_login_test.go index b147f4887c..d68e94dc0a 100644 --- a/integration-cli/docker_cli_login_test.go +++ b/integration-cli/docker_cli_login_test.go @@ -9,7 +9,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSuite) TestLoginWithoutTTY(c *check.C) { +func (s *DockerSuite) TestLoginWithoutTTY(c *testing.T) { cmd := exec.Command(dockerBinary, "login") // Send to stdin so the process does not get the TTY @@ -20,7 +20,7 @@ func (s *DockerSuite) TestLoginWithoutTTY(c *check.C) { assert.ErrorContains(c, err, "") //"Expected non nil err when logging in & TTY not available" } -func (s *DockerRegistryAuthHtpasswdSuite) TestLoginToPrivateRegistry(c *check.C) { +func (s *DockerRegistryAuthHtpasswdSuite) TestLoginToPrivateRegistry(c *testing.T) { // wrong credentials out, _, err := dockerCmdWithError("login", "-u", s.reg.Username(), "-p", "WRONGPASSWORD", privateRegistryURL) assert.ErrorContains(c, err, "", out) diff --git a/integration-cli/docker_cli_logout_test.go b/integration-cli/docker_cli_logout_test.go index 5fce1cb74e..45f7570987 100644 --- a/integration-cli/docker_cli_logout_test.go +++ b/integration-cli/docker_cli_logout_test.go @@ -13,7 +13,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithExternalAuth(c *check.C) { +func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithExternalAuth(c *testing.T) { s.d.StartWithBusybox(c) osPath := os.Getenv("PATH") @@ -65,7 +65,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithExternalAuth(c *check.C) } // #23100 -func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithWrongHostnamesStored(c *check.C) { +func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithWrongHostnamesStored(c *testing.T) { osPath := os.Getenv("PATH") defer os.Setenv("PATH", osPath) diff --git a/integration-cli/docker_cli_logs_test.go b/integration-cli/docker_cli_logs_test.go index dadb827a60..db0a33da13 100644 --- a/integration-cli/docker_cli_logs_test.go +++ b/integration-cli/docker_cli_logs_test.go @@ -16,21 +16,21 @@ import ( ) // This used to work, it test a log of PageSize-1 (gh#4851) -func (s *DockerSuite) TestLogsContainerSmallerThanPage(c *check.C) { +func (s *DockerSuite) TestLogsContainerSmallerThanPage(c *testing.T) { testLogsContainerPagination(c, 32767) } // Regression test: When going over the PageSize, it used to panic (gh#4851) -func (s *DockerSuite) TestLogsContainerBiggerThanPage(c *check.C) { +func (s *DockerSuite) TestLogsContainerBiggerThanPage(c *testing.T) { testLogsContainerPagination(c, 32768) } // Regression test: When going much over the PageSize, it used to block (gh#4851) -func (s *DockerSuite) TestLogsContainerMuchBiggerThanPage(c *check.C) { +func (s *DockerSuite) TestLogsContainerMuchBiggerThanPage(c *testing.T) { testLogsContainerPagination(c, 33000) } -func testLogsContainerPagination(c *check.C, testLen int) { +func testLogsContainerPagination(c *testing.T, testLen int) { out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n = >> a.a; done; echo >> a.a; cat a.a", testLen)) id := strings.TrimSpace(out) dockerCmd(c, "wait", id) @@ -38,7 +38,7 @@ func testLogsContainerPagination(c *check.C, testLen int) { assert.Equal(c, len(out), testLen+1) } -func (s *DockerSuite) TestLogsTimestamps(c *check.C) { +func (s *DockerSuite) TestLogsTimestamps(c *testing.T) { testLen := 100 out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo = >> a.a; done; cat a.a", testLen)) @@ -63,7 +63,7 @@ func (s *DockerSuite) TestLogsTimestamps(c *check.C) { } } -func (s *DockerSuite) TestLogsSeparateStderr(c *check.C) { +func (s *DockerSuite) TestLogsSeparateStderr(c *testing.T) { msg := "stderr_log" out := cli.DockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg)).Combined() id := strings.TrimSpace(out) @@ -74,7 +74,7 @@ func (s *DockerSuite) TestLogsSeparateStderr(c *check.C) { }) } -func (s *DockerSuite) TestLogsStderrInStdout(c *check.C) { +func (s *DockerSuite) TestLogsStderrInStdout(c *testing.T) { // TODO Windows: Needs investigation why this fails. Obtained string includes // a bunch of ANSI escape sequences before the "stderr_log" message. testRequires(c, DaemonIsLinux) @@ -89,7 +89,7 @@ func (s *DockerSuite) TestLogsStderrInStdout(c *check.C) { }) } -func (s *DockerSuite) TestLogsTail(c *check.C) { +func (s *DockerSuite) TestLogsTail(c *testing.T) { testLen := 100 out := cli.DockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen)).Combined() @@ -121,7 +121,7 @@ func (s *DockerSuite) TestLogsTail(c *check.C) { assert.Equal(c, len(lines), testLen+1) } -func (s *DockerSuite) TestLogsFollowStopped(c *check.C) { +func (s *DockerSuite) TestLogsFollowStopped(c *testing.T) { dockerCmd(c, "run", "--name=test", "busybox", "echo", "hello") id := getIDByName(c, "test") @@ -142,7 +142,7 @@ func (s *DockerSuite) TestLogsFollowStopped(c *check.C) { } } -func (s *DockerSuite) TestLogsSince(c *check.C) { +func (s *DockerSuite) TestLogsSince(c *testing.T) { name := "testlogssince" dockerCmd(c, "run", "--name="+name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do sleep 2; echo log$i; done") out, _ := dockerCmd(c, "logs", "-t", name) @@ -177,7 +177,7 @@ func (s *DockerSuite) TestLogsSince(c *check.C) { } } -func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) { +func (s *DockerSuite) TestLogsSinceFutureFollow(c *testing.T) { // TODO Windows TP5 - Figure out why this test is so flakey. Disabled for now. testRequires(c, DaemonIsLinux) name := "testlogssincefuturefollow" @@ -211,7 +211,7 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) { } // Regression test for #8832 -func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) { +func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *testing.T) { // TODO Windows: Fix this test for TP5. testRequires(c, DaemonIsLinux) expected := 150000 @@ -269,7 +269,7 @@ func ConsumeWithSpeed(reader io.Reader, chunkSize int, interval time.Duration, s } } -func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) { +func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 2; done") id := strings.TrimSpace(out) assert.NilError(c, waitRun(id)) @@ -297,7 +297,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) { assert.NilError(c, waitForGoroutines(nroutines)) } -func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *check.C) { +func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do sleep 2; done") id := strings.TrimSpace(out) assert.NilError(c, waitRun(id)) @@ -315,14 +315,14 @@ func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *check.C) { assert.NilError(c, waitForGoroutines(nroutines)) } -func (s *DockerSuite) TestLogsCLIContainerNotFound(c *check.C) { +func (s *DockerSuite) TestLogsCLIContainerNotFound(c *testing.T) { name := "testlogsnocontainer" out, _, _ := dockerCmdWithError("logs", name) message := fmt.Sprintf("No such container: %s\n", name) assert.Assert(c, strings.Contains(out, message)) } -func (s *DockerSuite) TestLogsWithDetails(c *check.C) { +func (s *DockerSuite) TestLogsWithDetails(c *testing.T) { dockerCmd(c, "run", "--name=test", "--label", "foo=bar", "-e", "baz=qux", "--log-opt", "labels=foo", "--log-opt", "env=baz", "busybox", "echo", "hello") out, _ := dockerCmd(c, "logs", "--details", "--timestamps", "test") diff --git a/integration-cli/docker_cli_netmode_test.go b/integration-cli/docker_cli_netmode_test.go index e50fcf0673..a26acf2da2 100644 --- a/integration-cli/docker_cli_netmode_test.go +++ b/integration-cli/docker_cli_netmode_test.go @@ -17,20 +17,20 @@ const stringCheckPS = "PID USER" // DockerCmdWithFail executes a docker command that is supposed to fail and returns // the output, the exit code. If the command returns a Nil error, it will fail and // stop the tests. -func dockerCmdWithFail(c *check.C, args ...string) (string, int) { +func dockerCmdWithFail(c *testing.T, args ...string) (string, int) { out, status, err := dockerCmdWithError(args...) assert.Assert(c, err, check.NotNil, check.Commentf("%v", out)) return out, status } -func (s *DockerSuite) TestNetHostnameWithNetHost(c *check.C) { +func (s *DockerSuite) TestNetHostnameWithNetHost(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ps") assert.Assert(c, out, checker.Contains, stringCheckPS) } -func (s *DockerSuite) TestNetHostname(c *check.C) { +func (s *DockerSuite) TestNetHostname(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-h=name", "busybox", "ps") @@ -52,28 +52,28 @@ func (s *DockerSuite) TestNetHostname(c *check.C) { assert.Assert(c, strings.ToLower(out), checker.Contains, "not found") } -func (s *DockerSuite) TestConflictContainerNetworkAndLinks(c *check.C) { +func (s *DockerSuite) TestConflictContainerNetworkAndLinks(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmdWithFail(c, "run", "--net=container:other", "--link=zip:zap", "busybox", "ps") assert.Assert(c, out, checker.Contains, runconfig.ErrConflictContainerNetworkAndLinks.Error()) } -func (s *DockerSuite) TestConflictContainerNetworkHostAndLinks(c *check.C) { +func (s *DockerSuite) TestConflictContainerNetworkHostAndLinks(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) out, _ := dockerCmdWithFail(c, "run", "--net=host", "--link=zip:zap", "busybox", "ps") assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetworkAndLinks.Error()) } -func (s *DockerSuite) TestConflictNetworkModeNetHostAndOptions(c *check.C) { +func (s *DockerSuite) TestConflictNetworkModeNetHostAndOptions(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) out, _ := dockerCmdWithFail(c, "run", "--net=host", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps") assert.Assert(c, out, checker.Contains, runconfig.ErrConflictContainerNetworkAndMac.Error()) } -func (s *DockerSuite) TestConflictNetworkModeAndOptions(c *check.C) { +func (s *DockerSuite) TestConflictNetworkModeAndOptions(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmdWithFail(c, "run", "--net=container:other", "--dns=8.8.8.8", "busybox", "ps") diff --git a/integration-cli/docker_cli_network_unix_test.go b/integration-cli/docker_cli_network_unix_test.go index a88ba56570..85b4cb8c31 100644 --- a/integration-cli/docker_cli_network_unix_test.go +++ b/integration-cli/docker_cli_network_unix_test.go @@ -50,25 +50,25 @@ type DockerNetworkSuite struct { d *daemon.Daemon } -func (s *DockerNetworkSuite) SetUpTest(c *check.C) { +func (s *DockerNetworkSuite) SetUpTest(c *testing.T) { s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) } -func (s *DockerNetworkSuite) TearDownTest(c *check.C) { +func (s *DockerNetworkSuite) TearDownTest(c *testing.T) { if s.d != nil { s.d.Stop(c) s.ds.TearDownTest(c) } } -func (s *DockerNetworkSuite) SetUpSuite(c *check.C) { +func (s *DockerNetworkSuite) SetUpSuite(c *testing.T) { mux := http.NewServeMux() s.server = httptest.NewServer(mux) assert.Assert(c, s.server, check.NotNil, check.Commentf("Failed to start an HTTP Server")) setupRemoteNetworkDrivers(c, mux, s.server.URL, dummyNetworkDriver, dummyIPAMDriver) } -func setupRemoteNetworkDrivers(c *check.C, mux *http.ServeMux, url, netDrv, ipamDrv string) { +func setupRemoteNetworkDrivers(c *testing.T, mux *http.ServeMux, url, netDrv, ipamDrv string) { mux.HandleFunc("/Plugin.Activate", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") @@ -221,7 +221,7 @@ func setupRemoteNetworkDrivers(c *check.C, mux *http.ServeMux, url, netDrv, ipam assert.NilError(c, err) } -func (s *DockerNetworkSuite) TearDownSuite(c *check.C) { +func (s *DockerNetworkSuite) TearDownSuite(c *testing.T) { if s.server == nil { return } @@ -232,19 +232,19 @@ func (s *DockerNetworkSuite) TearDownSuite(c *check.C) { assert.NilError(c, err) } -func assertNwIsAvailable(c *check.C, name string) { +func assertNwIsAvailable(c *testing.T, name string) { if !isNwPresent(c, name) { c.Fatalf("Network %s not found in network ls o/p", name) } } -func assertNwNotAvailable(c *check.C, name string) { +func assertNwNotAvailable(c *testing.T, name string) { if isNwPresent(c, name) { c.Fatalf("Found network %s in network ls o/p", name) } } -func isNwPresent(c *check.C, name string) bool { +func isNwPresent(c *testing.T, name string) bool { out, _ := dockerCmd(c, "network", "ls") lines := strings.Split(out, "\n") for i := 1; i < len(lines)-1; i++ { @@ -259,7 +259,7 @@ func isNwPresent(c *check.C, name string) bool { // assertNwList checks network list retrieved with ls command // equals to expected network list // note: out should be `network ls [option]` result -func assertNwList(c *check.C, out string, expectNws []string) { +func assertNwList(c *testing.T, out string, expectNws []string) { lines := strings.Split(out, "\n") var nwList []string for _, line := range lines[1 : len(lines)-1] { @@ -272,7 +272,7 @@ func assertNwList(c *check.C, out string, expectNws []string) { assert.DeepEqual(c, nwList, expectNws) } -func getNwResource(c *check.C, name string) *types.NetworkResource { +func getNwResource(c *testing.T, name string) *types.NetworkResource { out, _ := dockerCmd(c, "network", "inspect", name) var nr []types.NetworkResource err := json.Unmarshal([]byte(out), &nr) @@ -280,14 +280,14 @@ func getNwResource(c *check.C, name string) *types.NetworkResource { return &nr[0] } -func (s *DockerNetworkSuite) TestDockerNetworkLsDefault(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkLsDefault(c *testing.T) { defaults := []string{"bridge", "host", "none"} for _, nn := range defaults { assertNwIsAvailable(c, nn) } } -func (s *DockerNetworkSuite) TestDockerNetworkCreatePredefined(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkCreatePredefined(c *testing.T) { predefined := []string{"bridge", "host", "none", "default"} for _, net := range predefined { // predefined networks can't be created again @@ -296,7 +296,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreatePredefined(c *check.C) { } } -func (s *DockerNetworkSuite) TestDockerNetworkCreateHostBind(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkCreateHostBind(c *testing.T) { dockerCmd(c, "network", "create", "--subnet=192.168.10.0/24", "--gateway=192.168.10.1", "-o", "com.docker.network.bridge.host_binding_ipv4=192.168.10.1", "testbind") assertNwIsAvailable(c, "testbind") @@ -307,7 +307,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateHostBind(c *check.C) { assert.Assert(c, out, checker.Contains, "192.168.10.1:5000->5000/tcp") } -func (s *DockerNetworkSuite) TestDockerNetworkRmPredefined(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkRmPredefined(c *testing.T) { predefined := []string{"bridge", "host", "none", "default"} for _, net := range predefined { // predefined networks can't be removed @@ -316,7 +316,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkRmPredefined(c *check.C) { } } -func (s *DockerNetworkSuite) TestDockerNetworkLsFilter(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkLsFilter(c *testing.T) { testRequires(c, OnlyDefaultNetworks) testNet := "testnet1" testLabel := "foo" @@ -372,7 +372,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkLsFilter(c *check.C) { assertNwList(c, out, []string{"bridge", "dev", testNet}) } -func (s *DockerNetworkSuite) TestDockerNetworkCreateDelete(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkCreateDelete(c *testing.T) { dockerCmd(c, "network", "create", "test") assertNwIsAvailable(c, "test") @@ -380,7 +380,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateDelete(c *check.C) { assertNwNotAvailable(c, "test") } -func (s *DockerNetworkSuite) TestDockerNetworkCreateLabel(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkCreateLabel(c *testing.T) { testNet := "testnetcreatelabel" testLabel := "foo" testValue := "bar" @@ -396,12 +396,12 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateLabel(c *check.C) { assertNwNotAvailable(c, testNet) } -func (s *DockerSuite) TestDockerNetworkDeleteNotExists(c *check.C) { +func (s *DockerSuite) TestDockerNetworkDeleteNotExists(c *testing.T) { out, _, err := dockerCmdWithError("network", "rm", "test") assert.ErrorContains(c, err, "", out) } -func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *check.C) { +func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *testing.T) { dockerCmd(c, "network", "create", "testDelMulti0") assertNwIsAvailable(c, "testDelMulti0") dockerCmd(c, "network", "create", "testDelMulti1") @@ -425,7 +425,7 @@ func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *check.C) { assertNwIsAvailable(c, "testDelMulti2") } -func (s *DockerSuite) TestDockerNetworkInspect(c *check.C) { +func (s *DockerSuite) TestDockerNetworkInspect(c *testing.T) { out, _ := dockerCmd(c, "network", "inspect", "host") var networkResources []types.NetworkResource err := json.Unmarshal([]byte(out), &networkResources) @@ -436,7 +436,7 @@ func (s *DockerSuite) TestDockerNetworkInspect(c *check.C) { assert.Assert(c, strings.TrimSpace(out), check.Equals, "host") } -func (s *DockerSuite) TestDockerNetworkInspectWithID(c *check.C) { +func (s *DockerSuite) TestDockerNetworkInspectWithID(c *testing.T) { out, _ := dockerCmd(c, "network", "create", "test2") networkID := strings.TrimSpace(out) assertNwIsAvailable(c, "test2") @@ -447,7 +447,7 @@ func (s *DockerSuite) TestDockerNetworkInspectWithID(c *check.C) { assert.Assert(c, strings.TrimSpace(out), check.Equals, networkID) } -func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *check.C) { +func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *testing.T) { result := dockerCmdWithResult("network", "inspect", "host", "none") result.Assert(c, icmd.Success) @@ -457,7 +457,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *check.C) { assert.Equal(c, len(networkResources), 2) } -func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *check.C) { +func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *testing.T) { // non-existent network was not at the beginning of the inspect list // This should print an error, return an exitCode 1 and print the host network result := dockerCmdWithResult("network", "inspect", "host", "nonexistent") @@ -496,7 +496,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c assert.Equal(c, len(networkResources), 1) } -func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) { +func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *testing.T) { dockerCmd(c, "network", "create", "brNetForInspect") assertNwIsAvailable(c, "brNetForInspect") defer func() { @@ -536,7 +536,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) { assert.Equal(c, container1.Name, newName) } -func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnect(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnect(c *testing.T) { dockerCmd(c, "network", "create", "test") assertNwIsAvailable(c, "test") nr := getNwResource(c, "test") @@ -588,7 +588,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnect(c *check.C) { assertNwNotAvailable(c, "test") } -func (s *DockerNetworkSuite) TestDockerNetworkIPAMMultipleNetworks(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkIPAMMultipleNetworks(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) // test0 bridge network dockerCmd(c, "network", "create", "--subnet=192.168.0.0/16", "test1") @@ -629,7 +629,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkIPAMMultipleNetworks(c *check.C) { } } -func (s *DockerNetworkSuite) TestDockerNetworkCustomIPAM(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkCustomIPAM(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) // Create a bridge network using custom ipam driver dockerCmd(c, "network", "create", "--ipam-driver", dummyIPAMDriver, "br0") @@ -645,7 +645,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCustomIPAM(c *check.C) { assertNwNotAvailable(c, "br0") } -func (s *DockerNetworkSuite) TestDockerNetworkIPAMOptions(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkIPAMOptions(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) // Create a bridge network using custom ipam driver and options dockerCmd(c, "network", "create", "--ipam-driver", dummyIPAMDriver, "--ipam-opt", "opt1=drv1", "--ipam-opt", "opt2=drv2", "br0") @@ -658,7 +658,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkIPAMOptions(c *check.C) { assert.Assert(c, opts["opt2"], checker.Equals, "drv2") } -func (s *DockerNetworkSuite) TestDockerNetworkNullIPAMDriver(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkNullIPAMDriver(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) // Create a network with null ipam driver _, _, err := dockerCmdWithError("network", "create", "-d", dummyNetworkDriver, "--ipam-driver", "null", "test000") @@ -674,7 +674,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkNullIPAMDriver(c *check.C) { assert.Assert(c, nr.IPAM.Config[0].Gateway, checker.Equals, "") } -func (s *DockerNetworkSuite) TestDockerNetworkInspectDefault(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkInspectDefault(c *testing.T) { nr := getNetworkResource(c, "none") assert.Assert(c, nr.Driver, checker.Equals, "null") assert.Assert(c, nr.Scope, checker.Equals, "local") @@ -700,7 +700,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkInspectDefault(c *check.C) { assert.Assert(c, len(nr.IPAM.Config), checker.Equals, 1) } -func (s *DockerNetworkSuite) TestDockerNetworkInspectCustomUnspecified(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkInspectCustomUnspecified(c *testing.T) { // if unspecified, network subnet will be selected from inside preferred pool dockerCmd(c, "network", "create", "test01") assertNwIsAvailable(c, "test01") @@ -717,7 +717,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkInspectCustomUnspecified(c *check. assertNwNotAvailable(c, "test01") } -func (s *DockerNetworkSuite) TestDockerNetworkInspectCustomSpecified(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkInspectCustomSpecified(c *testing.T) { dockerCmd(c, "network", "create", "--driver=bridge", "--ipv6", "--subnet=fd80:24e2:f998:72d6::/64", "--subnet=172.28.0.0/16", "--ip-range=172.28.5.0/24", "--gateway=172.28.5.254", "br0") assertNwIsAvailable(c, "br0") @@ -736,7 +736,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkInspectCustomSpecified(c *check.C) assertNwNotAvailable(c, "br0") } -func (s *DockerNetworkSuite) TestDockerNetworkIPAMInvalidCombinations(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkIPAMInvalidCombinations(c *testing.T) { // network with ip-range out of subnet range _, _, err := dockerCmdWithError("network", "create", "--subnet=192.168.0.0/16", "--ip-range=192.170.0.0/16", "test") assert.ErrorContains(c, err, "") @@ -760,7 +760,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkIPAMInvalidCombinations(c *check.C assertNwNotAvailable(c, "test0") } -func (s *DockerNetworkSuite) TestDockerNetworkDriverOptions(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkDriverOptions(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) dockerCmd(c, "network", "create", "-d", dummyNetworkDriver, "-o", "opt1=drv1", "-o", "opt2=drv2", "testopt") assertNwIsAvailable(c, "testopt") @@ -775,7 +775,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDriverOptions(c *check.C) { } -func (s *DockerNetworkSuite) TestDockerPluginV2NetworkDriver(c *check.C) { +func (s *DockerNetworkSuite) TestDockerPluginV2NetworkDriver(c *testing.T) { testRequires(c, DaemonIsLinux, IsAmd64, Network) var ( @@ -799,7 +799,7 @@ func (s *DockerNetworkSuite) TestDockerPluginV2NetworkDriver(c *check.C) { } -func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c *check.C) { +func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c *testing.T) { // On default bridge network built-in service discovery should not happen hostsFile := "/etc/hosts" bridgeName := "external-bridge" @@ -851,7 +851,7 @@ func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c * assert.Assert(c, string(hosts), checker.Equals, string(hostsPost), check.Commentf("Unexpected %s change on second network connection", hostsFile)) } -func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *testing.T) { testRequires(c, NotArm) hostsFile := "/etc/hosts" cstmBridgeNw := "custom-bridge-nw" @@ -904,7 +904,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) { assert.ErrorContains(c, err, "") } -func (s *DockerNetworkSuite) TestDockerNetworkLinkOnDefaultNetworkOnly(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkLinkOnDefaultNetworkOnly(c *testing.T) { // Legacy Link feature must work only on default network, and not across networks cnt1 := "container1" cnt2 := "container2" @@ -930,7 +930,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkLinkOnDefaultNetworkOnly(c *check. dockerCmd(c, "run", "-d", "--link", fmt.Sprintf("%s:%s", cnt2, cnt2), "busybox", "top") } -func (s *DockerNetworkSuite) TestDockerNetworkOverlayPortMapping(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkOverlayPortMapping(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) // Verify exposed ports are present in ps output when running a container on // a network managed by a driver which does not provide the default gateway @@ -957,7 +957,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkOverlayPortMapping(c *check.C) { assert.Assert(c, out, checker.Contains, unpPort2) } -func (s *DockerNetworkSuite) TestDockerNetworkDriverUngracefulRestart(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkDriverUngracefulRestart(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, testEnv.IsLocalDaemon) dnd := "dnd" did := "did" @@ -998,7 +998,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDriverUngracefulRestart(c *check.C assert.NilError(c, err) } -func (s *DockerNetworkSuite) TestDockerNetworkMacInspect(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkMacInspect(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) // Verify endpoint MAC address is correctly populated in container's network settings nwn := "ov" @@ -1013,7 +1013,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkMacInspect(c *check.C) { assert.Assert(c, mac, checker.Equals, "a0:b1:c2:d3:e4:f5") } -func (s *DockerSuite) TestInspectAPIMultipleNetworks(c *check.C) { +func (s *DockerSuite) TestInspectAPIMultipleNetworks(c *testing.T) { dockerCmd(c, "network", "create", "mybridge1") dockerCmd(c, "network", "create", "mybridge2") out, _ := dockerCmd(c, "run", "-d", "busybox", "top") @@ -1041,7 +1041,7 @@ func (s *DockerSuite) TestInspectAPIMultipleNetworks(c *check.C) { assert.Assert(c, bridge.IPAddress, checker.Equals, inspect121.NetworkSettings.IPAddress) } -func connectContainerToNetworks(c *check.C, d *daemon.Daemon, cName string, nws []string) { +func connectContainerToNetworks(c *testing.T, d *daemon.Daemon, cName string, nws []string) { // Run a container on the default network out, err := d.Cmd("run", "-d", "--name", cName, "busybox", "top") assert.NilError(c, err, out) @@ -1055,7 +1055,7 @@ func connectContainerToNetworks(c *check.C, d *daemon.Daemon, cName string, nws } } -func verifyContainerIsConnectedToNetworks(c *check.C, d *daemon.Daemon, cName string, nws []string) { +func verifyContainerIsConnectedToNetworks(c *testing.T, d *daemon.Daemon, cName string, nws []string) { // Verify container is connected to all the networks for _, nw := range nws { out, err := d.Cmd("inspect", "-f", fmt.Sprintf("{{.NetworkSettings.Networks.%s}}", nw), cName) @@ -1064,7 +1064,7 @@ func verifyContainerIsConnectedToNetworks(c *check.C, d *daemon.Daemon, cName st } } -func (s *DockerNetworkSuite) TestDockerNetworkMultipleNetworksGracefulDaemonRestart(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkMultipleNetworksGracefulDaemonRestart(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) cName := "bb" nwList := []string{"nw1", "nw2", "nw3"} @@ -1083,7 +1083,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkMultipleNetworksGracefulDaemonRest verifyContainerIsConnectedToNetworks(c, s.d, cName, nwList) } -func (s *DockerNetworkSuite) TestDockerNetworkMultipleNetworksUngracefulDaemonRestart(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkMultipleNetworksUngracefulDaemonRestart(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) cName := "cc" nwList := []string{"nw1", "nw2", "nw3"} @@ -1104,13 +1104,13 @@ func (s *DockerNetworkSuite) TestDockerNetworkMultipleNetworksUngracefulDaemonRe verifyContainerIsConnectedToNetworks(c, s.d, cName, nwList) } -func (s *DockerNetworkSuite) TestDockerNetworkRunNetByID(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkRunNetByID(c *testing.T) { out, _ := dockerCmd(c, "network", "create", "one") containerOut, _, err := dockerCmdWithError("run", "-d", "--net", strings.TrimSpace(out), "busybox", "top") assert.Assert(c, err, checker.IsNil, check.Commentf(containerOut)) } -func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, testEnv.IsLocalDaemon) s.d.StartWithBusybox(c) @@ -1136,7 +1136,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c } } -func (s *DockerNetworkSuite) TestDockerNetworkConnectToHostFromOtherNetwork(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkConnectToHostFromOtherNetwork(c *testing.T) { dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top") assert.Assert(c, waitRun("container1"), check.IsNil) dockerCmd(c, "network", "disconnect", "bridge", "container1") @@ -1145,7 +1145,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectToHostFromOtherNetwork(c *c assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetwork.Error()) } -func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromHost(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromHost(c *testing.T) { dockerCmd(c, "run", "-d", "--name", "container1", "--net=host", "busybox", "top") assert.Assert(c, waitRun("container1"), check.IsNil) out, _, err := dockerCmdWithError("network", "disconnect", "host", "container1") @@ -1153,7 +1153,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromHost(c *check.C) { assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetwork.Error()) } -func (s *DockerNetworkSuite) TestDockerNetworkConnectWithPortMapping(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkConnectWithPortMapping(c *testing.T) { testRequires(c, NotArm) dockerCmd(c, "network", "create", "test1") dockerCmd(c, "run", "-d", "--name", "c1", "-p", "5000:5000", "busybox", "top") @@ -1161,7 +1161,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithPortMapping(c *check.C) dockerCmd(c, "network", "connect", "test1", "c1") } -func verifyPortMap(c *check.C, container, port, originalMapping string, mustBeEqual bool) { +func verifyPortMap(c *testing.T, container, port, originalMapping string, mustBeEqual bool) { currentMapping, _ := dockerCmd(c, "port", container, port) if mustBeEqual { assert.Assert(c, currentMapping, checker.Equals, originalMapping) @@ -1170,7 +1170,7 @@ func verifyPortMap(c *check.C, container, port, originalMapping string, mustBeEq } } -func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectWithPortMapping(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectWithPortMapping(c *testing.T) { // Connect and disconnect a container with explicit and non-explicit // host port mapping to/from networks which do cause and do not cause // the container default gateway to change, and verify docker port cmd @@ -1207,7 +1207,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectWithPortMapping(c verifyPortMap(c, cnt, "90", curExplPortMap, true) } -func (s *DockerNetworkSuite) TestDockerNetworkConnectWithMac(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkConnectWithMac(c *testing.T) { macAddress := "02:42:ac:11:00:02" dockerCmd(c, "network", "create", "mynetwork") dockerCmd(c, "run", "--name=test", "-d", "--mac-address", macAddress, "busybox", "top") @@ -1219,13 +1219,13 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithMac(c *check.C) { assert.Assert(c, strings.TrimSpace(mac2), checker.Not(checker.Equals), strings.TrimSpace(mac1)) } -func (s *DockerNetworkSuite) TestDockerNetworkInspectCreatedContainer(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkInspectCreatedContainer(c *testing.T) { dockerCmd(c, "create", "--name", "test", "busybox") networks := inspectField(c, "test", "NetworkSettings.Networks") assert.Assert(c, networks, checker.Contains, "bridge", check.Commentf("Should return 'bridge' network")) } -func (s *DockerNetworkSuite) TestDockerNetworkRestartWithMultipleNetworks(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkRestartWithMultipleNetworks(c *testing.T) { dockerCmd(c, "network", "create", "test") dockerCmd(c, "run", "--name=foo", "-d", "busybox", "top") assert.Assert(c, waitRun("foo"), checker.IsNil) @@ -1236,7 +1236,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkRestartWithMultipleNetworks(c *che assert.Assert(c, networks, checker.Contains, "test", check.Commentf("Should contain 'test' network")) } -func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectToStoppedContainer(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectToStoppedContainer(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) dockerCmd(c, "network", "create", "test") dockerCmd(c, "create", "--name=foo", "busybox", "top") @@ -1270,7 +1270,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectToStoppedContaine } -func (s *DockerNetworkSuite) TestDockerNetworkDisconnectContainerNonexistingNetwork(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkDisconnectContainerNonexistingNetwork(c *testing.T) { dockerCmd(c, "network", "create", "test") dockerCmd(c, "run", "--net=test", "-d", "--name=foo", "busybox", "top") networks := inspectField(c, "foo", "NetworkSettings.Networks") @@ -1286,7 +1286,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectContainerNonexistingNetw assert.Assert(c, networks, checker.Not(checker.Contains), "test", check.Commentf("Should not contain 'test' network")) } -func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *testing.T) { // create two networks dockerCmd(c, "network", "create", "--ipv6", "--subnet=172.28.0.0/16", "--subnet=2001:db8:1234::/64", "n0") assertNwIsAvailable(c, "n0") @@ -1322,7 +1322,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *check.C) { } -func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIPStoppedContainer(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIPStoppedContainer(c *testing.T) { // create a container dockerCmd(c, "create", "--name", "c0", "busybox", "top") @@ -1345,7 +1345,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIPStoppedContainer verifyIPAddressConfig(c, "c0", "n0", "172.30.55.44", "2001:db8:abcd::5544") } -func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *testing.T) { // requested IP is not supported on predefined networks for _, mode := range []string{"none", "host", "bridge", "default"} { checkUnsupportedNetworkAndIP(c, mode) @@ -1367,13 +1367,13 @@ func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *check.C) assertNwNotAvailable(c, "n0") } -func checkUnsupportedNetworkAndIP(c *check.C, nwMode string) { +func checkUnsupportedNetworkAndIP(c *testing.T, nwMode string) { out, _, err := dockerCmdWithError("run", "-d", "--net", nwMode, "--ip", "172.28.99.88", "--ip6", "2001:db8:1234::9988", "busybox", "top") assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out)) assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndIP.Error()) } -func verifyIPAddressConfig(c *check.C, cName, nwname, ipv4, ipv6 string) { +func verifyIPAddressConfig(c *testing.T, cName, nwname, ipv4, ipv6 string) { if ipv4 != "" { out := inspectField(c, cName, fmt.Sprintf("NetworkSettings.Networks.%s.IPAMConfig.IPv4Address", nwname)) assert.Assert(c, strings.TrimSpace(out), check.Equals, ipv4) @@ -1385,7 +1385,7 @@ func verifyIPAddressConfig(c *check.C, cName, nwname, ipv4, ipv6 string) { } } -func verifyIPAddresses(c *check.C, cName, nwname, ipv4, ipv6 string) { +func verifyIPAddresses(c *testing.T, cName, nwname, ipv4, ipv6 string) { out := inspectField(c, cName, fmt.Sprintf("NetworkSettings.Networks.%s.IPAddress", nwname)) assert.Assert(c, strings.TrimSpace(out), check.Equals, ipv4) @@ -1393,7 +1393,7 @@ func verifyIPAddresses(c *check.C, cName, nwname, ipv4, ipv6 string) { assert.Assert(c, strings.TrimSpace(out), check.Equals, ipv6) } -func (s *DockerNetworkSuite) TestDockerNetworkConnectLinkLocalIP(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkConnectLinkLocalIP(c *testing.T) { // create one test network dockerCmd(c, "network", "create", "--ipv6", "--subnet=2001:db8:1234::/64", "n0") assertNwIsAvailable(c, "n0") @@ -1440,7 +1440,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectLinkLocalIP(c *check.C) { assert.NilError(c, err) } -func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectLink(c *check.C) { +func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectLink(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) dockerCmd(c, "network", "create", "-d", "bridge", "foo1") dockerCmd(c, "network", "create", "-d", "bridge", "foo2") @@ -1481,7 +1481,7 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectLink(c *check.C) { assert.NilError(c, err) } -func (s *DockerNetworkSuite) TestDockerNetworkDisconnectDefault(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkDisconnectDefault(c *testing.T) { netWorkName1 := "test1" netWorkName2 := "test2" containerName := "foo" @@ -1501,7 +1501,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectDefault(c *check.C) { assert.Assert(c, networks, checker.Not(checker.Contains), "bridge", check.Commentf("Should not contain 'bridge' network")) } -func (s *DockerNetworkSuite) TestDockerNetworkConnectWithAliasOnDefaultNetworks(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkConnectWithAliasOnDefaultNetworks(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) defaults := []string{"bridge", "host", "none"} @@ -1514,7 +1514,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithAliasOnDefaultNetworks( } } -func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *check.C) { +func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) dockerCmd(c, "network", "create", "-d", "bridge", "net1") dockerCmd(c, "network", "create", "-d", "bridge", "net2") @@ -1569,7 +1569,7 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *check.C) { assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) } -func (s *DockerSuite) TestUserDefinedNetworkConnectivity(c *check.C) { +func (s *DockerSuite) TestUserDefinedNetworkConnectivity(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) dockerCmd(c, "network", "create", "-d", "bridge", "br.net1") @@ -1592,7 +1592,7 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectivity(c *check.C) { assert.ErrorContains(c, err, "") } -func (s *DockerSuite) TestEmbeddedDNSInvalidInput(c *check.C) { +func (s *DockerSuite) TestEmbeddedDNSInvalidInput(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) dockerCmd(c, "network", "create", "-d", "bridge", "nw1") @@ -1600,7 +1600,7 @@ func (s *DockerSuite) TestEmbeddedDNSInvalidInput(c *check.C) { dockerCmd(c, "run", "-i", "--net=nw1", "--name=c1", "debian:jessie", "bash", "-c", "echo InvalidQuery > /dev/udp/127.0.0.11/53") } -func (s *DockerSuite) TestDockerNetworkConnectFailsNoInspectChange(c *check.C) { +func (s *DockerSuite) TestDockerNetworkConnectFailsNoInspectChange(c *testing.T) { dockerCmd(c, "run", "-d", "--name=bb", "busybox", "top") assert.Assert(c, waitRun("bb"), check.IsNil) defer dockerCmd(c, "stop", "bb") @@ -1615,7 +1615,7 @@ func (s *DockerSuite) TestDockerNetworkConnectFailsNoInspectChange(c *check.C) { assert.Assert(c, ns1, check.Equals, ns0) } -func (s *DockerSuite) TestDockerNetworkInternalMode(c *check.C) { +func (s *DockerSuite) TestDockerNetworkInternalMode(c *testing.T) { dockerCmd(c, "network", "create", "--driver=bridge", "--internal", "internal") assertNwIsAvailable(c, "internal") nr := getNetworkResource(c, "internal") @@ -1633,7 +1633,7 @@ func (s *DockerSuite) TestDockerNetworkInternalMode(c *check.C) { } // Test for #21401 -func (s *DockerNetworkSuite) TestDockerNetworkCreateDeleteSpecialCharacters(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkCreateDeleteSpecialCharacters(c *testing.T) { dockerCmd(c, "network", "create", "test@#$") assertNwIsAvailable(c, "test@#$") dockerCmd(c, "network", "rm", "test@#$") @@ -1645,7 +1645,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateDeleteSpecialCharacters(c *c assertNwNotAvailable(c, "kiwl$%^") } -func (s *DockerDaemonSuite) TestDaemonRestartRestoreBridgeNetwork(t *check.C) { +func (s *DockerDaemonSuite) TestDaemonRestartRestoreBridgeNetwork(t *testing.T) { s.d.StartWithBusybox(t, "--live-restore") defer s.d.Stop(t) oldCon := "old" @@ -1714,7 +1714,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartRestoreBridgeNetwork(t *check.C) { } } -func (s *DockerNetworkSuite) TestDockerNetworkFlagAlias(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkFlagAlias(c *testing.T) { dockerCmd(c, "network", "create", "user") output, status := dockerCmd(c, "run", "--rm", "--network=user", "--network-alias=foo", "busybox", "true") assert.Assert(c, status, checker.Equals, 0, check.Commentf("unexpected status code %d (%s)", status, output)) @@ -1726,7 +1726,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkFlagAlias(c *check.C) { assert.Assert(c, status, checker.Equals, 0, check.Commentf("unexpected status code %d (%s)", status, output)) } -func (s *DockerNetworkSuite) TestDockerNetworkValidateIP(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkValidateIP(c *testing.T) { _, _, err := dockerCmdWithError("network", "create", "--ipv6", "--subnet=172.28.0.0/16", "--subnet=2001:db8:1234::/64", "mynet") assert.NilError(c, err) assertNwIsAvailable(c, "mynet") @@ -1751,7 +1751,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkValidateIP(c *check.C) { } // Test case for 26220 -func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromBridge(c *check.C) { +func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromBridge(c *testing.T) { out, _ := dockerCmd(c, "network", "inspect", "--format", "{{.Id}}", "bridge") network := strings.TrimSpace(out) @@ -1765,7 +1765,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromBridge(c *check.C) { // TestConntrackFlowsLeak covers the failure scenario of ticket: https://github.com/docker/docker/issues/8795 // Validates that conntrack is correctly cleaned once a container is destroyed -func (s *DockerNetworkSuite) TestConntrackFlowsLeak(c *check.C) { +func (s *DockerNetworkSuite) TestConntrackFlowsLeak(c *testing.T) { testRequires(c, IsAmd64, DaemonIsLinux, Network, testEnv.IsLocalDaemon) // Create a new network diff --git a/integration-cli/docker_cli_plugins_logdriver_test.go b/integration-cli/docker_cli_plugins_logdriver_test.go index df013e4e14..f165900c1a 100644 --- a/integration-cli/docker_cli_plugins_logdriver_test.go +++ b/integration-cli/docker_cli_plugins_logdriver_test.go @@ -9,7 +9,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSuite) TestPluginLogDriver(c *check.C) { +func (s *DockerSuite) TestPluginLogDriver(c *testing.T) { testRequires(c, IsAmd64, DaemonIsLinux) pluginName := "cpuguy83/docker-logdriver-test:latest" @@ -29,7 +29,7 @@ func (s *DockerSuite) TestPluginLogDriver(c *check.C) { } // Make sure log drivers are listed in info, and v2 plugins are not. -func (s *DockerSuite) TestPluginLogDriverInfoList(c *check.C) { +func (s *DockerSuite) TestPluginLogDriverInfoList(c *testing.T) { testRequires(c, IsAmd64, DaemonIsLinux) pluginName := "cpuguy83/docker-logdriver-test" diff --git a/integration-cli/docker_cli_plugins_test.go b/integration-cli/docker_cli_plugins_test.go index 24990d99b9..c9fd711add 100644 --- a/integration-cli/docker_cli_plugins_test.go +++ b/integration-cli/docker_cli_plugins_test.go @@ -29,7 +29,7 @@ var ( npNameWithTag = npName + ":" + pTag ) -func (ps *DockerPluginSuite) TestPluginBasicOps(c *check.C) { +func (ps *DockerPluginSuite) TestPluginBasicOps(c *testing.T) { plugin := ps.getPluginRepoWithTag() _, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", plugin) assert.NilError(c, err) @@ -60,7 +60,7 @@ func (ps *DockerPluginSuite) TestPluginBasicOps(c *check.C) { } } -func (ps *DockerPluginSuite) TestPluginForceRemove(c *check.C) { +func (ps *DockerPluginSuite) TestPluginForceRemove(c *testing.T) { pNameWithTag := ps.getPluginRepoWithTag() _, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag) @@ -74,7 +74,7 @@ func (ps *DockerPluginSuite) TestPluginForceRemove(c *check.C) { assert.Assert(c, out, checker.Contains, pNameWithTag) } -func (s *DockerSuite) TestPluginActive(c *check.C) { +func (s *DockerSuite) TestPluginActive(c *testing.T) { testRequires(c, DaemonIsLinux, IsAmd64, Network) _, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag) @@ -97,7 +97,7 @@ func (s *DockerSuite) TestPluginActive(c *check.C) { assert.Assert(c, out, checker.Contains, pNameWithTag) } -func (s *DockerSuite) TestPluginActiveNetwork(c *check.C) { +func (s *DockerSuite) TestPluginActiveNetwork(c *testing.T) { testRequires(c, DaemonIsLinux, IsAmd64, Network) _, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", npNameWithTag) assert.NilError(c, err) @@ -124,7 +124,7 @@ func (s *DockerSuite) TestPluginActiveNetwork(c *check.C) { assert.Assert(c, out, checker.Contains, npNameWithTag) } -func (ps *DockerPluginSuite) TestPluginInstallDisable(c *check.C) { +func (ps *DockerPluginSuite) TestPluginInstallDisable(c *testing.T) { pName := ps.getPluginRepoWithTag() out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pName) @@ -148,7 +148,7 @@ func (ps *DockerPluginSuite) TestPluginInstallDisable(c *check.C) { assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) } -func (s *DockerSuite) TestPluginInstallDisableVolumeLs(c *check.C) { +func (s *DockerSuite) TestPluginInstallDisableVolumeLs(c *testing.T) { testRequires(c, DaemonIsLinux, IsAmd64, Network) out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pName) assert.NilError(c, err) @@ -157,7 +157,7 @@ func (s *DockerSuite) TestPluginInstallDisableVolumeLs(c *check.C) { dockerCmd(c, "volume", "ls") } -func (ps *DockerPluginSuite) TestPluginSet(c *check.C) { +func (ps *DockerPluginSuite) TestPluginSet(c *testing.T) { client := testEnv.APIClient() name := "test" @@ -208,7 +208,7 @@ func (ps *DockerPluginSuite) TestPluginSet(c *check.C) { } -func (ps *DockerPluginSuite) TestPluginInstallArgs(c *check.C) { +func (ps *DockerPluginSuite) TestPluginInstallArgs(c *testing.T) { pName := path.Join(ps.registryHost(), "plugin", "testplugininstallwithargs") ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) defer cancel() @@ -224,7 +224,7 @@ func (ps *DockerPluginSuite) TestPluginInstallArgs(c *check.C) { assert.Assert(c, strings.TrimSpace(env), checker.Equals, "[DEBUG=1]") } -func (ps *DockerPluginSuite) TestPluginInstallImage(c *check.C) { +func (ps *DockerPluginSuite) TestPluginInstallImage(c *testing.T) { testRequires(c, IsAmd64) repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) @@ -238,7 +238,7 @@ func (ps *DockerPluginSuite) TestPluginInstallImage(c *check.C) { assert.Assert(c, out, checker.Contains, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) } -func (ps *DockerPluginSuite) TestPluginEnableDisableNegative(c *check.C) { +func (ps *DockerPluginSuite) TestPluginEnableDisableNegative(c *testing.T) { pName := ps.getPluginRepoWithTag() out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pName) @@ -260,7 +260,7 @@ func (ps *DockerPluginSuite) TestPluginEnableDisableNegative(c *check.C) { assert.NilError(c, err) } -func (ps *DockerPluginSuite) TestPluginCreate(c *check.C) { +func (ps *DockerPluginSuite) TestPluginCreate(c *testing.T) { name := "foo/bar-driver" temp, err := ioutil.TempDir("", "foo") assert.NilError(c, err) @@ -292,7 +292,7 @@ func (ps *DockerPluginSuite) TestPluginCreate(c *check.C) { assert.Assert(c, len(strings.Split(strings.TrimSpace(out), "\n")), checker.Equals, 2) } -func (ps *DockerPluginSuite) TestPluginInspect(c *check.C) { +func (ps *DockerPluginSuite) TestPluginInspect(c *testing.T) { pNameWithTag := ps.getPluginRepoWithTag() _, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag) @@ -342,7 +342,7 @@ func (ps *DockerPluginSuite) TestPluginInspect(c *check.C) { } // Test case for https://github.com/docker/docker/pull/29186#discussion_r91277345 -func (s *DockerSuite) TestPluginInspectOnWindows(c *check.C) { +func (s *DockerSuite) TestPluginInspectOnWindows(c *testing.T) { // This test should work on Windows only testRequires(c, DaemonIsWindows) @@ -352,7 +352,7 @@ func (s *DockerSuite) TestPluginInspectOnWindows(c *check.C) { assert.ErrorContains(c, err, "plugins are not supported on this platform") } -func (ps *DockerPluginSuite) TestPluginIDPrefix(c *check.C) { +func (ps *DockerPluginSuite) TestPluginIDPrefix(c *testing.T) { name := "test" client := testEnv.APIClient() @@ -409,7 +409,7 @@ func (ps *DockerPluginSuite) TestPluginIDPrefix(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), name) } -func (ps *DockerPluginSuite) TestPluginListDefaultFormat(c *check.C) { +func (ps *DockerPluginSuite) TestPluginListDefaultFormat(c *testing.T) { config, err := ioutil.TempDir("", "config-file-") assert.NilError(c, err) defer os.RemoveAll(config) @@ -440,7 +440,7 @@ enabled: false`, id, name) assert.Assert(c, strings.TrimSpace(out), checker.Contains, expectedOutput) } -func (s *DockerSuite) TestPluginUpgrade(c *check.C) { +func (s *DockerSuite) TestPluginUpgrade(c *testing.T) { testRequires(c, DaemonIsLinux, Network, testEnv.IsLocalDaemon, IsAmd64, NotUserNamespace) plugin := "cpuguy83/docker-volume-driver-plugin-local:latest" pluginV2 := "cpuguy83/docker-volume-driver-plugin-local:v2" @@ -472,7 +472,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *check.C) { dockerCmd(c, "run", "--rm", "-v", "bananas:/apple", "busybox", "sh", "-c", "ls -lh /apple/core") } -func (s *DockerSuite) TestPluginMetricsCollector(c *check.C) { +func (s *DockerSuite) TestPluginMetricsCollector(c *testing.T) { testRequires(c, DaemonIsLinux, Network, testEnv.IsLocalDaemon, IsAmd64) d := daemon.New(c, dockerBinary, dockerdBinary) d.Start(c) diff --git a/integration-cli/docker_cli_port_test.go b/integration-cli/docker_cli_port_test.go index fd43b0a94e..09407d92ee 100644 --- a/integration-cli/docker_cli_port_test.go +++ b/integration-cli/docker_cli_port_test.go @@ -13,7 +13,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSuite) TestPortList(c *check.C) { +func (s *DockerSuite) TestPortList(c *testing.T) { testRequires(c, DaemonIsLinux) // one port out, _ := dockerCmd(c, "run", "-d", "-p", "9876:80", "busybox", "top") @@ -157,7 +157,7 @@ func (s *DockerSuite) TestPortList(c *check.C) { dockerCmd(c, "rm", "-f", ID) } -func assertPortList(c *check.C, out string, expected []string) error { +func assertPortList(c *testing.T, out string, expected []string) error { lines := strings.Split(strings.Trim(out, "\n "), "\n") if len(lines) != len(expected) { return fmt.Errorf("different size lists %s, %d, %d", out, len(lines), len(expected)) @@ -174,7 +174,7 @@ func assertPortList(c *check.C, out string, expected []string) error { return nil } -func assertPortRange(c *check.C, out string, expectedTcp, expectedUdp []int) error { +func assertPortRange(c *testing.T, out string, expectedTcp, expectedUdp []int) error { lines := strings.Split(strings.Trim(out, "\n "), "\n") var validTcp, validUdp bool @@ -206,11 +206,11 @@ func assertPortRange(c *check.C, out string, expectedTcp, expectedUdp []int) err return nil } -func stopRemoveContainer(id string, c *check.C) { +func stopRemoveContainer(id string, c *testing.T) { dockerCmd(c, "rm", "-f", id) } -func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *check.C) { +func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *testing.T) { testRequires(c, DaemonIsLinux) // Run busybox with command line expose (equivalent to EXPOSE in image's Dockerfile) for the following ports port1 := 80 @@ -283,7 +283,7 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *check.C) { assert.Assert(c, out, checker.Contains, expBnd2) } -func (s *DockerSuite) TestPortHostBinding(c *check.C) { +func (s *DockerSuite) TestPortHostBinding(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) out, _ := dockerCmd(c, "run", "-d", "-p", "9876:80", "busybox", "nc", "-l", "-p", "80") @@ -305,7 +305,7 @@ func (s *DockerSuite) TestPortHostBinding(c *check.C) { assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out)) } -func (s *DockerSuite) TestPortExposeHostBinding(c *check.C) { +func (s *DockerSuite) TestPortExposeHostBinding(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) out, _ := dockerCmd(c, "run", "-d", "-P", "--expose", "80", "busybox", "nc", "-l", "-p", "80") @@ -327,7 +327,7 @@ func (s *DockerSuite) TestPortExposeHostBinding(c *check.C) { assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out)) } -func (s *DockerSuite) TestPortBindingOnSandbox(c *check.C) { +func (s *DockerSuite) TestPortBindingOnSandbox(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) dockerCmd(c, "network", "create", "--internal", "-d", "bridge", "internal-net") nr := getNetworkResource(c, "internal-net") diff --git a/integration-cli/docker_cli_proxy_test.go b/integration-cli/docker_cli_proxy_test.go index c444b611b5..2149ed03c5 100644 --- a/integration-cli/docker_cli_proxy_test.go +++ b/integration-cli/docker_cli_proxy_test.go @@ -9,7 +9,7 @@ import ( "gotest.tools/icmd" ) -func (s *DockerSuite) TestCLIProxyDisableProxyUnixSock(c *check.C) { +func (s *DockerSuite) TestCLIProxyDisableProxyUnixSock(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) icmd.RunCmd(icmd.Cmd{ @@ -20,7 +20,7 @@ func (s *DockerSuite) TestCLIProxyDisableProxyUnixSock(c *check.C) { // Can't use localhost here since go has a special case to not use proxy if connecting to localhost // See https://golang.org/pkg/net/http/#ProxyFromEnvironment -func (s *DockerDaemonSuite) TestCLIProxyProxyTCPSock(c *check.C) { +func (s *DockerDaemonSuite) TestCLIProxyProxyTCPSock(c *testing.T) { // get the IP to use to connect since we can't use localhost addrs, err := net.InterfaceAddrs() assert.NilError(c, err) diff --git a/integration-cli/docker_cli_prune_unix_test.go b/integration-cli/docker_cli_prune_unix_test.go index 2fc5e0eae8..b3cfd0bf94 100644 --- a/integration-cli/docker_cli_prune_unix_test.go +++ b/integration-cli/docker_cli_prune_unix_test.go @@ -19,12 +19,12 @@ import ( "gotest.tools/icmd" ) -func pruneNetworkAndVerify(c *check.C, d *daemon.Daemon, kept, pruned []string) { +func pruneNetworkAndVerify(c *testing.T, d *daemon.Daemon, kept, pruned []string) { _, err := d.Cmd("network", "prune", "--force") assert.NilError(c, err) for _, s := range kept { - waitAndAssert(c, defaultReconciliationTimeout, func(*check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, check.CommentInterface) { out, err := d.Cmd("network", "ls", "--format", "{{.Name}}") assert.NilError(c, err) return out, nil @@ -32,7 +32,7 @@ func pruneNetworkAndVerify(c *check.C, d *daemon.Daemon, kept, pruned []string) } for _, s := range pruned { - waitAndAssert(c, defaultReconciliationTimeout, func(*check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, check.CommentInterface) { out, err := d.Cmd("network", "ls", "--format", "{{.Name}}") assert.NilError(c, err) return out, nil @@ -40,7 +40,7 @@ func pruneNetworkAndVerify(c *check.C, d *daemon.Daemon, kept, pruned []string) } } -func (s *DockerSwarmSuite) TestPruneNetwork(c *check.C) { +func (s *DockerSwarmSuite) TestPruneNetwork(c *testing.T) { d := s.AddDaemon(c, true, true) _, err := d.Cmd("network", "create", "n1") // used by container (testprune) assert.NilError(c, err) @@ -79,7 +79,7 @@ func (s *DockerSwarmSuite) TestPruneNetwork(c *check.C) { pruneNetworkAndVerify(c, d, []string{}, []string{"n1", "n3"}) } -func (s *DockerDaemonSuite) TestPruneImageDangling(c *check.C) { +func (s *DockerDaemonSuite) TestPruneImageDangling(c *testing.T) { s.d.StartWithBusybox(c) result := cli.BuildCmd(c, "test", cli.Daemon(s.d), @@ -111,7 +111,7 @@ func (s *DockerDaemonSuite) TestPruneImageDangling(c *check.C) { assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id) } -func (s *DockerSuite) TestPruneContainerUntil(c *check.C) { +func (s *DockerSuite) TestPruneContainerUntil(c *testing.T) { out := cli.DockerCmd(c, "run", "-d", "busybox").Combined() id1 := strings.TrimSpace(out) cli.WaitExited(c, id1, 5*time.Second) @@ -131,7 +131,7 @@ func (s *DockerSuite) TestPruneContainerUntil(c *check.C) { assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) } -func (s *DockerSuite) TestPruneContainerLabel(c *check.C) { +func (s *DockerSuite) TestPruneContainerLabel(c *testing.T) { out := cli.DockerCmd(c, "run", "-d", "--label", "foo", "busybox").Combined() id1 := strings.TrimSpace(out) cli.WaitExited(c, id1, 5*time.Second) @@ -189,7 +189,7 @@ func (s *DockerSuite) TestPruneContainerLabel(c *check.C) { assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) } -func (s *DockerSuite) TestPruneVolumeLabel(c *check.C) { +func (s *DockerSuite) TestPruneVolumeLabel(c *testing.T) { out, _ := dockerCmd(c, "volume", "create", "--label", "foo") id1 := strings.TrimSpace(out) assert.Assert(c, id1, checker.Not(checker.Equals), "") @@ -247,7 +247,7 @@ func (s *DockerSuite) TestPruneVolumeLabel(c *check.C) { assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), id2) } -func (s *DockerSuite) TestPruneNetworkLabel(c *check.C) { +func (s *DockerSuite) TestPruneNetworkLabel(c *testing.T) { dockerCmd(c, "network", "create", "--label", "foo", "n1") dockerCmd(c, "network", "create", "--label", "bar", "n2") dockerCmd(c, "network", "create", "n3") @@ -268,7 +268,7 @@ func (s *DockerSuite) TestPruneNetworkLabel(c *check.C) { assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), "n3") } -func (s *DockerDaemonSuite) TestPruneImageLabel(c *check.C) { +func (s *DockerDaemonSuite) TestPruneImageLabel(c *testing.T) { s.d.StartWithBusybox(c) result := cli.BuildCmd(c, "test1", cli.Daemon(s.d), diff --git a/integration-cli/docker_cli_ps_test.go b/integration-cli/docker_cli_ps_test.go index 857b012aef..53a5e99082 100644 --- a/integration-cli/docker_cli_ps_test.go +++ b/integration-cli/docker_cli_ps_test.go @@ -18,7 +18,7 @@ import ( "gotest.tools/icmd" ) -func (s *DockerSuite) TestPsListContainersBase(c *check.C) { +func (s *DockerSuite) TestPsListContainersBase(c *testing.T) { existingContainers := ExistingContainerIDs(c) out := runSleepingContainer(c, "-d") @@ -139,7 +139,7 @@ func assertContainerList(out string, expected []string) bool { return true } -func (s *DockerSuite) TestPsListContainersSize(c *check.C) { +func (s *DockerSuite) TestPsListContainersSize(c *testing.T) { // Problematic on Windows as it doesn't report the size correctly @swernli testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "-d", "busybox") @@ -179,7 +179,7 @@ func (s *DockerSuite) TestPsListContainersSize(c *check.C) { assert.Assert(c, foundSize, checker.Contains, expectedSize, check.Commentf("Expected size %q, got %q", expectedSize, foundSize)) } -func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) { +func (s *DockerSuite) TestPsListContainersFilterStatus(c *testing.T) { existingContainers := ExistingContainerIDs(c) // start exited container @@ -226,7 +226,7 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) { } } -func (s *DockerSuite) TestPsListContainersFilterHealth(c *check.C) { +func (s *DockerSuite) TestPsListContainersFilterHealth(c *testing.T) { existingContainers := ExistingContainerIDs(c) // Test legacy no health check out := runSleepingContainer(c, "--name=none_legacy") @@ -269,7 +269,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *check.C) { assert.Assert(c, containerOut, checker.Equals, containerID, check.Commentf("Expected containerID %s, got %s for healthy filter, output: %q", containerID, containerOut, out)) } -func (s *DockerSuite) TestPsListContainersFilterID(c *check.C) { +func (s *DockerSuite) TestPsListContainersFilterID(c *testing.T) { // start container out, _ := dockerCmd(c, "run", "-d", "busybox") firstID := strings.TrimSpace(out) @@ -283,7 +283,7 @@ func (s *DockerSuite) TestPsListContainersFilterID(c *check.C) { assert.Assert(c, containerOut, checker.Equals, firstID[:12], check.Commentf("Expected id %s, got %s for exited filter, output: %q", firstID[:12], containerOut, out)) } -func (s *DockerSuite) TestPsListContainersFilterName(c *check.C) { +func (s *DockerSuite) TestPsListContainersFilterName(c *testing.T) { // start container dockerCmd(c, "run", "--name=a_name_to_match", "busybox") id := getIDByName(c, "a_name_to_match") @@ -305,7 +305,7 @@ func (s *DockerSuite) TestPsListContainersFilterName(c *check.C) { // - Create an image based on the previous image (images_ps_filter_test2) // - Run containers for each of those image (busybox, images_ps_filter_test1, images_ps_filter_test2) // - Filter them out :P -func (s *DockerSuite) TestPsListContainersFilterAncestorImage(c *check.C) { +func (s *DockerSuite) TestPsListContainersFilterAncestorImage(c *testing.T) { existingContainers := ExistingContainerIDs(c) // Build images @@ -378,7 +378,7 @@ func (s *DockerSuite) TestPsListContainersFilterAncestorImage(c *check.C) { checkPsAncestorFilterOutput(c, RemoveOutputForExistingElements(out, existingContainers), imageName2+","+imageName1Tagged, []string{fourthID, fifthID}) } -func checkPsAncestorFilterOutput(c *check.C, out string, filterName string, expectedIDs []string) { +func checkPsAncestorFilterOutput(c *testing.T, out string, filterName string, expectedIDs []string) { var actualIDs []string if out != "" { actualIDs = strings.Split(out[:len(out)-1], "\n") @@ -400,7 +400,7 @@ func checkPsAncestorFilterOutput(c *check.C, out string, filterName string, expe } } -func (s *DockerSuite) TestPsListContainersFilterLabel(c *check.C) { +func (s *DockerSuite) TestPsListContainersFilterLabel(c *testing.T) { // start container dockerCmd(c, "run", "--name=first", "-l", "match=me", "-l", "second=tag", "busybox") firstID := getIDByName(c, "first") @@ -436,7 +436,7 @@ func (s *DockerSuite) TestPsListContainersFilterLabel(c *check.C) { assert.Assert(c, containerOut, checker.Not(checker.Contains), thirdID) } -func (s *DockerSuite) TestPsListContainersFilterExited(c *check.C) { +func (s *DockerSuite) TestPsListContainersFilterExited(c *testing.T) { runSleepingContainer(c, "--name=sleep") firstZero, _ := dockerCmd(c, "run", "-d", "busybox", "true") @@ -464,7 +464,7 @@ func (s *DockerSuite) TestPsListContainersFilterExited(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), strings.TrimSpace(secondZero)) } -func (s *DockerSuite) TestPsRightTagName(c *check.C) { +func (s *DockerSuite) TestPsRightTagName(c *testing.T) { // TODO Investigate further why this fails on Windows to Windows CI testRequires(c, DaemonIsLinux) @@ -510,7 +510,7 @@ func (s *DockerSuite) TestPsRightTagName(c *check.C) { } } -func (s *DockerSuite) TestPsListContainersFilterCreated(c *check.C) { +func (s *DockerSuite) TestPsListContainersFilterCreated(c *testing.T) { // create a container out, _ := dockerCmd(c, "create", "busybox") cID := strings.TrimSpace(out) @@ -541,7 +541,7 @@ func (s *DockerSuite) TestPsListContainersFilterCreated(c *check.C) { } // Test for GitHub issue #12595 -func (s *DockerSuite) TestPsImageIDAfterUpdate(c *check.C) { +func (s *DockerSuite) TestPsImageIDAfterUpdate(c *testing.T) { // TODO: Investigate why this fails on Windows to Windows CI further. testRequires(c, DaemonIsLinux) originalImageName := "busybox:TestPsImageIDAfterUpdate-original" @@ -590,7 +590,7 @@ func (s *DockerSuite) TestPsImageIDAfterUpdate(c *check.C) { } -func (s *DockerSuite) TestPsNotShowPortsOfStoppedContainer(c *check.C) { +func (s *DockerSuite) TestPsNotShowPortsOfStoppedContainer(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "--name=foo", "-d", "-p", "5000:5000", "busybox", "top") assert.Assert(c, waitRun("foo"), checker.IsNil) @@ -608,7 +608,7 @@ func (s *DockerSuite) TestPsNotShowPortsOfStoppedContainer(c *check.C) { assert.Assert(c, fields[len(fields)-2], checker.Not(checker.Equals), expected, check.Commentf("Should not got %v", expected)) } -func (s *DockerSuite) TestPsShowMounts(c *check.C) { +func (s *DockerSuite) TestPsShowMounts(c *testing.T) { existingContainers := ExistingContainerNames(c) prefix, slash := getPrefixAndSlashFromDaemonPlatform() @@ -708,7 +708,7 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) { assert.Assert(c, strings.TrimSpace(string(out)), checker.HasLen, 0) } -func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) { +func (s *DockerSuite) TestPsListContainersFilterNetwork(c *testing.T) { existing := ExistingContainerIDs(c) // TODO default network on Windows is not called "bridge", and creating a @@ -788,7 +788,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) { } -func (s *DockerSuite) TestPsByOrder(c *check.C) { +func (s *DockerSuite) TestPsByOrder(c *testing.T) { out := runSleepingContainer(c, "--name", "xyz-abc") container1 := strings.TrimSpace(out) @@ -807,7 +807,7 @@ func (s *DockerSuite) TestPsByOrder(c *check.C) { assert.Equal(c, strings.TrimSpace(out), fmt.Sprintf("%s\n%s", container2, container1)) } -func (s *DockerSuite) TestPsListContainersFilterPorts(c *check.C) { +func (s *DockerSuite) TestPsListContainersFilterPorts(c *testing.T) { testRequires(c, DaemonIsLinux) existingContainers := ExistingContainerIDs(c) @@ -843,7 +843,7 @@ func (s *DockerSuite) TestPsListContainersFilterPorts(c *check.C) { assert.Equal(c, strings.TrimSpace(out), id2) } -func (s *DockerSuite) TestPsNotShowLinknamesOfDeletedContainer(c *check.C) { +func (s *DockerSuite) TestPsNotShowLinknamesOfDeletedContainer(c *testing.T) { testRequires(c, DaemonIsLinux, MinimumAPIVersion("1.31")) existingContainers := ExistingContainerNames(c) diff --git a/integration-cli/docker_cli_pull_local_test.go b/integration-cli/docker_cli_pull_local_test.go index 8f4fa0601a..a429982dfb 100644 --- a/integration-cli/docker_cli_pull_local_test.go +++ b/integration-cli/docker_cli_pull_local_test.go @@ -25,7 +25,7 @@ import ( // tags for the same image) are not also pulled down. // // Ref: docker/docker#8141 -func testPullImageWithAliases(c *check.C) { +func testPullImageWithAliases(c *testing.T) { repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) var repos []string @@ -52,16 +52,16 @@ func testPullImageWithAliases(c *check.C) { } } -func (s *DockerRegistrySuite) TestPullImageWithAliases(c *check.C) { +func (s *DockerRegistrySuite) TestPullImageWithAliases(c *testing.T) { testPullImageWithAliases(c) } -func (s *DockerSchema1RegistrySuite) TestPullImageWithAliases(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPullImageWithAliases(c *testing.T) { testPullImageWithAliases(c) } // testConcurrentPullWholeRepo pulls the same repo concurrently. -func testConcurrentPullWholeRepo(c *check.C) { +func testConcurrentPullWholeRepo(c *testing.T) { repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) var repos []string @@ -108,16 +108,16 @@ func testConcurrentPullWholeRepo(c *check.C) { } } -func (s *DockerRegistrySuite) testConcurrentPullWholeRepo(c *check.C) { +func (s *DockerRegistrySuite) testConcurrentPullWholeRepo(c *testing.T) { testConcurrentPullWholeRepo(c) } -func (s *DockerSchema1RegistrySuite) testConcurrentPullWholeRepo(c *check.C) { +func (s *DockerSchema1RegistrySuite) testConcurrentPullWholeRepo(c *testing.T) { testConcurrentPullWholeRepo(c) } // testConcurrentFailingPull tries a concurrent pull that doesn't succeed. -func testConcurrentFailingPull(c *check.C) { +func testConcurrentFailingPull(c *testing.T) { repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) // Run multiple pulls concurrently @@ -139,17 +139,17 @@ func testConcurrentFailingPull(c *check.C) { } } -func (s *DockerRegistrySuite) testConcurrentFailingPull(c *check.C) { +func (s *DockerRegistrySuite) testConcurrentFailingPull(c *testing.T) { testConcurrentFailingPull(c) } -func (s *DockerSchema1RegistrySuite) testConcurrentFailingPull(c *check.C) { +func (s *DockerSchema1RegistrySuite) testConcurrentFailingPull(c *testing.T) { testConcurrentFailingPull(c) } // testConcurrentPullMultipleTags pulls multiple tags from the same repo // concurrently. -func testConcurrentPullMultipleTags(c *check.C) { +func testConcurrentPullMultipleTags(c *testing.T) { repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) var repos []string @@ -195,17 +195,17 @@ func testConcurrentPullMultipleTags(c *check.C) { } } -func (s *DockerRegistrySuite) TestConcurrentPullMultipleTags(c *check.C) { +func (s *DockerRegistrySuite) TestConcurrentPullMultipleTags(c *testing.T) { testConcurrentPullMultipleTags(c) } -func (s *DockerSchema1RegistrySuite) TestConcurrentPullMultipleTags(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestConcurrentPullMultipleTags(c *testing.T) { testConcurrentPullMultipleTags(c) } // testPullIDStability verifies that pushing an image and pulling it back // preserves the image ID. -func testPullIDStability(c *check.C) { +func testPullIDStability(c *testing.T) { derivedImage := privateRegistryURL + "/dockercli/id-stability" baseImage := "busybox" @@ -256,16 +256,16 @@ func testPullIDStability(c *check.C) { } } -func (s *DockerRegistrySuite) TestPullIDStability(c *check.C) { +func (s *DockerRegistrySuite) TestPullIDStability(c *testing.T) { testPullIDStability(c) } -func (s *DockerSchema1RegistrySuite) TestPullIDStability(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPullIDStability(c *testing.T) { testPullIDStability(c) } // #21213 -func testPullNoLayers(c *check.C) { +func testPullNoLayers(c *testing.T) { repoName := fmt.Sprintf("%v/dockercli/scratch", privateRegistryURL) buildImageSuccessfully(c, repoName, build.WithDockerfile(` @@ -276,15 +276,15 @@ func testPullNoLayers(c *check.C) { dockerCmd(c, "pull", repoName) } -func (s *DockerRegistrySuite) TestPullNoLayers(c *check.C) { +func (s *DockerRegistrySuite) TestPullNoLayers(c *testing.T) { testPullNoLayers(c) } -func (s *DockerSchema1RegistrySuite) TestPullNoLayers(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPullNoLayers(c *testing.T) { testPullNoLayers(c) } -func (s *DockerRegistrySuite) TestPullManifestList(c *check.C) { +func (s *DockerRegistrySuite) TestPullManifestList(c *testing.T) { testRequires(c, NotArm) pushDigest, err := setupImage(c) assert.NilError(c, err, "error setting up image") @@ -368,7 +368,7 @@ func (s *DockerRegistrySuite) TestPullManifestList(c *check.C) { } // #23100 -func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuthLoginWithScheme(c *check.C) { +func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuthLoginWithScheme(c *testing.T) { osPath := os.Getenv("PATH") defer os.Setenv("PATH", osPath) @@ -413,7 +413,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuthLoginWithSchem dockerCmd(c, "--config", tmp, "logout", "https://"+privateRegistryURL) } -func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuth(c *check.C) { +func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuth(c *testing.T) { osPath := os.Getenv("PATH") defer os.Setenv("PATH", osPath) @@ -449,7 +449,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuth(c *check.C) { } // TestRunImplicitPullWithNoTag should pull implicitly only the default tag (latest) -func (s *DockerRegistrySuite) TestRunImplicitPullWithNoTag(c *check.C) { +func (s *DockerRegistrySuite) TestRunImplicitPullWithNoTag(c *testing.T) { testRequires(c, DaemonIsLinux) repo := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) repoTag1 := fmt.Sprintf("%v:latest", repo) diff --git a/integration-cli/docker_cli_pull_test.go b/integration-cli/docker_cli_pull_test.go index 8526a10855..e7f80b2526 100644 --- a/integration-cli/docker_cli_pull_test.go +++ b/integration-cli/docker_cli_pull_test.go @@ -15,7 +15,7 @@ import ( // TestPullFromCentralRegistry pulls an image from the central registry and verifies that the client // prints all expected output. -func (s *DockerHubPullSuite) TestPullFromCentralRegistry(c *check.C) { +func (s *DockerHubPullSuite) TestPullFromCentralRegistry(c *testing.T) { testRequires(c, DaemonIsLinux) out := s.Cmd(c, "pull", "hello-world") defer deleteImages("hello-world") @@ -40,7 +40,7 @@ func (s *DockerHubPullSuite) TestPullFromCentralRegistry(c *check.C) { // TestPullNonExistingImage pulls non-existing images from the central registry, with different // combinations of implicit tag and library prefix. -func (s *DockerHubPullSuite) TestPullNonExistingImage(c *check.C) { +func (s *DockerHubPullSuite) TestPullNonExistingImage(c *testing.T) { testRequires(c, DaemonIsLinux) type entry struct { @@ -115,7 +115,7 @@ func (s *DockerHubPullSuite) TestPullNonExistingImage(c *check.C) { // that pulling the same image with different combinations of implicit elements of the image // reference (tag, repository, central registry url, ...) doesn't trigger a new pull nor leads to // multiple images. -func (s *DockerHubPullSuite) TestPullFromCentralRegistryImplicitRefParts(c *check.C) { +func (s *DockerHubPullSuite) TestPullFromCentralRegistryImplicitRefParts(c *testing.T) { testRequires(c, DaemonIsLinux) // Pull hello-world from v2 @@ -184,7 +184,7 @@ func (s *DockerHubPullSuite) TestPullFromCentralRegistryImplicitRefParts(c *chec } // TestPullScratchNotAllowed verifies that pulling 'scratch' is rejected. -func (s *DockerHubPullSuite) TestPullScratchNotAllowed(c *check.C) { +func (s *DockerHubPullSuite) TestPullScratchNotAllowed(c *testing.T) { testRequires(c, DaemonIsLinux) out, err := s.CmdWithError("pull", "scratch") assert.ErrorContains(c, err, "", "expected pull of scratch to fail") @@ -194,7 +194,7 @@ func (s *DockerHubPullSuite) TestPullScratchNotAllowed(c *check.C) { // TestPullAllTagsFromCentralRegistry pulls using `all-tags` for a given image and verifies that it // results in more images than a naked pull. -func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) { +func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *testing.T) { testRequires(c, DaemonIsLinux) s.Cmd(c, "pull", "dockercore/engine-pull-all-test-fixture") outImageCmd := s.Cmd(c, "images", "dockercore/engine-pull-all-test-fixture") @@ -238,7 +238,7 @@ func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) { // gets cancelled. // // Ref: docker/docker#15589 -func (s *DockerHubPullSuite) TestPullClientDisconnect(c *check.C) { +func (s *DockerHubPullSuite) TestPullClientDisconnect(c *testing.T) { testRequires(c, DaemonIsLinux) repoName := "hello-world:latest" @@ -263,14 +263,14 @@ func (s *DockerHubPullSuite) TestPullClientDisconnect(c *check.C) { } // Regression test for https://github.com/docker/docker/issues/26429 -func (s *DockerSuite) TestPullLinuxImageFailsOnWindows(c *check.C) { +func (s *DockerSuite) TestPullLinuxImageFailsOnWindows(c *testing.T) { testRequires(c, DaemonIsWindows, Network) _, _, err := dockerCmdWithError("pull", "ubuntu") assert.ErrorContains(c, err, "no matching manifest for windows") } // Regression test for https://github.com/docker/docker/issues/28892 -func (s *DockerSuite) TestPullWindowsImageFailsOnLinux(c *check.C) { +func (s *DockerSuite) TestPullWindowsImageFailsOnLinux(c *testing.T) { testRequires(c, DaemonIsLinux, Network) _, _, err := dockerCmdWithError("pull", "mcr.microsoft.com/windows/servercore:ltsc2019") assert.ErrorContains(c, err, "no matching manifest for linux") diff --git a/integration-cli/docker_cli_push_test.go b/integration-cli/docker_cli_push_test.go index 60d5811ff9..5c3c8aa035 100644 --- a/integration-cli/docker_cli_push_test.go +++ b/integration-cli/docker_cli_push_test.go @@ -18,7 +18,7 @@ import ( ) // Pushing an image to a private registry. -func testPushBusyboxImage(c *check.C) { +func testPushBusyboxImage(c *testing.T) { repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) // tag the image to upload it to the private registry dockerCmd(c, "tag", "busybox", repoName) @@ -26,21 +26,21 @@ func testPushBusyboxImage(c *check.C) { dockerCmd(c, "push", repoName) } -func (s *DockerRegistrySuite) TestPushBusyboxImage(c *check.C) { +func (s *DockerRegistrySuite) TestPushBusyboxImage(c *testing.T) { testPushBusyboxImage(c) } -func (s *DockerSchema1RegistrySuite) TestPushBusyboxImage(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPushBusyboxImage(c *testing.T) { testPushBusyboxImage(c) } // pushing an image without a prefix should throw an error -func (s *DockerSuite) TestPushUnprefixedRepo(c *check.C) { +func (s *DockerSuite) TestPushUnprefixedRepo(c *testing.T) { out, _, err := dockerCmdWithError("push", "busybox") assert.ErrorContains(c, err, "", "pushing an unprefixed repo didn't result in a non-zero exit status: %s", out) } -func testPushUntagged(c *check.C) { +func testPushUntagged(c *testing.T) { repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) expected := "An image does not exist locally with the tag" @@ -49,15 +49,15 @@ func testPushUntagged(c *check.C) { assert.Assert(c, strings.Contains(out, expected), "pushing the image failed") } -func (s *DockerRegistrySuite) TestPushUntagged(c *check.C) { +func (s *DockerRegistrySuite) TestPushUntagged(c *testing.T) { testPushUntagged(c) } -func (s *DockerSchema1RegistrySuite) TestPushUntagged(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPushUntagged(c *testing.T) { testPushUntagged(c) } -func testPushBadTag(c *check.C) { +func testPushBadTag(c *testing.T) { repoName := fmt.Sprintf("%v/dockercli/busybox:latest", privateRegistryURL) expected := "does not exist" @@ -66,15 +66,15 @@ func testPushBadTag(c *check.C) { assert.Assert(c, strings.Contains(out, expected), "pushing the image failed") } -func (s *DockerRegistrySuite) TestPushBadTag(c *check.C) { +func (s *DockerRegistrySuite) TestPushBadTag(c *testing.T) { testPushBadTag(c) } -func (s *DockerSchema1RegistrySuite) TestPushBadTag(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPushBadTag(c *testing.T) { testPushBadTag(c) } -func testPushMultipleTags(c *check.C) { +func testPushMultipleTags(c *testing.T) { repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) repoTag1 := fmt.Sprintf("%v/dockercli/busybox:t1", privateRegistryURL) repoTag2 := fmt.Sprintf("%v/dockercli/busybox:t2", privateRegistryURL) @@ -111,15 +111,15 @@ func testPushMultipleTags(c *check.C) { } } -func (s *DockerRegistrySuite) TestPushMultipleTags(c *check.C) { +func (s *DockerRegistrySuite) TestPushMultipleTags(c *testing.T) { testPushMultipleTags(c) } -func (s *DockerSchema1RegistrySuite) TestPushMultipleTags(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPushMultipleTags(c *testing.T) { testPushMultipleTags(c) } -func testPushEmptyLayer(c *check.C) { +func testPushEmptyLayer(c *testing.T) { repoName := fmt.Sprintf("%v/dockercli/emptylayer", privateRegistryURL) emptyTarball, err := ioutil.TempFile("", "empty_tarball") assert.NilError(c, err, "Unable to create test file") @@ -142,17 +142,17 @@ func testPushEmptyLayer(c *check.C) { assert.NilError(c, err, "pushing the image to the private registry has failed: %s", out) } -func (s *DockerRegistrySuite) TestPushEmptyLayer(c *check.C) { +func (s *DockerRegistrySuite) TestPushEmptyLayer(c *testing.T) { testPushEmptyLayer(c) } -func (s *DockerSchema1RegistrySuite) TestPushEmptyLayer(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestPushEmptyLayer(c *testing.T) { testPushEmptyLayer(c) } // testConcurrentPush pushes multiple tags to the same repo // concurrently. -func testConcurrentPush(c *check.C) { +func testConcurrentPush(c *testing.T) { repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) var repos []string @@ -196,15 +196,15 @@ func testConcurrentPush(c *check.C) { } } -func (s *DockerRegistrySuite) TestConcurrentPush(c *check.C) { +func (s *DockerRegistrySuite) TestConcurrentPush(c *testing.T) { testConcurrentPush(c) } -func (s *DockerSchema1RegistrySuite) TestConcurrentPush(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestConcurrentPush(c *testing.T) { testConcurrentPush(c) } -func (s *DockerRegistrySuite) TestCrossRepositoryLayerPush(c *check.C) { +func (s *DockerRegistrySuite) TestCrossRepositoryLayerPush(c *testing.T) { sourceRepoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) // tag the image to upload it to the private registry dockerCmd(c, "tag", "busybox", sourceRepoName) @@ -246,7 +246,7 @@ func (s *DockerRegistrySuite) TestCrossRepositoryLayerPush(c *check.C) { assert.Equal(c, out4, "hello world") } -func (s *DockerSchema1RegistrySuite) TestCrossRepositoryLayerPushNotSupported(c *check.C) { +func (s *DockerSchema1RegistrySuite) TestCrossRepositoryLayerPushNotSupported(c *testing.T) { sourceRepoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL) // tag the image to upload it to the private registry dockerCmd(c, "tag", "busybox", sourceRepoName) @@ -279,7 +279,7 @@ func (s *DockerSchema1RegistrySuite) TestCrossRepositoryLayerPushNotSupported(c assert.Assert(c, out3 == "hello world") } -func (s *DockerRegistryAuthHtpasswdSuite) TestPushNoCredentialsNoRetry(c *check.C) { +func (s *DockerRegistryAuthHtpasswdSuite) TestPushNoCredentialsNoRetry(c *testing.T) { repoName := fmt.Sprintf("%s/busybox", privateRegistryURL) dockerCmd(c, "tag", "busybox", repoName) out, _, err := dockerCmdWithError("push", repoName) @@ -289,7 +289,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPushNoCredentialsNoRetry(c *check. } // This may be flaky but it's needed not to regress on unauthorized push, see #21054 -func (s *DockerSuite) TestPushToCentralRegistryUnauthorized(c *check.C) { +func (s *DockerSuite) TestPushToCentralRegistryUnauthorized(c *testing.T) { testRequires(c, Network) repoName := "test/busybox" dockerCmd(c, "tag", "busybox", repoName) @@ -316,7 +316,7 @@ func getTestTokenService(status int, body string, retries int) *httptest.Server })) } -func (s *DockerRegistryAuthTokenSuite) TestPushTokenServiceUnauthResponse(c *check.C) { +func (s *DockerRegistryAuthTokenSuite) TestPushTokenServiceUnauthResponse(c *testing.T) { ts := getTestTokenService(http.StatusUnauthorized, `{"errors": [{"Code":"UNAUTHORIZED", "message": "a message", "detail": null}]}`, 0) defer ts.Close() s.setupRegistryWithTokenService(c, ts.URL) @@ -328,7 +328,7 @@ func (s *DockerRegistryAuthTokenSuite) TestPushTokenServiceUnauthResponse(c *che assert.Assert(c, strings.Contains(out, "unauthorized: a message")) } -func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseUnauthorized(c *check.C) { +func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseUnauthorized(c *testing.T) { ts := getTestTokenService(http.StatusUnauthorized, `{"error": "unauthorized"}`, 0) defer ts.Close() s.setupRegistryWithTokenService(c, ts.URL) @@ -341,7 +341,7 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse assert.Equal(c, split[len(split)-2], "unauthorized: authentication required") } -func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseError(c *check.C) { +func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseError(c *testing.T) { ts := getTestTokenService(http.StatusTooManyRequests, `{"errors": [{"code":"TOOMANYREQUESTS","message":"out of tokens"}]}`, 3) defer ts.Close() s.setupRegistryWithTokenService(c, ts.URL) @@ -356,7 +356,7 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse assert.Equal(c, split[len(split)-2], "toomanyrequests: out of tokens") } -func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseUnparsable(c *check.C) { +func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseUnparsable(c *testing.T) { ts := getTestTokenService(http.StatusForbidden, `no way`, 0) defer ts.Close() s.setupRegistryWithTokenService(c, ts.URL) @@ -369,7 +369,7 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse assert.Assert(c, strings.Contains(split[len(split)-2], "error parsing HTTP 403 response body: ")) } -func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseNoToken(c *check.C) { +func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseNoToken(c *testing.T) { ts := getTestTokenService(http.StatusOK, `{"something": "wrong"}`, 0) defer ts.Close() s.setupRegistryWithTokenService(c, ts.URL) diff --git a/integration-cli/docker_cli_registry_user_agent_test.go b/integration-cli/docker_cli_registry_user_agent_test.go index 90f7c8e7c3..8dc825cc94 100644 --- a/integration-cli/docker_cli_registry_user_agent_test.go +++ b/integration-cli/docker_cli_registry_user_agent_test.go @@ -29,7 +29,7 @@ func unescapeBackslashSemicolonParens(s string) string { return string(ret) } -func regexpCheckUA(c *check.C, ua string) { +func regexpCheckUA(c *testing.T, ua string) { re := regexp.MustCompile("(?P.+) UpstreamClient(?P.+)") substrArr := re.FindStringSubmatch(ua) @@ -71,7 +71,7 @@ func registerUserAgentHandler(reg *registry.Mock, result *string) { // TestUserAgentPassThrough verifies that when an image is pulled from // a registry, the registry should see a User-Agent string of the form // [docker engine UA] UpstreamClientSTREAM-CLIENT([client UA]) -func (s *DockerRegistrySuite) TestUserAgentPassThrough(c *check.C) { +func (s *DockerRegistrySuite) TestUserAgentPassThrough(c *testing.T) { var ua string reg, err := registry.NewMock(c) diff --git a/integration-cli/docker_cli_restart_test.go b/integration-cli/docker_cli_restart_test.go index f6c41d5519..d2e15dda0c 100644 --- a/integration-cli/docker_cli_restart_test.go +++ b/integration-cli/docker_cli_restart_test.go @@ -12,7 +12,7 @@ import ( is "gotest.tools/assert/cmp" ) -func (s *DockerSuite) TestRestartStoppedContainer(c *check.C) { +func (s *DockerSuite) TestRestartStoppedContainer(c *testing.T) { dockerCmd(c, "run", "--name=test", "busybox", "echo", "foobar") cleanedContainerID := getIDByName(c, "test") @@ -29,14 +29,14 @@ func (s *DockerSuite) TestRestartStoppedContainer(c *check.C) { assert.Equal(c, out, "foobar\nfoobar\n") } -func (s *DockerSuite) TestRestartRunningContainer(c *check.C) { +func (s *DockerSuite) TestRestartRunningContainer(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "echo foobar && sleep 30 && echo 'should not print this'") cleanedContainerID := strings.TrimSpace(out) assert.NilError(c, waitRun(cleanedContainerID)) - getLogs := func(c *check.C) (interface{}, check.CommentInterface) { + getLogs := func(c *testing.T) (interface{}, check.CommentInterface) { out, _ := dockerCmd(c, "logs", cleanedContainerID) return out, nil } @@ -52,7 +52,7 @@ func (s *DockerSuite) TestRestartRunningContainer(c *check.C) { } // Test that restarting a container with a volume does not create a new volume on restart. Regression test for #819. -func (s *DockerSuite) TestRestartWithVolumes(c *check.C) { +func (s *DockerSuite) TestRestartWithVolumes(c *testing.T) { prefix, slash := getPrefixAndSlashFromDaemonPlatform() out := runSleepingContainer(c, "-d", "-v", prefix+slash+"test") @@ -77,7 +77,7 @@ func (s *DockerSuite) TestRestartWithVolumes(c *check.C) { assert.Equal(c, source, sourceAfterRestart) } -func (s *DockerSuite) TestRestartDisconnectedContainer(c *check.C) { +func (s *DockerSuite) TestRestartDisconnectedContainer(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon, NotUserNamespace, NotArm) // Run a container on the default bridge network @@ -94,7 +94,7 @@ func (s *DockerSuite) TestRestartDisconnectedContainer(c *check.C) { assert.Assert(c, exitCode == 0, out) } -func (s *DockerSuite) TestRestartPolicyNO(c *check.C) { +func (s *DockerSuite) TestRestartPolicyNO(c *testing.T) { out, _ := dockerCmd(c, "create", "--restart=no", "busybox") id := strings.TrimSpace(string(out)) @@ -102,7 +102,7 @@ func (s *DockerSuite) TestRestartPolicyNO(c *check.C) { assert.Equal(c, name, "no") } -func (s *DockerSuite) TestRestartPolicyAlways(c *check.C) { +func (s *DockerSuite) TestRestartPolicyAlways(c *testing.T) { out, _ := dockerCmd(c, "create", "--restart=always", "busybox") id := strings.TrimSpace(string(out)) @@ -115,7 +115,7 @@ func (s *DockerSuite) TestRestartPolicyAlways(c *check.C) { assert.Equal(c, MaximumRetryCount, "0") } -func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) { +func (s *DockerSuite) TestRestartPolicyOnFailure(c *testing.T) { out, _, err := dockerCmdWithError("create", "--restart=on-failure:-1", "busybox") assert.ErrorContains(c, err, "", out) assert.Assert(c, strings.Contains(out, "maximum retry count cannot be negative")) @@ -150,7 +150,7 @@ func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) { // a good container with --restart=on-failure:3 // MaximumRetryCount!=0; RestartCount=0 -func (s *DockerSuite) TestRestartContainerwithGoodContainer(c *check.C) { +func (s *DockerSuite) TestRestartContainerwithGoodContainer(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "true") id := strings.TrimSpace(string(out)) @@ -164,7 +164,7 @@ func (s *DockerSuite) TestRestartContainerwithGoodContainer(c *check.C) { assert.Equal(c, MaximumRetryCount, "3") } -func (s *DockerSuite) TestRestartContainerSuccess(c *check.C) { +func (s *DockerSuite) TestRestartContainerSuccess(c *testing.T) { // Skipped for Hyper-V isolated containers. Test is currently written // such that it assumes there is a host process to kill. In Hyper-V // containers, the process is inside the utility VM, not on the host. @@ -193,7 +193,7 @@ func (s *DockerSuite) TestRestartContainerSuccess(c *check.C) { assert.NilError(c, err) } -func (s *DockerSuite) TestRestartWithPolicyUserDefinedNetwork(c *check.C) { +func (s *DockerSuite) TestRestartWithPolicyUserDefinedNetwork(c *testing.T) { // TODO Windows. This may be portable following HNS integration post TP5. testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon, NotUserNamespace, NotArm) dockerCmd(c, "network", "create", "-d", "bridge", "udNet") @@ -237,7 +237,7 @@ func (s *DockerSuite) TestRestartWithPolicyUserDefinedNetwork(c *check.C) { assert.NilError(c, err) } -func (s *DockerSuite) TestRestartPolicyAfterRestart(c *check.C) { +func (s *DockerSuite) TestRestartPolicyAfterRestart(c *testing.T) { // Skipped for Hyper-V isolated containers. Test is currently written // such that it assumes there is a host process to kill. In Hyper-V // containers, the process is inside the utility VM, not on the host. @@ -270,7 +270,7 @@ func (s *DockerSuite) TestRestartPolicyAfterRestart(c *check.C) { assert.NilError(c, err) } -func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *check.C) { +func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *testing.T) { out1, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "false") out2, _ := dockerCmd(c, "run", "-d", "--restart=always", "busybox", "false") @@ -301,7 +301,7 @@ func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *check.C) { assert.NilError(c, err) } -func (s *DockerSuite) TestRestartAutoRemoveContainer(c *check.C) { +func (s *DockerSuite) TestRestartAutoRemoveContainer(c *testing.T) { out := runSleepingContainer(c, "--rm") id := strings.TrimSpace(string(out)) diff --git a/integration-cli/docker_cli_rmi_test.go b/integration-cli/docker_cli_rmi_test.go index 6f0d251693..ae244a4030 100644 --- a/integration-cli/docker_cli_rmi_test.go +++ b/integration-cli/docker_cli_rmi_test.go @@ -14,7 +14,7 @@ import ( "gotest.tools/icmd" ) -func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) { +func (s *DockerSuite) TestRmiWithContainerFails(c *testing.T) { errSubstr := "is using it" // create a container @@ -35,7 +35,7 @@ func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) { assert.Assert(c, images, checker.Contains, "busybox") } -func (s *DockerSuite) TestRmiTag(c *check.C) { +func (s *DockerSuite) TestRmiTag(c *testing.T) { imagesBefore, _ := dockerCmd(c, "images", "-a") dockerCmd(c, "tag", "busybox", "utest:tag1") dockerCmd(c, "tag", "busybox", "utest/docker:tag2") @@ -63,7 +63,7 @@ func (s *DockerSuite) TestRmiTag(c *check.C) { } } -func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) { +func (s *DockerSuite) TestRmiImgIDMultipleTag(c *testing.T) { out := cli.DockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-one'").Combined() containerID := strings.TrimSpace(out) @@ -104,7 +104,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) { assert.Assert(c, imagesAfter, checker.Not(checker.Contains), imgID[:12], check.Commentf("ImageID:%q; ImagesAfter: %q", imgID, imagesAfter)) } -func (s *DockerSuite) TestRmiImgIDForce(c *check.C) { +func (s *DockerSuite) TestRmiImgIDForce(c *testing.T) { out := cli.DockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-test'").Combined() containerID := strings.TrimSpace(out) @@ -142,7 +142,7 @@ func (s *DockerSuite) TestRmiImgIDForce(c *check.C) { } // See https://github.com/docker/docker/issues/14116 -func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c *check.C) { +func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c *testing.T) { dockerfile := "FROM busybox\nRUN echo test 14116\n" buildImageSuccessfully(c, "test-14116", build.WithDockerfile(dockerfile)) imgID := getIDByName(c, "test-14116") @@ -157,7 +157,7 @@ func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c assert.Assert(c, out, checker.Contains, "(cannot be forced) - image is being used by running container") } -func (s *DockerSuite) TestRmiTagWithExistingContainers(c *check.C) { +func (s *DockerSuite) TestRmiTagWithExistingContainers(c *testing.T) { container := "test-delete-tag" newtag := "busybox:newtag" bb := "busybox:latest" @@ -169,7 +169,7 @@ func (s *DockerSuite) TestRmiTagWithExistingContainers(c *check.C) { assert.Assert(c, strings.Count(out, "Untagged: "), checker.Equals, 1) } -func (s *DockerSuite) TestRmiForceWithExistingContainers(c *check.C) { +func (s *DockerSuite) TestRmiForceWithExistingContainers(c *testing.T) { image := "busybox-clone" icmd.RunCmd(icmd.Cmd{ @@ -183,7 +183,7 @@ MAINTAINER foo`), dockerCmd(c, "rmi", "-f", image) } -func (s *DockerSuite) TestRmiWithMultipleRepositories(c *check.C) { +func (s *DockerSuite) TestRmiWithMultipleRepositories(c *testing.T) { newRepo := "127.0.0.1:5000/busybox" oldRepo := "busybox" newTag := "busybox:test" @@ -197,7 +197,7 @@ func (s *DockerSuite) TestRmiWithMultipleRepositories(c *check.C) { assert.Assert(c, out, checker.Contains, "Untagged: "+newTag) } -func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *check.C) { +func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *testing.T) { imageName := "rmiimage" tag1 := imageName + ":tag1" tag2 := imageName + ":tag2" @@ -215,7 +215,7 @@ func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *check.C) { assert.Assert(c, images, checker.Contains, imageName, check.Commentf("Built image missing %q; Images: %q", imageName, images)) } -func (s *DockerSuite) TestRmiBlank(c *check.C) { +func (s *DockerSuite) TestRmiBlank(c *testing.T) { out, _, err := dockerCmdWithError("rmi", " ") // Should have failed to delete ' ' image assert.ErrorContains(c, err, "") @@ -225,7 +225,7 @@ func (s *DockerSuite) TestRmiBlank(c *check.C) { assert.Assert(c, out, checker.Contains, "image name cannot be blank", check.Commentf("out: %s", out)) } -func (s *DockerSuite) TestRmiContainerImageNotFound(c *check.C) { +func (s *DockerSuite) TestRmiContainerImageNotFound(c *testing.T) { // Build 2 images for testing. imageNames := []string{"test1", "test2"} imageIds := make([]string, 2) @@ -251,7 +251,7 @@ func (s *DockerSuite) TestRmiContainerImageNotFound(c *check.C) { } // #13422 -func (s *DockerSuite) TestRmiUntagHistoryLayer(c *check.C) { +func (s *DockerSuite) TestRmiUntagHistoryLayer(c *testing.T) { image := "tmp1" // Build an image for testing. dockerfile := `FROM busybox @@ -295,7 +295,7 @@ RUN echo 2 #layer2 assert.Assert(c, out, checker.Contains, fmt.Sprintf("Untagged: %s:latest", newTag)) } -func (*DockerSuite) TestRmiParentImageFail(c *check.C) { +func (*DockerSuite) TestRmiParentImageFail(c *testing.T) { buildImageSuccessfully(c, "test", build.WithDockerfile(` FROM busybox RUN echo hello`)) @@ -308,7 +308,7 @@ func (*DockerSuite) TestRmiParentImageFail(c *check.C) { } } -func (s *DockerSuite) TestRmiWithParentInUse(c *check.C) { +func (s *DockerSuite) TestRmiWithParentInUse(c *testing.T) { out, _ := dockerCmd(c, "create", "busybox") cID := strings.TrimSpace(out) @@ -325,7 +325,7 @@ func (s *DockerSuite) TestRmiWithParentInUse(c *check.C) { } // #18873 -func (s *DockerSuite) TestRmiByIDHardConflict(c *check.C) { +func (s *DockerSuite) TestRmiByIDHardConflict(c *testing.T) { dockerCmd(c, "create", "busybox") imgID := inspectField(c, "busybox:latest", "Id") diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go index 3a34fdbb3a..cc2e4d9d50 100644 --- a/integration-cli/docker_cli_run_test.go +++ b/integration-cli/docker_cli_run_test.go @@ -41,7 +41,7 @@ import ( ) // "test123" should be printed by docker run -func (s *DockerSuite) TestRunEchoStdout(c *check.C) { +func (s *DockerSuite) TestRunEchoStdout(c *testing.T) { out, _ := dockerCmd(c, "run", "busybox", "echo", "test123") if out != "test123\n" { c.Fatalf("container should've printed 'test123', got '%s'", out) @@ -49,7 +49,7 @@ func (s *DockerSuite) TestRunEchoStdout(c *check.C) { } // "test" should be printed -func (s *DockerSuite) TestRunEchoNamedContainer(c *check.C) { +func (s *DockerSuite) TestRunEchoNamedContainer(c *testing.T) { out, _ := dockerCmd(c, "run", "--name", "testfoonamedcontainer", "busybox", "echo", "test") if out != "test\n" { c.Errorf("container should've printed 'test'") @@ -58,7 +58,7 @@ func (s *DockerSuite) TestRunEchoNamedContainer(c *check.C) { // docker run should not leak file descriptors. This test relies on Unix // specific functionality and cannot run on Windows. -func (s *DockerSuite) TestRunLeakyFileDescriptors(c *check.C) { +func (s *DockerSuite) TestRunLeakyFileDescriptors(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "busybox", "ls", "-C", "/proc/self/fd") @@ -70,7 +70,7 @@ func (s *DockerSuite) TestRunLeakyFileDescriptors(c *check.C) { // it should be possible to lookup Google DNS // this will fail when Internet access is unavailable -func (s *DockerSuite) TestRunLookupGoogleDNS(c *check.C) { +func (s *DockerSuite) TestRunLookupGoogleDNS(c *testing.T) { testRequires(c, Network, NotArm) if testEnv.OSType == "windows" { // nslookup isn't present in Windows busybox. Is built-in. Further, @@ -83,19 +83,19 @@ func (s *DockerSuite) TestRunLookupGoogleDNS(c *check.C) { } // the exit code should be 0 -func (s *DockerSuite) TestRunExitCodeZero(c *check.C) { +func (s *DockerSuite) TestRunExitCodeZero(c *testing.T) { dockerCmd(c, "run", "busybox", "true") } // the exit code should be 1 -func (s *DockerSuite) TestRunExitCodeOne(c *check.C) { +func (s *DockerSuite) TestRunExitCodeOne(c *testing.T) { _, exitCode, err := dockerCmdWithError("run", "busybox", "false") assert.ErrorContains(c, err, "") assert.Equal(c, exitCode, 1) } // it should be possible to pipe in data via stdin to a process running in a container -func (s *DockerSuite) TestRunStdinPipe(c *check.C) { +func (s *DockerSuite) TestRunStdinPipe(c *testing.T) { // TODO Windows: This needs some work to make compatible. testRequires(c, DaemonIsLinux) result := icmd.RunCmd(icmd.Cmd{ @@ -119,7 +119,7 @@ func (s *DockerSuite) TestRunStdinPipe(c *check.C) { } // the container's ID should be printed when starting a container in detached mode -func (s *DockerSuite) TestRunDetachedContainerIDPrinting(c *check.C) { +func (s *DockerSuite) TestRunDetachedContainerIDPrinting(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "busybox", "true") out = strings.TrimSpace(out) @@ -134,7 +134,7 @@ func (s *DockerSuite) TestRunDetachedContainerIDPrinting(c *check.C) { } // the working directory should be set correctly -func (s *DockerSuite) TestRunWorkingDirectory(c *check.C) { +func (s *DockerSuite) TestRunWorkingDirectory(c *testing.T) { dir := "/root" image := "busybox" if testEnv.OSType == "windows" { @@ -157,7 +157,7 @@ func (s *DockerSuite) TestRunWorkingDirectory(c *check.C) { } // pinging Google's DNS resolver should fail when we disable the networking -func (s *DockerSuite) TestRunWithoutNetworking(c *check.C) { +func (s *DockerSuite) TestRunWithoutNetworking(c *testing.T) { count := "-c" image := "busybox" if testEnv.OSType == "windows" { @@ -176,7 +176,7 @@ func (s *DockerSuite) TestRunWithoutNetworking(c *check.C) { } //test --link use container name to link target -func (s *DockerSuite) TestRunLinksContainerWithContainerName(c *check.C) { +func (s *DockerSuite) TestRunLinksContainerWithContainerName(c *testing.T) { // TODO Windows: This test cannot run on a Windows daemon as the networking // settings are not populated back yet on inspect. testRequires(c, DaemonIsLinux) @@ -191,7 +191,7 @@ func (s *DockerSuite) TestRunLinksContainerWithContainerName(c *check.C) { } //test --link use container id to link target -func (s *DockerSuite) TestRunLinksContainerWithContainerID(c *check.C) { +func (s *DockerSuite) TestRunLinksContainerWithContainerID(c *testing.T) { // TODO Windows: This test cannot run on a Windows daemon as the networking // settings are not populated back yet on inspect. testRequires(c, DaemonIsLinux) @@ -206,7 +206,7 @@ func (s *DockerSuite) TestRunLinksContainerWithContainerID(c *check.C) { } } -func (s *DockerSuite) TestUserDefinedNetworkLinks(c *check.C) { +func (s *DockerSuite) TestUserDefinedNetworkLinks(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) dockerCmd(c, "network", "create", "-d", "bridge", "udlinkNet") @@ -242,7 +242,7 @@ func (s *DockerSuite) TestUserDefinedNetworkLinks(c *check.C) { assert.NilError(c, err) } -func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *check.C) { +func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) dockerCmd(c, "network", "create", "-d", "bridge", "udlinkNet") @@ -280,7 +280,7 @@ func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *check.C) { assert.NilError(c, err) } -func (s *DockerSuite) TestRunWithNetAliasOnDefaultNetworks(c *check.C) { +func (s *DockerSuite) TestRunWithNetAliasOnDefaultNetworks(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) defaults := []string{"bridge", "host", "none"} @@ -291,7 +291,7 @@ func (s *DockerSuite) TestRunWithNetAliasOnDefaultNetworks(c *check.C) { } } -func (s *DockerSuite) TestUserDefinedNetworkAlias(c *check.C) { +func (s *DockerSuite) TestUserDefinedNetworkAlias(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) dockerCmd(c, "network", "create", "-d", "bridge", "net1") @@ -339,14 +339,14 @@ func (s *DockerSuite) TestUserDefinedNetworkAlias(c *check.C) { } // Issue 9677. -func (s *DockerSuite) TestRunWithDaemonFlags(c *check.C) { +func (s *DockerSuite) TestRunWithDaemonFlags(c *testing.T) { out, _, err := dockerCmdWithError("--exec-opt", "foo=bar", "run", "-i", "busybox", "true") assert.ErrorContains(c, err, "") assert.Assert(c, out, checker.Contains, "unknown flag: --exec-opt") } // Regression test for #4979 -func (s *DockerSuite) TestRunWithVolumesFromExited(c *check.C) { +func (s *DockerSuite) TestRunWithVolumesFromExited(c *testing.T) { var ( out string @@ -376,7 +376,7 @@ func (s *DockerSuite) TestRunWithVolumesFromExited(c *check.C) { // Volume path is a symlink which also exists on the host, and the host side is a file not a dir // But the volume call is just a normal volume, not a bind mount -func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) { +func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *testing.T) { var ( dockerFile string containerPath string @@ -420,7 +420,7 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) { } // Volume path is a symlink in the container -func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir2(c *check.C) { +func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir2(c *testing.T) { var ( dockerFile string containerPath string @@ -444,13 +444,13 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir2(c *check.C) { dockerCmd(c, "run", "-v", containerPath, name, cmd) } -func (s *DockerSuite) TestRunVolumesMountedAsReadonly(c *check.C) { +func (s *DockerSuite) TestRunVolumesMountedAsReadonly(c *testing.T) { if _, code, err := dockerCmdWithError("run", "-v", "/test:/test:ro", "busybox", "touch", "/test/somefile"); err == nil || code == 0 { c.Fatalf("run should fail because volume is ro: exit code %d", code) } } -func (s *DockerSuite) TestRunVolumesFromInReadonlyModeFails(c *check.C) { +func (s *DockerSuite) TestRunVolumesFromInReadonlyModeFails(c *testing.T) { var ( volumeDir string fileInVol string @@ -471,7 +471,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadonlyModeFails(c *check.C) { } // Regression test for #1201 -func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) { +func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *testing.T) { var ( volumeDir string fileInVol string @@ -494,7 +494,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) { dockerCmd(c, "run", "--volumes-from", "parent", "busybox", "touch", fileInVol) } -func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) { +func (s *DockerSuite) TestVolumesFromGetsProperMode(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) prefix, slash := getPrefixAndSlashFromDaemonPlatform() hostpath := RandomTmpDirPath("test", testEnv.OSType) @@ -519,7 +519,7 @@ func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) { } // Test for GH#10618 -func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) { +func (s *DockerSuite) TestRunNoDupVolumes(c *testing.T) { path1 := RandomTmpDirPath("test1", testEnv.OSType) path2 := RandomTmpDirPath("test2", testEnv.OSType) @@ -571,7 +571,7 @@ func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) { } // Test for #1351 -func (s *DockerSuite) TestRunApplyVolumesFromBeforeVolumes(c *check.C) { +func (s *DockerSuite) TestRunApplyVolumesFromBeforeVolumes(c *testing.T) { prefix := "" if testEnv.OSType == "windows" { prefix = `c:` @@ -580,7 +580,7 @@ func (s *DockerSuite) TestRunApplyVolumesFromBeforeVolumes(c *check.C) { dockerCmd(c, "run", "--volumes-from", "parent", "-v", prefix+"/test", "busybox", "cat", prefix+"/test/foo") } -func (s *DockerSuite) TestRunMultipleVolumesFrom(c *check.C) { +func (s *DockerSuite) TestRunMultipleVolumesFrom(c *testing.T) { prefix := "" if testEnv.OSType == "windows" { prefix = `c:` @@ -591,7 +591,7 @@ func (s *DockerSuite) TestRunMultipleVolumesFrom(c *check.C) { } // this tests verifies the ID format for the container -func (s *DockerSuite) TestRunVerifyContainerID(c *check.C) { +func (s *DockerSuite) TestRunVerifyContainerID(c *testing.T) { out, exit, err := dockerCmdWithError("run", "-d", "busybox", "true") if err != nil { c.Fatal(err) @@ -610,7 +610,7 @@ func (s *DockerSuite) TestRunVerifyContainerID(c *check.C) { } // Test that creating a container with a volume doesn't crash. Regression test for #995. -func (s *DockerSuite) TestRunCreateVolume(c *check.C) { +func (s *DockerSuite) TestRunCreateVolume(c *testing.T) { prefix := "" if testEnv.OSType == "windows" { prefix = `c:` @@ -620,7 +620,7 @@ func (s *DockerSuite) TestRunCreateVolume(c *check.C) { // Test that creating a volume with a symlink in its path works correctly. Test for #5152. // Note that this bug happens only with symlinks with a target that starts with '/'. -func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) { +func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *testing.T) { // Cannot run on Windows as relies on Linux-specific functionality (sh -c mount...) testRequires(c, DaemonIsLinux) workingDirectory, err := ioutil.TempDir("", "TestRunCreateVolumeWithSymlink") @@ -656,7 +656,7 @@ func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) { } // Tests that a volume path that has a symlink exists in a container mounting it with `--volumes-from`. -func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *check.C) { +func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *testing.T) { // This test cannot run on a Windows daemon as // Windows does not support symlinks inside a volume path testRequires(c, DaemonIsLinux) @@ -697,7 +697,7 @@ func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *check.C) { } } -func (s *DockerSuite) TestRunExitCode(c *check.C) { +func (s *DockerSuite) TestRunExitCode(c *testing.T) { var ( exit int err error @@ -713,7 +713,7 @@ func (s *DockerSuite) TestRunExitCode(c *check.C) { } } -func (s *DockerSuite) TestRunUserDefaults(c *check.C) { +func (s *DockerSuite) TestRunUserDefaults(c *testing.T) { expected := "uid=0(root) gid=0(root)" if testEnv.OSType == "windows" { expected = "uid=0(root) gid=0(root) groups=0(root)" @@ -724,7 +724,7 @@ func (s *DockerSuite) TestRunUserDefaults(c *check.C) { } } -func (s *DockerSuite) TestRunUserByName(c *check.C) { +func (s *DockerSuite) TestRunUserByName(c *testing.T) { // TODO Windows: This test cannot run on a Windows daemon as Windows does // not support the use of -u testRequires(c, DaemonIsLinux) @@ -734,7 +734,7 @@ func (s *DockerSuite) TestRunUserByName(c *check.C) { } } -func (s *DockerSuite) TestRunUserByID(c *check.C) { +func (s *DockerSuite) TestRunUserByID(c *testing.T) { // TODO Windows: This test cannot run on a Windows daemon as Windows does // not support the use of -u testRequires(c, DaemonIsLinux) @@ -744,7 +744,7 @@ func (s *DockerSuite) TestRunUserByID(c *check.C) { } } -func (s *DockerSuite) TestRunUserByIDBig(c *check.C) { +func (s *DockerSuite) TestRunUserByIDBig(c *testing.T) { // TODO Windows: This test cannot run on a Windows daemon as Windows does // not support the use of -u testRequires(c, DaemonIsLinux, NotArm) @@ -757,7 +757,7 @@ func (s *DockerSuite) TestRunUserByIDBig(c *check.C) { } } -func (s *DockerSuite) TestRunUserByIDNegative(c *check.C) { +func (s *DockerSuite) TestRunUserByIDNegative(c *testing.T) { // TODO Windows: This test cannot run on a Windows daemon as Windows does // not support the use of -u testRequires(c, DaemonIsLinux) @@ -770,7 +770,7 @@ func (s *DockerSuite) TestRunUserByIDNegative(c *check.C) { } } -func (s *DockerSuite) TestRunUserByIDZero(c *check.C) { +func (s *DockerSuite) TestRunUserByIDZero(c *testing.T) { // TODO Windows: This test cannot run on a Windows daemon as Windows does // not support the use of -u testRequires(c, DaemonIsLinux) @@ -783,7 +783,7 @@ func (s *DockerSuite) TestRunUserByIDZero(c *check.C) { } } -func (s *DockerSuite) TestRunUserNotFound(c *check.C) { +func (s *DockerSuite) TestRunUserNotFound(c *testing.T) { // TODO Windows: This test cannot run on a Windows daemon as Windows does // not support the use of -u testRequires(c, DaemonIsLinux) @@ -793,7 +793,7 @@ func (s *DockerSuite) TestRunUserNotFound(c *check.C) { } } -func (s *DockerSuite) TestRunTwoConcurrentContainers(c *check.C) { +func (s *DockerSuite) TestRunTwoConcurrentContainers(c *testing.T) { sleepTime := "2" group := sync.WaitGroup{} group.Add(2) @@ -815,7 +815,7 @@ func (s *DockerSuite) TestRunTwoConcurrentContainers(c *check.C) { } } -func (s *DockerSuite) TestRunEnvironment(c *check.C) { +func (s *DockerSuite) TestRunEnvironment(c *testing.T) { // TODO Windows: Environment handling is different between Linux and // Windows and this test relies currently on unix functionality. testRequires(c, DaemonIsLinux) @@ -854,7 +854,7 @@ func (s *DockerSuite) TestRunEnvironment(c *check.C) { } } -func (s *DockerSuite) TestRunEnvironmentErase(c *check.C) { +func (s *DockerSuite) TestRunEnvironmentErase(c *testing.T) { // TODO Windows: Environment handling is different between Linux and // Windows and this test relies currently on unix functionality. testRequires(c, DaemonIsLinux) @@ -887,7 +887,7 @@ func (s *DockerSuite) TestRunEnvironmentErase(c *check.C) { } } -func (s *DockerSuite) TestRunEnvironmentOverride(c *check.C) { +func (s *DockerSuite) TestRunEnvironmentOverride(c *testing.T) { // TODO Windows: Environment handling is different between Linux and // Windows and this test relies currently on unix functionality. testRequires(c, DaemonIsLinux) @@ -920,7 +920,7 @@ func (s *DockerSuite) TestRunEnvironmentOverride(c *check.C) { } } -func (s *DockerSuite) TestRunContainerNetwork(c *check.C) { +func (s *DockerSuite) TestRunContainerNetwork(c *testing.T) { if testEnv.OSType == "windows" { // Windows busybox does not have ping. Use built in ping instead. dockerCmd(c, "run", testEnv.PlatformDefaults.BaseImage, "ping", "-n", "1", "127.0.0.1") @@ -929,7 +929,7 @@ func (s *DockerSuite) TestRunContainerNetwork(c *check.C) { } } -func (s *DockerSuite) TestRunNetHostNotAllowedWithLinks(c *check.C) { +func (s *DockerSuite) TestRunNetHostNotAllowedWithLinks(c *testing.T) { // TODO Windows: This is Linux specific as --link is not supported and // this will be deprecated in favor of container networking model. testRequires(c, DaemonIsLinux, NotUserNamespace) @@ -946,7 +946,7 @@ func (s *DockerSuite) TestRunNetHostNotAllowedWithLinks(c *check.C) { // and use "--net=host" (as the original issue submitter did), as the same // codepath is executed with "docker run -h ". Both were manually // tested, but this testcase takes the simpler path of using "run -h .." -func (s *DockerSuite) TestRunFullHostnameSet(c *check.C) { +func (s *DockerSuite) TestRunFullHostnameSet(c *testing.T) { // TODO Windows: -h is not yet functional. testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-h", "foo.bar.baz", "busybox", "hostname") @@ -955,7 +955,7 @@ func (s *DockerSuite) TestRunFullHostnameSet(c *check.C) { } } -func (s *DockerSuite) TestRunPrivilegedCanMknod(c *check.C) { +func (s *DockerSuite) TestRunPrivilegedCanMknod(c *testing.T) { // Not applicable for Windows as Windows daemon does not support // the concept of --privileged, and mknod is a Unix concept. testRequires(c, DaemonIsLinux, NotUserNamespace) @@ -965,7 +965,7 @@ func (s *DockerSuite) TestRunPrivilegedCanMknod(c *check.C) { } } -func (s *DockerSuite) TestRunUnprivilegedCanMknod(c *check.C) { +func (s *DockerSuite) TestRunUnprivilegedCanMknod(c *testing.T) { // Not applicable for Windows as Windows daemon does not support // the concept of --privileged, and mknod is a Unix concept. testRequires(c, DaemonIsLinux, NotUserNamespace) @@ -975,7 +975,7 @@ func (s *DockerSuite) TestRunUnprivilegedCanMknod(c *check.C) { } } -func (s *DockerSuite) TestRunCapDropInvalid(c *check.C) { +func (s *DockerSuite) TestRunCapDropInvalid(c *testing.T) { // Not applicable for Windows as there is no concept of --cap-drop testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "--cap-drop=CHPASS", "busybox", "ls") @@ -984,7 +984,7 @@ func (s *DockerSuite) TestRunCapDropInvalid(c *check.C) { } } -func (s *DockerSuite) TestRunCapDropCannotMknod(c *check.C) { +func (s *DockerSuite) TestRunCapDropCannotMknod(c *testing.T) { // Not applicable for Windows as there is no concept of --cap-drop or mknod testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "--cap-drop=MKNOD", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok") @@ -997,7 +997,7 @@ func (s *DockerSuite) TestRunCapDropCannotMknod(c *check.C) { } } -func (s *DockerSuite) TestRunCapDropCannotMknodLowerCase(c *check.C) { +func (s *DockerSuite) TestRunCapDropCannotMknodLowerCase(c *testing.T) { // Not applicable for Windows as there is no concept of --cap-drop or mknod testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "--cap-drop=mknod", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok") @@ -1010,7 +1010,7 @@ func (s *DockerSuite) TestRunCapDropCannotMknodLowerCase(c *check.C) { } } -func (s *DockerSuite) TestRunCapDropALLCannotMknod(c *check.C) { +func (s *DockerSuite) TestRunCapDropALLCannotMknod(c *testing.T) { // Not applicable for Windows as there is no concept of --cap-drop or mknod testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "--cap-drop=ALL", "--cap-add=SETGID", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok") @@ -1022,7 +1022,7 @@ func (s *DockerSuite) TestRunCapDropALLCannotMknod(c *check.C) { } } -func (s *DockerSuite) TestRunCapDropALLAddMknodCanMknod(c *check.C) { +func (s *DockerSuite) TestRunCapDropALLAddMknodCanMknod(c *testing.T) { // Not applicable for Windows as there is no concept of --cap-drop or mknod testRequires(c, DaemonIsLinux, NotUserNamespace) out, _ := dockerCmd(c, "run", "--cap-drop=ALL", "--cap-add=MKNOD", "--cap-add=SETGID", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok") @@ -1032,7 +1032,7 @@ func (s *DockerSuite) TestRunCapDropALLAddMknodCanMknod(c *check.C) { } } -func (s *DockerSuite) TestRunCapAddInvalid(c *check.C) { +func (s *DockerSuite) TestRunCapAddInvalid(c *testing.T) { // Not applicable for Windows as there is no concept of --cap-add testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "--cap-add=CHPASS", "busybox", "ls") @@ -1041,7 +1041,7 @@ func (s *DockerSuite) TestRunCapAddInvalid(c *check.C) { } } -func (s *DockerSuite) TestRunCapAddCanDownInterface(c *check.C) { +func (s *DockerSuite) TestRunCapAddCanDownInterface(c *testing.T) { // Not applicable for Windows as there is no concept of --cap-add testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "--cap-add=NET_ADMIN", "busybox", "sh", "-c", "ip link set eth0 down && echo ok") @@ -1051,7 +1051,7 @@ func (s *DockerSuite) TestRunCapAddCanDownInterface(c *check.C) { } } -func (s *DockerSuite) TestRunCapAddALLCanDownInterface(c *check.C) { +func (s *DockerSuite) TestRunCapAddALLCanDownInterface(c *testing.T) { // Not applicable for Windows as there is no concept of --cap-add testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "--cap-add=ALL", "busybox", "sh", "-c", "ip link set eth0 down && echo ok") @@ -1061,7 +1061,7 @@ func (s *DockerSuite) TestRunCapAddALLCanDownInterface(c *check.C) { } } -func (s *DockerSuite) TestRunCapAddALLDropNetAdminCanDownInterface(c *check.C) { +func (s *DockerSuite) TestRunCapAddALLDropNetAdminCanDownInterface(c *testing.T) { // Not applicable for Windows as there is no concept of --cap-add testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "--cap-add=ALL", "--cap-drop=NET_ADMIN", "busybox", "sh", "-c", "ip link set eth0 down && echo ok") @@ -1073,7 +1073,7 @@ func (s *DockerSuite) TestRunCapAddALLDropNetAdminCanDownInterface(c *check.C) { } } -func (s *DockerSuite) TestRunGroupAdd(c *check.C) { +func (s *DockerSuite) TestRunGroupAdd(c *testing.T) { // Not applicable for Windows as there is no concept of --group-add testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "--group-add=audio", "--group-add=staff", "--group-add=777", "busybox", "sh", "-c", "id") @@ -1084,7 +1084,7 @@ func (s *DockerSuite) TestRunGroupAdd(c *check.C) { } } -func (s *DockerSuite) TestRunPrivilegedCanMount(c *check.C) { +func (s *DockerSuite) TestRunPrivilegedCanMount(c *testing.T) { // Not applicable for Windows as there is no concept of --privileged testRequires(c, DaemonIsLinux, NotUserNamespace) out, _ := dockerCmd(c, "run", "--privileged", "busybox", "sh", "-c", "mount -t tmpfs none /tmp && echo ok") @@ -1094,7 +1094,7 @@ func (s *DockerSuite) TestRunPrivilegedCanMount(c *check.C) { } } -func (s *DockerSuite) TestRunUnprivilegedCannotMount(c *check.C) { +func (s *DockerSuite) TestRunUnprivilegedCannotMount(c *testing.T) { // Not applicable for Windows as there is no concept of unprivileged testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "busybox", "sh", "-c", "mount -t tmpfs none /tmp && echo ok") @@ -1107,7 +1107,7 @@ func (s *DockerSuite) TestRunUnprivilegedCannotMount(c *check.C) { } } -func (s *DockerSuite) TestRunSysNotWritableInNonPrivilegedContainers(c *check.C) { +func (s *DockerSuite) TestRunSysNotWritableInNonPrivilegedContainers(c *testing.T) { // Not applicable for Windows as there is no concept of unprivileged testRequires(c, DaemonIsLinux, NotArm) if _, code, err := dockerCmdWithError("run", "busybox", "touch", "/sys/kernel/profiling"); err == nil || code == 0 { @@ -1115,7 +1115,7 @@ func (s *DockerSuite) TestRunSysNotWritableInNonPrivilegedContainers(c *check.C) } } -func (s *DockerSuite) TestRunSysWritableInPrivilegedContainers(c *check.C) { +func (s *DockerSuite) TestRunSysWritableInPrivilegedContainers(c *testing.T) { // Not applicable for Windows as there is no concept of unprivileged testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) if _, code, err := dockerCmdWithError("run", "--privileged", "busybox", "touch", "/sys/kernel/profiling"); err != nil || code != 0 { @@ -1123,7 +1123,7 @@ func (s *DockerSuite) TestRunSysWritableInPrivilegedContainers(c *check.C) { } } -func (s *DockerSuite) TestRunProcNotWritableInNonPrivilegedContainers(c *check.C) { +func (s *DockerSuite) TestRunProcNotWritableInNonPrivilegedContainers(c *testing.T) { // Not applicable for Windows as there is no concept of unprivileged testRequires(c, DaemonIsLinux) if _, code, err := dockerCmdWithError("run", "busybox", "touch", "/proc/sysrq-trigger"); err == nil || code == 0 { @@ -1131,7 +1131,7 @@ func (s *DockerSuite) TestRunProcNotWritableInNonPrivilegedContainers(c *check.C } } -func (s *DockerSuite) TestRunProcWritableInPrivilegedContainers(c *check.C) { +func (s *DockerSuite) TestRunProcWritableInPrivilegedContainers(c *testing.T) { // Not applicable for Windows as there is no concept of --privileged testRequires(c, DaemonIsLinux, NotUserNamespace) if _, code := dockerCmd(c, "run", "--privileged", "busybox", "sh", "-c", "touch /proc/sysrq-trigger"); code != 0 { @@ -1139,7 +1139,7 @@ func (s *DockerSuite) TestRunProcWritableInPrivilegedContainers(c *check.C) { } } -func (s *DockerSuite) TestRunDeviceNumbers(c *check.C) { +func (s *DockerSuite) TestRunDeviceNumbers(c *testing.T) { // Not applicable on Windows as /dev/ is a Unix specific concept // TODO: NotUserNamespace could be removed here if "root" "root" is replaced w user testRequires(c, DaemonIsLinux, NotUserNamespace) @@ -1155,7 +1155,7 @@ func (s *DockerSuite) TestRunDeviceNumbers(c *check.C) { } } -func (s *DockerSuite) TestRunThatCharacterDevicesActLikeCharacterDevices(c *check.C) { +func (s *DockerSuite) TestRunThatCharacterDevicesActLikeCharacterDevices(c *testing.T) { // Not applicable on Windows as /dev/ is a Unix specific concept testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "busybox", "sh", "-c", "dd if=/dev/zero of=/zero bs=1k count=5 2> /dev/null ; du -h /zero") @@ -1164,13 +1164,13 @@ func (s *DockerSuite) TestRunThatCharacterDevicesActLikeCharacterDevices(c *chec } } -func (s *DockerSuite) TestRunUnprivilegedWithChroot(c *check.C) { +func (s *DockerSuite) TestRunUnprivilegedWithChroot(c *testing.T) { // Not applicable on Windows as it does not support chroot testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "busybox", "chroot", "/", "true") } -func (s *DockerSuite) TestRunAddingOptionalDevices(c *check.C) { +func (s *DockerSuite) TestRunAddingOptionalDevices(c *testing.T) { // Not applicable on Windows as Windows does not support --device testRequires(c, DaemonIsLinux, NotUserNamespace) out, _ := dockerCmd(c, "run", "--device", "/dev/zero:/dev/nulo", "busybox", "sh", "-c", "ls /dev/nulo") @@ -1179,7 +1179,7 @@ func (s *DockerSuite) TestRunAddingOptionalDevices(c *check.C) { } } -func (s *DockerSuite) TestRunAddingOptionalDevicesNoSrc(c *check.C) { +func (s *DockerSuite) TestRunAddingOptionalDevicesNoSrc(c *testing.T) { // Not applicable on Windows as Windows does not support --device testRequires(c, DaemonIsLinux, NotUserNamespace) out, _ := dockerCmd(c, "run", "--device", "/dev/zero:rw", "busybox", "sh", "-c", "ls /dev/zero") @@ -1188,7 +1188,7 @@ func (s *DockerSuite) TestRunAddingOptionalDevicesNoSrc(c *check.C) { } } -func (s *DockerSuite) TestRunAddingOptionalDevicesInvalidMode(c *check.C) { +func (s *DockerSuite) TestRunAddingOptionalDevicesInvalidMode(c *testing.T) { // Not applicable on Windows as Windows does not support --device testRequires(c, DaemonIsLinux, NotUserNamespace) _, _, err := dockerCmdWithError("run", "--device", "/dev/zero:ro", "busybox", "sh", "-c", "ls /dev/zero") @@ -1197,7 +1197,7 @@ func (s *DockerSuite) TestRunAddingOptionalDevicesInvalidMode(c *check.C) { } } -func (s *DockerSuite) TestRunModeHostname(c *check.C) { +func (s *DockerSuite) TestRunModeHostname(c *testing.T) { // Not applicable on Windows as Windows does not support -h testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace) @@ -1218,7 +1218,7 @@ func (s *DockerSuite) TestRunModeHostname(c *check.C) { } } -func (s *DockerSuite) TestRunRootWorkdir(c *check.C) { +func (s *DockerSuite) TestRunRootWorkdir(c *testing.T) { out, _ := dockerCmd(c, "run", "--workdir", "/", "busybox", "pwd") expected := "/\n" if testEnv.OSType == "windows" { @@ -1229,7 +1229,7 @@ func (s *DockerSuite) TestRunRootWorkdir(c *check.C) { } } -func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) { +func (s *DockerSuite) TestRunAllowBindMountingRoot(c *testing.T) { if testEnv.OSType == "windows" { // Windows busybox will fail with Permission Denied on items such as pagefile.sys dockerCmd(c, "run", "-v", `c:\:c:\host`, testEnv.PlatformDefaults.BaseImage, "cmd", "-c", "dir", `c:\host`) @@ -1238,7 +1238,7 @@ func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) { } } -func (s *DockerSuite) TestRunDisallowBindMountingRootToRoot(c *check.C) { +func (s *DockerSuite) TestRunDisallowBindMountingRootToRoot(c *testing.T) { mount := "/:/" targetDir := "/host" if testEnv.OSType == "windows" { @@ -1252,7 +1252,7 @@ func (s *DockerSuite) TestRunDisallowBindMountingRootToRoot(c *check.C) { } // Verify that a container gets default DNS when only localhost resolvers exist -func (s *DockerSuite) TestRunDNSDefaultOptions(c *check.C) { +func (s *DockerSuite) TestRunDNSDefaultOptions(c *testing.T) { // Not applicable on Windows as this is testing Unix specific functionality testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) @@ -1286,7 +1286,7 @@ func (s *DockerSuite) TestRunDNSDefaultOptions(c *check.C) { } } -func (s *DockerSuite) TestRunDNSOptions(c *check.C) { +func (s *DockerSuite) TestRunDNSOptions(c *testing.T) { // Not applicable on Windows as Windows does not support --dns*, or // the Unix-specific functionality of resolv.conf. testRequires(c, DaemonIsLinux) @@ -1310,7 +1310,7 @@ func (s *DockerSuite) TestRunDNSOptions(c *check.C) { } } -func (s *DockerSuite) TestRunDNSRepeatOptions(c *check.C) { +func (s *DockerSuite) TestRunDNSRepeatOptions(c *testing.T) { testRequires(c, DaemonIsLinux) out := cli.DockerCmd(c, "run", "--dns=1.1.1.1", "--dns=2.2.2.2", "--dns-search=mydomain", "--dns-search=mydomain2", "--dns-opt=ndots:9", "--dns-opt=timeout:3", "busybox", "cat", "/etc/resolv.conf").Stdout() @@ -1320,7 +1320,7 @@ func (s *DockerSuite) TestRunDNSRepeatOptions(c *check.C) { } } -func (s *DockerSuite) TestRunDNSOptionsBasedOnHostResolvConf(c *check.C) { +func (s *DockerSuite) TestRunDNSOptionsBasedOnHostResolvConf(c *testing.T) { // Not applicable on Windows as testing Unix specific functionality testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) @@ -1402,7 +1402,7 @@ func (s *DockerSuite) TestRunDNSOptionsBasedOnHostResolvConf(c *check.C) { // Test to see if a non-root user can resolve a DNS name. Also // check if the container resolv.conf file has at least 0644 perm. -func (s *DockerSuite) TestRunNonRootUserResolvName(c *check.C) { +func (s *DockerSuite) TestRunNonRootUserResolvName(c *testing.T) { // Not applicable on Windows as Windows does not support --user testRequires(c, testEnv.IsLocalDaemon, Network, DaemonIsLinux, NotArm) @@ -1424,7 +1424,7 @@ func (s *DockerSuite) TestRunNonRootUserResolvName(c *check.C) { // Test if container resolv.conf gets updated the next time it restarts // if host /etc/resolv.conf has changed. This only applies if the container // uses the host's /etc/resolv.conf and does not have any dns options provided. -func (s *DockerSuite) TestRunResolvconfUpdate(c *check.C) { +func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) { // Not applicable on Windows as testing unix specific functionality testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) c.Skip("Unstable test, to be re-activated once #19937 is resolved") @@ -1578,7 +1578,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *check.C) { //cleanup, restore original resolv.conf happens in defer func() } -func (s *DockerSuite) TestRunAddHost(c *check.C) { +func (s *DockerSuite) TestRunAddHost(c *testing.T) { // Not applicable on Windows as it does not support --add-host testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "--add-host=extra:86.75.30.9", "busybox", "grep", "extra", "/etc/hosts") @@ -1590,7 +1590,7 @@ func (s *DockerSuite) TestRunAddHost(c *check.C) { } // Regression test for #6983 -func (s *DockerSuite) TestRunAttachStdErrOnlyTTYMode(c *check.C) { +func (s *DockerSuite) TestRunAttachStdErrOnlyTTYMode(c *testing.T) { _, exitCode := dockerCmd(c, "run", "-t", "-a", "stderr", "busybox", "true") if exitCode != 0 { c.Fatalf("Container should have exited with error code 0") @@ -1598,7 +1598,7 @@ func (s *DockerSuite) TestRunAttachStdErrOnlyTTYMode(c *check.C) { } // Regression test for #6983 -func (s *DockerSuite) TestRunAttachStdOutOnlyTTYMode(c *check.C) { +func (s *DockerSuite) TestRunAttachStdOutOnlyTTYMode(c *testing.T) { _, exitCode := dockerCmd(c, "run", "-t", "-a", "stdout", "busybox", "true") if exitCode != 0 { c.Fatalf("Container should have exited with error code 0") @@ -1606,7 +1606,7 @@ func (s *DockerSuite) TestRunAttachStdOutOnlyTTYMode(c *check.C) { } // Regression test for #6983 -func (s *DockerSuite) TestRunAttachStdOutAndErrTTYMode(c *check.C) { +func (s *DockerSuite) TestRunAttachStdOutAndErrTTYMode(c *testing.T) { _, exitCode := dockerCmd(c, "run", "-t", "-a", "stdout", "-a", "stderr", "busybox", "true") if exitCode != 0 { c.Fatalf("Container should have exited with error code 0") @@ -1615,7 +1615,7 @@ func (s *DockerSuite) TestRunAttachStdOutAndErrTTYMode(c *check.C) { // Test for #10388 - this will run the same test as TestRunAttachStdOutAndErrTTYMode // but using --attach instead of -a to make sure we read the flag correctly -func (s *DockerSuite) TestRunAttachWithDetach(c *check.C) { +func (s *DockerSuite) TestRunAttachWithDetach(c *testing.T) { icmd.RunCommand(dockerBinary, "run", "-d", "--attach", "stdout", "busybox", "true").Assert(c, icmd.Expected{ ExitCode: 1, Error: "exit status 1", @@ -1623,7 +1623,7 @@ func (s *DockerSuite) TestRunAttachWithDetach(c *check.C) { }) } -func (s *DockerSuite) TestRunState(c *check.C) { +func (s *DockerSuite) TestRunState(c *testing.T) { // TODO Windows: This needs some rework as Windows busybox does not support top testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "top") @@ -1660,7 +1660,7 @@ func (s *DockerSuite) TestRunState(c *check.C) { } // Test for #1737 -func (s *DockerSuite) TestRunCopyVolumeUIDGID(c *check.C) { +func (s *DockerSuite) TestRunCopyVolumeUIDGID(c *testing.T) { // Not applicable on Windows as it does not support uid or gid in this way testRequires(c, DaemonIsLinux) name := "testrunvolumesuidgid" @@ -1678,7 +1678,7 @@ func (s *DockerSuite) TestRunCopyVolumeUIDGID(c *check.C) { } // Test for #1582 -func (s *DockerSuite) TestRunCopyVolumeContent(c *check.C) { +func (s *DockerSuite) TestRunCopyVolumeContent(c *testing.T) { // TODO Windows, post RS1. Windows does not yet support volume functionality // that copies from the image to the volume. testRequires(c, DaemonIsLinux) @@ -1693,7 +1693,7 @@ func (s *DockerSuite) TestRunCopyVolumeContent(c *check.C) { } } -func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) { +func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *testing.T) { name := "testrunmdcleanuponentrypoint" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox ENTRYPOINT ["echo"] @@ -1718,7 +1718,7 @@ func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) { } // TestRunWorkdirExistsAndIsFile checks that if 'docker run -w' with existing file can be detected -func (s *DockerSuite) TestRunWorkdirExistsAndIsFile(c *check.C) { +func (s *DockerSuite) TestRunWorkdirExistsAndIsFile(c *testing.T) { existingFile := "/bin/cat" expected := "not a directory" if testEnv.OSType == "windows" { @@ -1732,7 +1732,7 @@ func (s *DockerSuite) TestRunWorkdirExistsAndIsFile(c *check.C) { } } -func (s *DockerSuite) TestRunExitOnStdinClose(c *check.C) { +func (s *DockerSuite) TestRunExitOnStdinClose(c *testing.T) { name := "testrunexitonstdinclose" meow := "/bin/cat" @@ -1789,7 +1789,7 @@ func (s *DockerSuite) TestRunExitOnStdinClose(c *check.C) { } // Test run -i --restart xxx doesn't hang -func (s *DockerSuite) TestRunInteractiveWithRestartPolicy(c *check.C) { +func (s *DockerSuite) TestRunInteractiveWithRestartPolicy(c *testing.T) { name := "test-inter-restart" result := icmd.StartCmd(icmd.Cmd{ @@ -1806,7 +1806,7 @@ func (s *DockerSuite) TestRunInteractiveWithRestartPolicy(c *check.C) { } // Test for #2267 -func (s *DockerSuite) TestRunWriteSpecialFilesAndNotCommit(c *check.C) { +func (s *DockerSuite) TestRunWriteSpecialFilesAndNotCommit(c *testing.T) { // Cannot run on Windows as this files are not present in Windows testRequires(c, DaemonIsLinux) @@ -1815,7 +1815,7 @@ func (s *DockerSuite) TestRunWriteSpecialFilesAndNotCommit(c *check.C) { testRunWriteSpecialFilesAndNotCommit(c, "writeresolv", "/etc/resolv.conf") } -func testRunWriteSpecialFilesAndNotCommit(c *check.C, name, path string) { +func testRunWriteSpecialFilesAndNotCommit(c *testing.T, name, path string) { command := fmt.Sprintf("echo test2267 >> %s && cat %s", path, path) out, _ := dockerCmd(c, "run", "--name", name, "busybox", "sh", "-c", command) if !strings.Contains(out, "test2267") { @@ -1828,7 +1828,7 @@ func testRunWriteSpecialFilesAndNotCommit(c *check.C, name, path string) { } } -func eqToBaseDiff(out string, c *check.C) bool { +func eqToBaseDiff(out string, c *testing.T) bool { name := "eqToBaseDiff" + testutil.GenerateRandomAlphaOnlyString(32) dockerCmd(c, "run", "--name", name, "busybox", "echo", "hello") cID := getIDByName(c, name) @@ -1854,7 +1854,7 @@ func sliceEq(a, b []string) bool { return true } -func (s *DockerSuite) TestRunWithBadDevice(c *check.C) { +func (s *DockerSuite) TestRunWithBadDevice(c *testing.T) { // Cannot run on Windows as Windows does not support --device testRequires(c, DaemonIsLinux) name := "baddevice" @@ -1869,7 +1869,7 @@ func (s *DockerSuite) TestRunWithBadDevice(c *check.C) { } } -func (s *DockerSuite) TestRunEntrypoint(c *check.C) { +func (s *DockerSuite) TestRunEntrypoint(c *testing.T) { name := "entrypoint" out, _ := dockerCmd(c, "run", "--name", name, "--entrypoint", "echo", "busybox", "-n", "foobar") @@ -1880,7 +1880,7 @@ func (s *DockerSuite) TestRunEntrypoint(c *check.C) { } } -func (s *DockerSuite) TestRunBindMounts(c *check.C) { +func (s *DockerSuite) TestRunBindMounts(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) if testEnv.OSType == "linux" { testRequires(c, DaemonIsLinux, NotUserNamespace) @@ -1936,7 +1936,7 @@ func (s *DockerSuite) TestRunBindMounts(c *check.C) { // Ensure that CIDFile gets deleted if it's empty // Perform this test by making `docker run` fail -func (s *DockerSuite) TestRunCidFileCleanupIfEmpty(c *check.C) { +func (s *DockerSuite) TestRunCidFileCleanupIfEmpty(c *testing.T) { // Skip on Windows. Base image on Windows has a CMD set in the image. testRequires(c, DaemonIsLinux) @@ -1967,7 +1967,7 @@ func (s *DockerSuite) TestRunCidFileCleanupIfEmpty(c *check.C) { // #2098 - Docker cidFiles only contain short version of the containerId //sudo docker run --cidfile /tmp/docker_tesc.cid ubuntu echo "test" // TestRunCidFile tests that run --cidfile returns the longid -func (s *DockerSuite) TestRunCidFileCheckIDLength(c *check.C) { +func (s *DockerSuite) TestRunCidFileCheckIDLength(c *testing.T) { tmpDir, err := ioutil.TempDir("", "TestRunCidFile") if err != nil { c.Fatal(err) @@ -1991,7 +1991,7 @@ func (s *DockerSuite) TestRunCidFileCheckIDLength(c *check.C) { } } -func (s *DockerSuite) TestRunSetMacAddress(c *check.C) { +func (s *DockerSuite) TestRunSetMacAddress(c *testing.T) { mac := "12:34:56:78:9a:bc" var out string if testEnv.OSType == "windows" { @@ -2007,7 +2007,7 @@ func (s *DockerSuite) TestRunSetMacAddress(c *check.C) { } } -func (s *DockerSuite) TestRunInspectMacAddress(c *check.C) { +func (s *DockerSuite) TestRunInspectMacAddress(c *testing.T) { // TODO Windows. Network settings are not propagated back to inspect. testRequires(c, DaemonIsLinux) mac := "12:34:56:78:9a:bc" @@ -2021,7 +2021,7 @@ func (s *DockerSuite) TestRunInspectMacAddress(c *check.C) { } // test docker run use an invalid mac address -func (s *DockerSuite) TestRunWithInvalidMacAddress(c *check.C) { +func (s *DockerSuite) TestRunWithInvalidMacAddress(c *testing.T) { out, _, err := dockerCmdWithError("run", "--mac-address", "92:d0:c6:0a:29", "busybox") //use an invalid mac address should with an error out if err == nil || !strings.Contains(out, "is not a valid mac address") { @@ -2029,7 +2029,7 @@ func (s *DockerSuite) TestRunWithInvalidMacAddress(c *check.C) { } } -func (s *DockerSuite) TestRunDeallocatePortOnMissingIptablesRule(c *check.C) { +func (s *DockerSuite) TestRunDeallocatePortOnMissingIptablesRule(c *testing.T) { // TODO Windows. Network settings are not propagated back to inspect. testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) @@ -2045,7 +2045,7 @@ func (s *DockerSuite) TestRunDeallocatePortOnMissingIptablesRule(c *check.C) { cli.DockerCmd(c, "run", "-d", "-p", "23:23", "busybox", "top") } -func (s *DockerSuite) TestRunPortInUse(c *check.C) { +func (s *DockerSuite) TestRunPortInUse(c *testing.T) { // TODO Windows. The duplicate NAT message returned by Windows will be // changing as is currently completely undecipherable. Does need modifying // to run sh rather than top though as top isn't in Windows busybox. @@ -2064,7 +2064,7 @@ func (s *DockerSuite) TestRunPortInUse(c *check.C) { } // https://github.com/docker/docker/issues/12148 -func (s *DockerSuite) TestRunAllocatePortInReservedRange(c *check.C) { +func (s *DockerSuite) TestRunAllocatePortInReservedRange(c *testing.T) { // TODO Windows. -P is not yet supported testRequires(c, DaemonIsLinux) // allocate a dynamic port to get the most recent @@ -2085,7 +2085,7 @@ func (s *DockerSuite) TestRunAllocatePortInReservedRange(c *check.C) { } // Regression test for #7792 -func (s *DockerSuite) TestRunMountOrdering(c *check.C) { +func (s *DockerSuite) TestRunMountOrdering(c *testing.T) { // TODO Windows: Post RS1. Windows does not support nested mounts. testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace) prefix, _ := getPrefixAndSlashFromDaemonPlatform() @@ -2130,7 +2130,7 @@ func (s *DockerSuite) TestRunMountOrdering(c *check.C) { } // Regression test for https://github.com/docker/docker/issues/8259 -func (s *DockerSuite) TestRunReuseBindVolumeThatIsSymlink(c *check.C) { +func (s *DockerSuite) TestRunReuseBindVolumeThatIsSymlink(c *testing.T) { // Not applicable on Windows as Windows does not support volumes testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace) prefix, _ := getPrefixAndSlashFromDaemonPlatform() @@ -2156,7 +2156,7 @@ func (s *DockerSuite) TestRunReuseBindVolumeThatIsSymlink(c *check.C) { } //GH#10604: Test an "/etc" volume doesn't overlay special bind mounts in container -func (s *DockerSuite) TestRunCreateVolumeEtc(c *check.C) { +func (s *DockerSuite) TestRunCreateVolumeEtc(c *testing.T) { // While Windows supports volumes, it does not support --add-host hence // this test is not applicable on Windows. testRequires(c, DaemonIsLinux) @@ -2177,7 +2177,7 @@ func (s *DockerSuite) TestRunCreateVolumeEtc(c *check.C) { } } -func (s *DockerSuite) TestVolumesNoCopyData(c *check.C) { +func (s *DockerSuite) TestVolumesNoCopyData(c *testing.T) { // TODO Windows (Post RS1). Windows does not support volumes which // are pre-populated such as is built in the dockerfile used in this test. testRequires(c, DaemonIsLinux) @@ -2197,7 +2197,7 @@ func (s *DockerSuite) TestVolumesNoCopyData(c *check.C) { } } -func (s *DockerSuite) TestRunNoOutputFromPullInStdout(c *check.C) { +func (s *DockerSuite) TestRunNoOutputFromPullInStdout(c *testing.T) { // just run with unknown image cmd := exec.Command(dockerBinary, "run", "asdfsg") stdout := bytes.NewBuffer(nil) @@ -2210,7 +2210,7 @@ func (s *DockerSuite) TestRunNoOutputFromPullInStdout(c *check.C) { } } -func (s *DockerSuite) TestRunVolumesCleanPaths(c *check.C) { +func (s *DockerSuite) TestRunVolumesCleanPaths(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon) prefix, slash := getPrefixAndSlashFromDaemonPlatform() buildImageSuccessfully(c, "run_volumes_clean_paths", build.WithDockerfile(`FROM busybox @@ -2241,7 +2241,7 @@ func (s *DockerSuite) TestRunVolumesCleanPaths(c *check.C) { } // Regression test for #3631 -func (s *DockerSuite) TestRunSlowStdoutConsumer(c *check.C) { +func (s *DockerSuite) TestRunSlowStdoutConsumer(c *testing.T) { // TODO Windows: This should be able to run on Windows if can find an // alternate to /dev/zero and /dev/stdout. testRequires(c, DaemonIsLinux) @@ -2269,7 +2269,7 @@ func (s *DockerSuite) TestRunSlowStdoutConsumer(c *check.C) { } } -func (s *DockerSuite) TestRunAllowPortRangeThroughExpose(c *check.C) { +func (s *DockerSuite) TestRunAllowPortRangeThroughExpose(c *testing.T) { // TODO Windows: -P is not currently supported. Also network // settings are not propagated back. testRequires(c, DaemonIsLinux) @@ -2292,13 +2292,13 @@ func (s *DockerSuite) TestRunAllowPortRangeThroughExpose(c *check.C) { } } -func (s *DockerSuite) TestRunExposePort(c *check.C) { +func (s *DockerSuite) TestRunExposePort(c *testing.T) { out, _, err := dockerCmdWithError("run", "--expose", "80000", "busybox") assert.Assert(c, err, checker.NotNil, check.Commentf("--expose with an invalid port should error out")) assert.Assert(c, out, checker.Contains, "invalid range format for --expose") } -func (s *DockerSuite) TestRunModeIpcHost(c *check.C) { +func (s *DockerSuite) TestRunModeIpcHost(c *testing.T) { // Not applicable on Windows as uses Unix-specific capabilities testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace) @@ -2320,7 +2320,7 @@ func (s *DockerSuite) TestRunModeIpcHost(c *check.C) { } } -func (s *DockerSuite) TestRunModeIpcContainerNotExists(c *check.C) { +func (s *DockerSuite) TestRunModeIpcContainerNotExists(c *testing.T) { // Not applicable on Windows as uses Unix-specific capabilities testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "-d", "--ipc", "container:abcd1234", "busybox", "top") @@ -2329,7 +2329,7 @@ func (s *DockerSuite) TestRunModeIpcContainerNotExists(c *check.C) { } } -func (s *DockerSuite) TestRunModeIpcContainerNotRunning(c *check.C) { +func (s *DockerSuite) TestRunModeIpcContainerNotRunning(c *testing.T) { // Not applicable on Windows as uses Unix-specific capabilities testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) @@ -2342,7 +2342,7 @@ func (s *DockerSuite) TestRunModeIpcContainerNotRunning(c *check.C) { } } -func (s *DockerSuite) TestRunModePIDContainer(c *check.C) { +func (s *DockerSuite) TestRunModePIDContainer(c *testing.T) { // Not applicable on Windows as uses Unix-specific capabilities testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) @@ -2367,7 +2367,7 @@ func (s *DockerSuite) TestRunModePIDContainer(c *check.C) { } } -func (s *DockerSuite) TestRunModePIDContainerNotExists(c *check.C) { +func (s *DockerSuite) TestRunModePIDContainerNotExists(c *testing.T) { // Not applicable on Windows as uses Unix-specific capabilities testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "-d", "--pid", "container:abcd1234", "busybox", "top") @@ -2376,7 +2376,7 @@ func (s *DockerSuite) TestRunModePIDContainerNotExists(c *check.C) { } } -func (s *DockerSuite) TestRunModePIDContainerNotRunning(c *check.C) { +func (s *DockerSuite) TestRunModePIDContainerNotRunning(c *testing.T) { // Not applicable on Windows as uses Unix-specific capabilities testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) @@ -2389,7 +2389,7 @@ func (s *DockerSuite) TestRunModePIDContainerNotRunning(c *check.C) { } } -func (s *DockerSuite) TestRunMountShmMqueueFromHost(c *check.C) { +func (s *DockerSuite) TestRunMountShmMqueueFromHost(c *testing.T) { // Not applicable on Windows as uses Unix-specific capabilities testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace) @@ -2413,7 +2413,7 @@ func (s *DockerSuite) TestRunMountShmMqueueFromHost(c *check.C) { } } -func (s *DockerSuite) TestContainerNetworkMode(c *check.C) { +func (s *DockerSuite) TestContainerNetworkMode(c *testing.T) { // Not applicable on Windows as uses Unix-specific capabilities testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) @@ -2434,7 +2434,7 @@ func (s *DockerSuite) TestContainerNetworkMode(c *check.C) { } } -func (s *DockerSuite) TestRunModePIDHost(c *check.C) { +func (s *DockerSuite) TestRunModePIDHost(c *testing.T) { // Not applicable on Windows as uses Unix-specific capabilities testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace) @@ -2456,7 +2456,7 @@ func (s *DockerSuite) TestRunModePIDHost(c *check.C) { } } -func (s *DockerSuite) TestRunModeUTSHost(c *check.C) { +func (s *DockerSuite) TestRunModeUTSHost(c *testing.T) { // Not applicable on Windows as uses Unix-specific capabilities testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) @@ -2481,7 +2481,7 @@ func (s *DockerSuite) TestRunModeUTSHost(c *check.C) { assert.Assert(c, out, checker.Contains, runconfig.ErrConflictUTSHostname.Error()) } -func (s *DockerSuite) TestRunTLSVerify(c *check.C) { +func (s *DockerSuite) TestRunTLSVerify(c *testing.T) { // Remote daemons use TLS and this test is not applicable when TLS is required. testRequires(c, testEnv.IsLocalDaemon) if out, code, err := dockerCmdWithError("ps"); err != nil || code != 0 { @@ -2497,7 +2497,7 @@ func (s *DockerSuite) TestRunTLSVerify(c *check.C) { result.Assert(c, icmd.Expected{ExitCode: 1, Err: "cert"}) } -func (s *DockerSuite) TestRunPortFromDockerRangeInUse(c *check.C) { +func (s *DockerSuite) TestRunPortFromDockerRangeInUse(c *testing.T) { // TODO Windows. Once moved to libnetwork/CNM, this may be able to be // re-instated. testRequires(c, DaemonIsLinux) @@ -2529,7 +2529,7 @@ func (s *DockerSuite) TestRunPortFromDockerRangeInUse(c *check.C) { dockerCmd(c, "port", id) } -func (s *DockerSuite) TestRunTTYWithPipe(c *check.C) { +func (s *DockerSuite) TestRunTTYWithPipe(c *testing.T) { errChan := make(chan error) go func() { defer close(errChan) @@ -2561,7 +2561,7 @@ func (s *DockerSuite) TestRunTTYWithPipe(c *check.C) { } } -func (s *DockerSuite) TestRunNonLocalMacAddress(c *check.C) { +func (s *DockerSuite) TestRunNonLocalMacAddress(c *testing.T) { addr := "00:16:3E:08:00:50" args := []string{"run", "--mac-address", addr} expected := addr @@ -2578,7 +2578,7 @@ func (s *DockerSuite) TestRunNonLocalMacAddress(c *check.C) { } } -func (s *DockerSuite) TestRunNetHost(c *check.C) { +func (s *DockerSuite) TestRunNetHost(c *testing.T) { // Not applicable on Windows as uses Unix-specific capabilities testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace) @@ -2600,7 +2600,7 @@ func (s *DockerSuite) TestRunNetHost(c *check.C) { } } -func (s *DockerSuite) TestRunNetHostTwiceSameName(c *check.C) { +func (s *DockerSuite) TestRunNetHostTwiceSameName(c *testing.T) { // TODO Windows. As Windows networking evolves and converges towards // CNM, this test may be possible to enable on Windows. testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace) @@ -2609,7 +2609,7 @@ func (s *DockerSuite) TestRunNetHostTwiceSameName(c *check.C) { dockerCmd(c, "run", "--rm", "--name=thost", "--net=host", "busybox", "true") } -func (s *DockerSuite) TestRunNetContainerWhichHost(c *check.C) { +func (s *DockerSuite) TestRunNetContainerWhichHost(c *testing.T) { // Not applicable on Windows as uses Unix-specific capabilities testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace) @@ -2627,7 +2627,7 @@ func (s *DockerSuite) TestRunNetContainerWhichHost(c *check.C) { } } -func (s *DockerSuite) TestRunAllowPortRangeThroughPublish(c *check.C) { +func (s *DockerSuite) TestRunAllowPortRangeThroughPublish(c *testing.T) { // TODO Windows. This may be possible to enable in the future. However, // Windows does not currently support --expose, or populate the network // settings seen through inspect. @@ -2651,7 +2651,7 @@ func (s *DockerSuite) TestRunAllowPortRangeThroughPublish(c *check.C) { } } -func (s *DockerSuite) TestRunSetDefaultRestartPolicy(c *check.C) { +func (s *DockerSuite) TestRunSetDefaultRestartPolicy(c *testing.T) { runSleepingContainer(c, "--name=testrunsetdefaultrestartpolicy") out := inspectField(c, "testrunsetdefaultrestartpolicy", "HostConfig.RestartPolicy.Name") if out != "no" { @@ -2659,7 +2659,7 @@ func (s *DockerSuite) TestRunSetDefaultRestartPolicy(c *check.C) { } } -func (s *DockerSuite) TestRunRestartMaxRetries(c *check.C) { +func (s *DockerSuite) TestRunRestartMaxRetries(c *testing.T) { out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "false") timeout := 10 * time.Second if testEnv.OSType == "windows" { @@ -2682,11 +2682,11 @@ func (s *DockerSuite) TestRunRestartMaxRetries(c *check.C) { } } -func (s *DockerSuite) TestRunContainerWithWritableRootfs(c *check.C) { +func (s *DockerSuite) TestRunContainerWithWritableRootfs(c *testing.T) { dockerCmd(c, "run", "--rm", "busybox", "touch", "/file") } -func (s *DockerSuite) TestRunContainerWithReadonlyRootfs(c *check.C) { +func (s *DockerSuite) TestRunContainerWithReadonlyRootfs(c *testing.T) { // Not applicable on Windows which does not support --read-only testRequires(c, DaemonIsLinux, UserNamespaceROMount) @@ -2698,7 +2698,7 @@ func (s *DockerSuite) TestRunContainerWithReadonlyRootfs(c *check.C) { testReadOnlyFile(c, testPriv, "/file", "/etc/hosts", "/etc/resolv.conf", "/etc/hostname") } -func (s *DockerSuite) TestPermissionsPtsReadonlyRootfs(c *check.C) { +func (s *DockerSuite) TestPermissionsPtsReadonlyRootfs(c *testing.T) { // Not applicable on Windows due to use of Unix specific functionality, plus // the use of --read-only which is not supported. testRequires(c, DaemonIsLinux, UserNamespaceROMount) @@ -2714,7 +2714,7 @@ func (s *DockerSuite) TestPermissionsPtsReadonlyRootfs(c *check.C) { } } -func testReadOnlyFile(c *check.C, testPriv bool, filenames ...string) { +func testReadOnlyFile(c *testing.T, testPriv bool, filenames ...string) { touch := "touch " + strings.Join(filenames, " ") out, _, err := dockerCmdWithError("run", "--read-only", "--rm", "busybox", "sh", "-c", touch) assert.ErrorContains(c, err, "") @@ -2737,7 +2737,7 @@ func testReadOnlyFile(c *check.C, testPriv bool, filenames ...string) { } } -func (s *DockerSuite) TestRunContainerWithReadonlyEtcHostsAndLinkedContainer(c *check.C) { +func (s *DockerSuite) TestRunContainerWithReadonlyEtcHostsAndLinkedContainer(c *testing.T) { // Not applicable on Windows which does not support --link testRequires(c, DaemonIsLinux, UserNamespaceROMount) @@ -2749,7 +2749,7 @@ func (s *DockerSuite) TestRunContainerWithReadonlyEtcHostsAndLinkedContainer(c * } } -func (s *DockerSuite) TestRunContainerWithReadonlyRootfsWithDNSFlag(c *check.C) { +func (s *DockerSuite) TestRunContainerWithReadonlyRootfsWithDNSFlag(c *testing.T) { // Not applicable on Windows which does not support either --read-only or --dns. testRequires(c, DaemonIsLinux, UserNamespaceROMount) @@ -2759,7 +2759,7 @@ func (s *DockerSuite) TestRunContainerWithReadonlyRootfsWithDNSFlag(c *check.C) } } -func (s *DockerSuite) TestRunContainerWithReadonlyRootfsWithAddHostFlag(c *check.C) { +func (s *DockerSuite) TestRunContainerWithReadonlyRootfsWithAddHostFlag(c *testing.T) { // Not applicable on Windows which does not support --read-only testRequires(c, DaemonIsLinux, UserNamespaceROMount) @@ -2769,7 +2769,7 @@ func (s *DockerSuite) TestRunContainerWithReadonlyRootfsWithAddHostFlag(c *check } } -func (s *DockerSuite) TestRunVolumesFromRestartAfterRemoved(c *check.C) { +func (s *DockerSuite) TestRunVolumesFromRestartAfterRemoved(c *testing.T) { prefix, _ := getPrefixAndSlashFromDaemonPlatform() runSleepingContainer(c, "--name=voltest", "-v", prefix+"/foo") runSleepingContainer(c, "--name=restarter", "--volumes-from", "voltest") @@ -2782,7 +2782,7 @@ func (s *DockerSuite) TestRunVolumesFromRestartAfterRemoved(c *check.C) { } // run container with --rm should remove container if exit code != 0 -func (s *DockerSuite) TestRunContainerWithRmFlagExitCodeNotEqualToZero(c *check.C) { +func (s *DockerSuite) TestRunContainerWithRmFlagExitCodeNotEqualToZero(c *testing.T) { existingContainers := ExistingContainerIDs(c) name := "flowers" cli.Docker(cli.Args("run", "--name", name, "--rm", "busybox", "ls", "/notexists")).Assert(c, icmd.Expected{ @@ -2796,7 +2796,7 @@ func (s *DockerSuite) TestRunContainerWithRmFlagExitCodeNotEqualToZero(c *check. } } -func (s *DockerSuite) TestRunContainerWithRmFlagCannotStartContainer(c *check.C) { +func (s *DockerSuite) TestRunContainerWithRmFlagCannotStartContainer(c *testing.T) { existingContainers := ExistingContainerIDs(c) name := "sparkles" cli.Docker(cli.Args("run", "--name", name, "--rm", "busybox", "commandNotFound")).Assert(c, icmd.Expected{ @@ -2809,7 +2809,7 @@ func (s *DockerSuite) TestRunContainerWithRmFlagCannotStartContainer(c *check.C) } } -func (s *DockerSuite) TestRunPIDHostWithChildIsKillable(c *check.C) { +func (s *DockerSuite) TestRunPIDHostWithChildIsKillable(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux, NotUserNamespace) name := "ibuildthecloud" @@ -2832,7 +2832,7 @@ func (s *DockerSuite) TestRunPIDHostWithChildIsKillable(c *check.C) { } } -func (s *DockerSuite) TestRunWithTooSmallMemoryLimit(c *check.C) { +func (s *DockerSuite) TestRunWithTooSmallMemoryLimit(c *testing.T) { // TODO Windows. This may be possible to enable once Windows supports // memory limits on containers testRequires(c, DaemonIsLinux) @@ -2844,7 +2844,7 @@ func (s *DockerSuite) TestRunWithTooSmallMemoryLimit(c *check.C) { } } -func (s *DockerSuite) TestRunWriteToProcAsound(c *check.C) { +func (s *DockerSuite) TestRunWriteToProcAsound(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux) _, code, err := dockerCmdWithError("run", "busybox", "sh", "-c", "echo 111 >> /proc/asound/version") @@ -2853,7 +2853,7 @@ func (s *DockerSuite) TestRunWriteToProcAsound(c *check.C) { } } -func (s *DockerSuite) TestRunReadProcTimer(c *check.C) { +func (s *DockerSuite) TestRunReadProcTimer(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux) out, code, err := dockerCmdWithError("run", "busybox", "cat", "/proc/timer_stats") @@ -2868,7 +2868,7 @@ func (s *DockerSuite) TestRunReadProcTimer(c *check.C) { } } -func (s *DockerSuite) TestRunReadProcLatency(c *check.C) { +func (s *DockerSuite) TestRunReadProcLatency(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux) // some kernels don't have this configured so skip the test if this file is not found @@ -2889,7 +2889,7 @@ func (s *DockerSuite) TestRunReadProcLatency(c *check.C) { } } -func (s *DockerSuite) TestRunReadFilteredProc(c *check.C) { +func (s *DockerSuite) TestRunReadFilteredProc(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, Apparmor, DaemonIsLinux, NotUserNamespace) @@ -2912,7 +2912,7 @@ func (s *DockerSuite) TestRunReadFilteredProc(c *check.C) { } } -func (s *DockerSuite) TestMountIntoProc(c *check.C) { +func (s *DockerSuite) TestMountIntoProc(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux) _, code, err := dockerCmdWithError("run", "-v", "/proc//sys", "busybox", "true") @@ -2921,14 +2921,14 @@ func (s *DockerSuite) TestMountIntoProc(c *check.C) { } } -func (s *DockerSuite) TestMountIntoSys(c *check.C) { +func (s *DockerSuite) TestMountIntoSys(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux) testRequires(c, NotUserNamespace) dockerCmd(c, "run", "-v", "/sys/fs/cgroup", "busybox", "true") } -func (s *DockerSuite) TestRunUnshareProc(c *check.C) { +func (s *DockerSuite) TestRunUnshareProc(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, Apparmor, DaemonIsLinux, NotUserNamespace) @@ -2986,7 +2986,7 @@ func (s *DockerSuite) TestRunUnshareProc(c *check.C) { } } -func (s *DockerSuite) TestRunPublishPort(c *check.C) { +func (s *DockerSuite) TestRunPublishPort(c *testing.T) { // TODO Windows: This may be possible once Windows moves to libnetwork and CNM testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "-d", "--name", "test", "--expose", "8080", "busybox", "top") @@ -2998,7 +2998,7 @@ func (s *DockerSuite) TestRunPublishPort(c *check.C) { } // Issue #10184. -func (s *DockerSuite) TestDevicePermissions(c *check.C) { +func (s *DockerSuite) TestDevicePermissions(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux) const permissions = "crw-rw-rw-" @@ -3011,7 +3011,7 @@ func (s *DockerSuite) TestDevicePermissions(c *check.C) { } } -func (s *DockerSuite) TestRunCapAddCHOWN(c *check.C) { +func (s *DockerSuite) TestRunCapAddCHOWN(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "--cap-drop=ALL", "--cap-add=CHOWN", "busybox", "sh", "-c", "adduser -D -H newuser && chown newuser /home && echo ok") @@ -3022,7 +3022,7 @@ func (s *DockerSuite) TestRunCapAddCHOWN(c *check.C) { } // https://github.com/docker/docker/pull/14498 -func (s *DockerSuite) TestVolumeFromMixedRWOptions(c *check.C) { +func (s *DockerSuite) TestVolumeFromMixedRWOptions(c *testing.T) { prefix, slash := getPrefixAndSlashFromDaemonPlatform() dockerCmd(c, "run", "--name", "parent", "-v", prefix+"/test", "busybox", "true") @@ -3045,7 +3045,7 @@ func (s *DockerSuite) TestVolumeFromMixedRWOptions(c *check.C) { } } -func (s *DockerSuite) TestRunWriteFilteredProc(c *check.C) { +func (s *DockerSuite) TestRunWriteFilteredProc(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, Apparmor, DaemonIsLinux, NotUserNamespace) @@ -3072,7 +3072,7 @@ func (s *DockerSuite) TestRunWriteFilteredProc(c *check.C) { } } -func (s *DockerSuite) TestRunNetworkFilesBindMount(c *check.C) { +func (s *DockerSuite) TestRunNetworkFilesBindMount(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) @@ -3096,7 +3096,7 @@ func (s *DockerSuite) TestRunNetworkFilesBindMount(c *check.C) { } } -func (s *DockerSuite) TestRunNetworkFilesBindMountRO(c *check.C) { +func (s *DockerSuite) TestRunNetworkFilesBindMountRO(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) @@ -3118,7 +3118,7 @@ func (s *DockerSuite) TestRunNetworkFilesBindMountRO(c *check.C) { } } -func (s *DockerSuite) TestRunNetworkFilesBindMountROFilesystem(c *check.C) { +func (s *DockerSuite) TestRunNetworkFilesBindMountROFilesystem(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, UserNamespaceROMount) @@ -3147,7 +3147,7 @@ func (s *DockerSuite) TestRunNetworkFilesBindMountROFilesystem(c *check.C) { } } -func (s *DockerSuite) TestPtraceContainerProcsFromHost(c *check.C) { +func (s *DockerSuite) TestPtraceContainerProcsFromHost(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) @@ -3162,7 +3162,7 @@ func (s *DockerSuite) TestPtraceContainerProcsFromHost(c *check.C) { } } -func (s *DockerSuite) TestAppArmorDeniesPtrace(c *check.C) { +func (s *DockerSuite) TestAppArmorDeniesPtrace(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, testEnv.IsLocalDaemon, Apparmor, DaemonIsLinux) @@ -3174,7 +3174,7 @@ func (s *DockerSuite) TestAppArmorDeniesPtrace(c *check.C) { } } -func (s *DockerSuite) TestAppArmorTraceSelf(c *check.C) { +func (s *DockerSuite) TestAppArmorTraceSelf(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon, Apparmor) @@ -3184,7 +3184,7 @@ func (s *DockerSuite) TestAppArmorTraceSelf(c *check.C) { } } -func (s *DockerSuite) TestAppArmorDeniesChmodProc(c *check.C) { +func (s *DockerSuite) TestAppArmorDeniesChmodProc(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, testEnv.IsLocalDaemon, Apparmor, DaemonIsLinux, NotUserNamespace) _, exitCode, _ := dockerCmdWithError("run", "busybox", "chmod", "744", "/proc/cpuinfo") @@ -3197,7 +3197,7 @@ func (s *DockerSuite) TestAppArmorDeniesChmodProc(c *check.C) { } } -func (s *DockerSuite) TestRunCapAddSYSTIME(c *check.C) { +func (s *DockerSuite) TestRunCapAddSYSTIME(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux) @@ -3205,7 +3205,7 @@ func (s *DockerSuite) TestRunCapAddSYSTIME(c *check.C) { } // run create container failed should clean up the container -func (s *DockerSuite) TestRunCreateContainerFailedCleanUp(c *check.C) { +func (s *DockerSuite) TestRunCreateContainerFailedCleanUp(c *testing.T) { // TODO Windows. This may be possible to enable once link is supported testRequires(c, DaemonIsLinux) name := "unique_name" @@ -3217,7 +3217,7 @@ func (s *DockerSuite) TestRunCreateContainerFailedCleanUp(c *check.C) { assert.Assert(c, containerID, check.Equals, "", check.Commentf("Expected not to have this container: %s!", containerID)) } -func (s *DockerSuite) TestRunNamedVolume(c *check.C) { +func (s *DockerSuite) TestRunNamedVolume(c *testing.T) { prefix, _ := getPrefixAndSlashFromDaemonPlatform() testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "--name=test", "-v", "testing:"+prefix+"/foo", "busybox", "sh", "-c", "echo hello > "+prefix+"/foo/bar") @@ -3229,7 +3229,7 @@ func (s *DockerSuite) TestRunNamedVolume(c *check.C) { assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello") } -func (s *DockerSuite) TestRunWithUlimits(c *check.C) { +func (s *DockerSuite) TestRunWithUlimits(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux) @@ -3240,7 +3240,7 @@ func (s *DockerSuite) TestRunWithUlimits(c *check.C) { } } -func (s *DockerSuite) TestRunContainerWithCgroupParent(c *check.C) { +func (s *DockerSuite) TestRunContainerWithCgroupParent(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux) @@ -3251,7 +3251,7 @@ func (s *DockerSuite) TestRunContainerWithCgroupParent(c *check.C) { testRunContainerWithCgroupParent(c, "/cgroup-parent/test", "cgroup-test-absolute") } -func testRunContainerWithCgroupParent(c *check.C, cgroupParent, name string) { +func testRunContainerWithCgroupParent(c *testing.T, cgroupParent, name string) { out, _, err := dockerCmdWithError("run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup") if err != nil { c.Fatalf("unexpected failure when running container with --cgroup-parent option - %s\n%v", string(out), err) @@ -3275,7 +3275,7 @@ func testRunContainerWithCgroupParent(c *check.C, cgroupParent, name string) { } // TestRunInvalidCgroupParent checks that a specially-crafted cgroup parent doesn't cause Docker to crash or start modifying /. -func (s *DockerSuite) TestRunInvalidCgroupParent(c *check.C) { +func (s *DockerSuite) TestRunInvalidCgroupParent(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality testRequires(c, DaemonIsLinux) @@ -3284,7 +3284,7 @@ func (s *DockerSuite) TestRunInvalidCgroupParent(c *check.C) { testRunInvalidCgroupParent(c, "/../../../../../../../../SHOULD_NOT_EXIST", "/SHOULD_NOT_EXIST", "cgroup-absolute-invalid-test") } -func testRunInvalidCgroupParent(c *check.C, cgroupParent, cleanCgroupParent, name string) { +func testRunInvalidCgroupParent(c *testing.T, cgroupParent, cleanCgroupParent, name string) { out, _, err := dockerCmdWithError("run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup") if err != nil { // XXX: This may include a daemon crash. @@ -3314,7 +3314,7 @@ func testRunInvalidCgroupParent(c *check.C, cgroupParent, cleanCgroupParent, nam } } -func (s *DockerSuite) TestRunContainerWithCgroupMountRO(c *check.C) { +func (s *DockerSuite) TestRunContainerWithCgroupMountRO(c *testing.T) { // Not applicable on Windows as uses Unix specific functionality // --read-only + userns has remount issues testRequires(c, DaemonIsLinux, NotUserNamespace) @@ -3330,7 +3330,7 @@ func (s *DockerSuite) TestRunContainerWithCgroupMountRO(c *check.C) { } } -func (s *DockerSuite) TestRunContainerNetworkModeToSelf(c *check.C) { +func (s *DockerSuite) TestRunContainerNetworkModeToSelf(c *testing.T) { // Not applicable on Windows which does not support --net=container testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "--name=me", "--net=container:me", "busybox", "true") @@ -3339,7 +3339,7 @@ func (s *DockerSuite) TestRunContainerNetworkModeToSelf(c *check.C) { } } -func (s *DockerSuite) TestRunContainerNetModeWithDNSMacHosts(c *check.C) { +func (s *DockerSuite) TestRunContainerNetModeWithDNSMacHosts(c *testing.T) { // Not applicable on Windows which does not support --net=container testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "-d", "--name", "parent", "busybox", "top") @@ -3363,7 +3363,7 @@ func (s *DockerSuite) TestRunContainerNetModeWithDNSMacHosts(c *check.C) { } } -func (s *DockerSuite) TestRunContainerNetModeWithExposePort(c *check.C) { +func (s *DockerSuite) TestRunContainerNetModeWithExposePort(c *testing.T) { // Not applicable on Windows which does not support --net=container testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "-d", "--name", "parent", "busybox", "top") @@ -3384,7 +3384,7 @@ func (s *DockerSuite) TestRunContainerNetModeWithExposePort(c *check.C) { } } -func (s *DockerSuite) TestRunLinkToContainerNetMode(c *check.C) { +func (s *DockerSuite) TestRunLinkToContainerNetMode(c *testing.T) { // Not applicable on Windows which does not support --net=container or --link testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "--name", "test", "-d", "busybox", "top") @@ -3394,7 +3394,7 @@ func (s *DockerSuite) TestRunLinkToContainerNetMode(c *check.C) { dockerCmd(c, "run", "-d", "--link=child:child", "busybox", "top") } -func (s *DockerSuite) TestRunLoopbackOnlyExistsWhenNetworkingDisabled(c *check.C) { +func (s *DockerSuite) TestRunLoopbackOnlyExistsWhenNetworkingDisabled(c *testing.T) { // TODO Windows: This may be possible to convert. testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "--net=none", "busybox", "ip", "-o", "-4", "a", "show", "up") @@ -3420,7 +3420,7 @@ func (s *DockerSuite) TestRunLoopbackOnlyExistsWhenNetworkingDisabled(c *check.C } // Issue #4681 -func (s *DockerSuite) TestRunLoopbackWhenNetworkDisabled(c *check.C) { +func (s *DockerSuite) TestRunLoopbackWhenNetworkDisabled(c *testing.T) { if testEnv.OSType == "windows" { dockerCmd(c, "run", "--net=none", testEnv.PlatformDefaults.BaseImage, "ping", "-n", "1", "127.0.0.1") } else { @@ -3428,7 +3428,7 @@ func (s *DockerSuite) TestRunLoopbackWhenNetworkDisabled(c *check.C) { } } -func (s *DockerSuite) TestRunModeNetContainerHostname(c *check.C) { +func (s *DockerSuite) TestRunModeNetContainerHostname(c *testing.T) { // Windows does not support --net=container testRequires(c, DaemonIsLinux) @@ -3441,7 +3441,7 @@ func (s *DockerSuite) TestRunModeNetContainerHostname(c *check.C) { } } -func (s *DockerSuite) TestRunNetworkNotInitializedNoneMode(c *check.C) { +func (s *DockerSuite) TestRunNetworkNotInitializedNoneMode(c *testing.T) { // TODO Windows: Network settings are not currently propagated. This may // be resolved in the future with the move to libnetwork and CNM. testRequires(c, DaemonIsLinux) @@ -3453,7 +3453,7 @@ func (s *DockerSuite) TestRunNetworkNotInitializedNoneMode(c *check.C) { } } -func (s *DockerSuite) TestTwoContainersInNetHost(c *check.C) { +func (s *DockerSuite) TestTwoContainersInNetHost(c *testing.T) { // Not applicable as Windows does not support --net=host testRequires(c, DaemonIsLinux, NotUserNamespace, NotUserNamespace) dockerCmd(c, "run", "-d", "--net=host", "--name=first", "busybox", "top") @@ -3462,7 +3462,7 @@ func (s *DockerSuite) TestTwoContainersInNetHost(c *check.C) { dockerCmd(c, "stop", "second") } -func (s *DockerSuite) TestContainersInUserDefinedNetwork(c *check.C) { +func (s *DockerSuite) TestContainersInUserDefinedNetwork(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork") dockerCmd(c, "run", "-d", "--net=testnetwork", "--name=first", "busybox", "top") @@ -3470,7 +3470,7 @@ func (s *DockerSuite) TestContainersInUserDefinedNetwork(c *check.C) { dockerCmd(c, "run", "-t", "--net=testnetwork", "--name=second", "busybox", "ping", "-c", "1", "first") } -func (s *DockerSuite) TestContainersInMultipleNetworks(c *check.C) { +func (s *DockerSuite) TestContainersInMultipleNetworks(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) // Create 2 networks using bridge driver dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") @@ -3489,7 +3489,7 @@ func (s *DockerSuite) TestContainersInMultipleNetworks(c *check.C) { dockerCmd(c, "exec", "second", "ping", "-c", "1", "first.testnetwork2") } -func (s *DockerSuite) TestContainersNetworkIsolation(c *check.C) { +func (s *DockerSuite) TestContainersNetworkIsolation(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) // Create 2 networks using bridge driver dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") @@ -3516,7 +3516,7 @@ func (s *DockerSuite) TestContainersNetworkIsolation(c *check.C) { assert.ErrorContains(c, err, "") } -func (s *DockerSuite) TestNetworkRmWithActiveContainers(c *check.C) { +func (s *DockerSuite) TestNetworkRmWithActiveContainers(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) // Create 2 networks using bridge driver dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") @@ -3534,7 +3534,7 @@ func (s *DockerSuite) TestNetworkRmWithActiveContainers(c *check.C) { assert.ErrorContains(c, err, "") } -func (s *DockerSuite) TestContainerRestartInMultipleNetworks(c *check.C) { +func (s *DockerSuite) TestContainerRestartInMultipleNetworks(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) // Create 2 networks using bridge driver dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") @@ -3566,7 +3566,7 @@ func (s *DockerSuite) TestContainerRestartInMultipleNetworks(c *check.C) { dockerCmd(c, "exec", "second", "ping", "-c", "1", "first.testnetwork2") } -func (s *DockerSuite) TestContainerWithConflictingHostNetworks(c *check.C) { +func (s *DockerSuite) TestContainerWithConflictingHostNetworks(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) // Run a container with --net=host dockerCmd(c, "run", "-d", "--net=host", "--name=first", "busybox", "top") @@ -3580,7 +3580,7 @@ func (s *DockerSuite) TestContainerWithConflictingHostNetworks(c *check.C) { assert.ErrorContains(c, err, "") } -func (s *DockerSuite) TestContainerWithConflictingSharedNetwork(c *check.C) { +func (s *DockerSuite) TestContainerWithConflictingSharedNetwork(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "-d", "--name=first", "busybox", "top") assert.Assert(c, waitRun("first"), check.IsNil) @@ -3597,7 +3597,7 @@ func (s *DockerSuite) TestContainerWithConflictingSharedNetwork(c *check.C) { assert.Assert(c, out, checker.Contains, runconfig.ErrConflictSharedNetwork.Error()) } -func (s *DockerSuite) TestContainerWithConflictingNoneNetwork(c *check.C) { +func (s *DockerSuite) TestContainerWithConflictingNoneNetwork(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "-d", "--net=none", "--name=first", "busybox", "top") assert.Assert(c, waitRun("first"), check.IsNil) @@ -3620,7 +3620,7 @@ func (s *DockerSuite) TestContainerWithConflictingNoneNetwork(c *check.C) { } // #11957 - stdin with no tty does not exit if stdin is not closed even though container exited -func (s *DockerSuite) TestRunStdinBlockedAfterContainerExit(c *check.C) { +func (s *DockerSuite) TestRunStdinBlockedAfterContainerExit(c *testing.T) { cmd := exec.Command(dockerBinary, "run", "-i", "--name=test", "busybox", "true") in, err := cmd.StdinPipe() assert.NilError(c, err) @@ -3643,7 +3643,7 @@ func (s *DockerSuite) TestRunStdinBlockedAfterContainerExit(c *check.C) { } } -func (s *DockerSuite) TestRunWrongCpusetCpusFlagValue(c *check.C) { +func (s *DockerSuite) TestRunWrongCpusetCpusFlagValue(c *testing.T) { // TODO Windows: This needs validation (error out) in the daemon. testRequires(c, DaemonIsLinux) out, exitCode, err := dockerCmdWithError("run", "--cpuset-cpus", "1-10,11--", "busybox", "true") @@ -3654,7 +3654,7 @@ func (s *DockerSuite) TestRunWrongCpusetCpusFlagValue(c *check.C) { } } -func (s *DockerSuite) TestRunWrongCpusetMemsFlagValue(c *check.C) { +func (s *DockerSuite) TestRunWrongCpusetMemsFlagValue(c *testing.T) { // TODO Windows: This needs validation (error out) in the daemon. testRequires(c, DaemonIsLinux) out, exitCode, err := dockerCmdWithError("run", "--cpuset-mems", "1-42--", "busybox", "true") @@ -3666,7 +3666,7 @@ func (s *DockerSuite) TestRunWrongCpusetMemsFlagValue(c *check.C) { } // TestRunNonExecutableCmd checks that 'docker run busybox foo' exits with error code 127' -func (s *DockerSuite) TestRunNonExecutableCmd(c *check.C) { +func (s *DockerSuite) TestRunNonExecutableCmd(c *testing.T) { name := "testNonExecutableCmd" icmd.RunCommand(dockerBinary, "run", "--name", name, "busybox", "foo").Assert(c, icmd.Expected{ ExitCode: 127, @@ -3675,7 +3675,7 @@ func (s *DockerSuite) TestRunNonExecutableCmd(c *check.C) { } // TestRunNonExistingCmd checks that 'docker run busybox /bin/foo' exits with code 127. -func (s *DockerSuite) TestRunNonExistingCmd(c *check.C) { +func (s *DockerSuite) TestRunNonExistingCmd(c *testing.T) { name := "testNonExistingCmd" icmd.RunCommand(dockerBinary, "run", "--name", name, "busybox", "/bin/foo").Assert(c, icmd.Expected{ ExitCode: 127, @@ -3686,7 +3686,7 @@ func (s *DockerSuite) TestRunNonExistingCmd(c *check.C) { // TestCmdCannotBeInvoked checks that 'docker run busybox /etc' exits with 126, or // 127 on Windows. The difference is that in Windows, the container must be started // as that's when the check is made (and yes, by its design...) -func (s *DockerSuite) TestCmdCannotBeInvoked(c *check.C) { +func (s *DockerSuite) TestCmdCannotBeInvoked(c *testing.T) { expected := 126 if testEnv.OSType == "windows" { expected = 127 @@ -3700,7 +3700,7 @@ func (s *DockerSuite) TestCmdCannotBeInvoked(c *check.C) { // TestRunNonExistingImage checks that 'docker run foo' exits with error msg 125 and contains 'Unable to find image' // FIXME(vdemeester) should be a unit test -func (s *DockerSuite) TestRunNonExistingImage(c *check.C) { +func (s *DockerSuite) TestRunNonExistingImage(c *testing.T) { icmd.RunCommand(dockerBinary, "run", "foo").Assert(c, icmd.Expected{ ExitCode: 125, Err: "Unable to find image", @@ -3709,7 +3709,7 @@ func (s *DockerSuite) TestRunNonExistingImage(c *check.C) { // TestDockerFails checks that 'docker run -foo busybox' exits with 125 to signal docker run failed // FIXME(vdemeester) should be a unit test -func (s *DockerSuite) TestDockerFails(c *check.C) { +func (s *DockerSuite) TestDockerFails(c *testing.T) { icmd.RunCommand(dockerBinary, "run", "-foo", "busybox").Assert(c, icmd.Expected{ ExitCode: 125, Error: "exit status 125", @@ -3717,7 +3717,7 @@ func (s *DockerSuite) TestDockerFails(c *check.C) { } // TestRunInvalidReference invokes docker run with a bad reference. -func (s *DockerSuite) TestRunInvalidReference(c *check.C) { +func (s *DockerSuite) TestRunInvalidReference(c *testing.T) { out, exit, _ := dockerCmdWithError("run", "busybox@foo") if exit == 0 { c.Fatalf("expected non-zero exist code; received %d", exit) @@ -3729,7 +3729,7 @@ func (s *DockerSuite) TestRunInvalidReference(c *check.C) { } // Test fix for issue #17854 -func (s *DockerSuite) TestRunInitLayerPathOwnership(c *check.C) { +func (s *DockerSuite) TestRunInitLayerPathOwnership(c *testing.T) { // Not applicable on Windows as it does not support Linux uid/gid ownership testRequires(c, DaemonIsLinux) name := "testetcfileownership" @@ -3746,7 +3746,7 @@ func (s *DockerSuite) TestRunInitLayerPathOwnership(c *check.C) { } } -func (s *DockerSuite) TestRunWithOomScoreAdj(c *check.C) { +func (s *DockerSuite) TestRunWithOomScoreAdj(c *testing.T) { testRequires(c, DaemonIsLinux) expected := "642" @@ -3757,7 +3757,7 @@ func (s *DockerSuite) TestRunWithOomScoreAdj(c *check.C) { } } -func (s *DockerSuite) TestRunWithOomScoreAdjInvalidRange(c *check.C) { +func (s *DockerSuite) TestRunWithOomScoreAdjInvalidRange(c *testing.T) { testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "--oom-score-adj", "1001", "busybox", "true") @@ -3774,7 +3774,7 @@ func (s *DockerSuite) TestRunWithOomScoreAdjInvalidRange(c *check.C) { } } -func (s *DockerSuite) TestRunVolumesMountedAsShared(c *check.C) { +func (s *DockerSuite) TestRunVolumesMountedAsShared(c *testing.T) { // Volume propagation is linux only. Also it creates directories for // bind mounting, so needs to be same host. testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon, NotUserNamespace) @@ -3805,7 +3805,7 @@ func (s *DockerSuite) TestRunVolumesMountedAsShared(c *check.C) { mount.Unmount(path.Join(tmpDir, "mnt1")) } -func (s *DockerSuite) TestRunVolumesMountedAsSlave(c *check.C) { +func (s *DockerSuite) TestRunVolumesMountedAsSlave(c *testing.T) { // Volume propagation is linux only. Also it creates directories for // bind mounting, so needs to be same host. testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon, NotUserNamespace) @@ -3854,14 +3854,14 @@ func (s *DockerSuite) TestRunVolumesMountedAsSlave(c *check.C) { } } -func (s *DockerSuite) TestRunNamedVolumesMountedAsShared(c *check.C) { +func (s *DockerSuite) TestRunNamedVolumesMountedAsShared(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) out, exitCode, _ := dockerCmdWithError("run", "-v", "foo:/test:shared", "busybox", "touch", "/test/somefile") assert.Assert(c, exitCode, checker.Not(checker.Equals), 0) assert.Assert(c, out, checker.Contains, "invalid mount config") } -func (s *DockerSuite) TestRunNamedVolumeCopyImageData(c *check.C) { +func (s *DockerSuite) TestRunNamedVolumeCopyImageData(c *testing.T) { testRequires(c, DaemonIsLinux) testImg := "testvolumecopy" @@ -3875,7 +3875,7 @@ func (s *DockerSuite) TestRunNamedVolumeCopyImageData(c *check.C) { assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello") } -func (s *DockerSuite) TestRunNamedVolumeNotRemoved(c *check.C) { +func (s *DockerSuite) TestRunNamedVolumeNotRemoved(c *testing.T) { prefix, _ := getPrefixAndSlashFromDaemonPlatform() dockerCmd(c, "volume", "create", "test") @@ -3892,7 +3892,7 @@ func (s *DockerSuite) TestRunNamedVolumeNotRemoved(c *check.C) { assert.Assert(c, strings.Contains(out, "test")) } -func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *check.C) { +func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *testing.T) { prefix, _ := getPrefixAndSlashFromDaemonPlatform() dockerCmd(c, "volume", "create", "test") @@ -3923,7 +3923,7 @@ func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *check.C) { assert.Assert(c, strings.TrimSpace(out), checker.Not(checker.Contains), vname) } -func (s *DockerSuite) TestRunAttachFailedNoLeak(c *check.C) { +func (s *DockerSuite) TestRunAttachFailedNoLeak(c *testing.T) { // TODO @msabansal - https://github.com/moby/moby/issues/35023. Duplicate // port mappings are not errored out on RS3 builds. Temporarily disabling // this test pending further investigation. Note we parse kernel.GetKernelVersion @@ -3965,14 +3965,14 @@ func (s *DockerSuite) TestRunAttachFailedNoLeak(c *check.C) { } // Test for one character directory name case (#20122) -func (s *DockerSuite) TestRunVolumeWithOneCharacter(c *check.C) { +func (s *DockerSuite) TestRunVolumeWithOneCharacter(c *testing.T) { testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-v", "/tmp/q:/foo", "busybox", "sh", "-c", "find /foo") assert.Equal(c, strings.TrimSpace(out), "/foo") } -func (s *DockerSuite) TestRunVolumeCopyFlag(c *check.C) { +func (s *DockerSuite) TestRunVolumeCopyFlag(c *testing.T) { testRequires(c, DaemonIsLinux) // Windows does not support copying data from image to the volume buildImageSuccessfully(c, "volumecopy", build.WithDockerfile(`FROM busybox RUN mkdir /foo && echo hello > /foo/bar @@ -4007,7 +4007,7 @@ func (s *DockerSuite) TestRunVolumeCopyFlag(c *check.C) { } // Test case for #21976 -func (s *DockerSuite) TestRunDNSInHostMode(c *check.C) { +func (s *DockerSuite) TestRunDNSInHostMode(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) expectedOutput := "nameserver 127.0.0.1" @@ -4042,7 +4042,7 @@ func (s *DockerSuite) TestRunDNSInHostMode(c *check.C) { } // Test case for #21976 -func (s *DockerSuite) TestRunAddHostInHostMode(c *check.C) { +func (s *DockerSuite) TestRunAddHostInHostMode(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) expectedOutput := "1.2.3.4\textra" @@ -4050,7 +4050,7 @@ func (s *DockerSuite) TestRunAddHostInHostMode(c *check.C) { assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out)) } -func (s *DockerSuite) TestRunRmAndWait(c *check.C) { +func (s *DockerSuite) TestRunRmAndWait(c *testing.T) { dockerCmd(c, "run", "--name=test", "--rm", "-d", "busybox", "sh", "-c", "sleep 3;exit 2") out, code, err := dockerCmdWithError("wait", "test") @@ -4060,7 +4060,7 @@ func (s *DockerSuite) TestRunRmAndWait(c *check.C) { } // Test that auto-remove is performed by the daemon (API 1.25 and above) -func (s *DockerSuite) TestRunRm(c *check.C) { +func (s *DockerSuite) TestRunRm(c *testing.T) { name := "miss-me-when-im-gone" cli.DockerCmd(c, "run", "--name="+name, "--rm", "busybox") @@ -4071,7 +4071,7 @@ func (s *DockerSuite) TestRunRm(c *check.C) { } // Test that auto-remove is performed by the client on API versions that do not support daemon-side api-remove (API < 1.25) -func (s *DockerSuite) TestRunRmPre125Api(c *check.C) { +func (s *DockerSuite) TestRunRmPre125Api(c *testing.T) { name := "miss-me-when-im-gone" envs := appendBaseEnv(os.Getenv("DOCKER_TLS_VERIFY") != "", "DOCKER_API_VERSION=1.24") cli.Docker(cli.Args("run", "--name="+name, "--rm", "busybox"), cli.WithEnvironmentVariables(envs...)).Assert(c, icmd.Success) @@ -4083,7 +4083,7 @@ func (s *DockerSuite) TestRunRmPre125Api(c *check.C) { } // Test case for #23498 -func (s *DockerSuite) TestRunUnsetEntrypoint(c *check.C) { +func (s *DockerSuite) TestRunUnsetEntrypoint(c *testing.T) { testRequires(c, DaemonIsLinux) name := "test-entrypoint" dockerfile := `FROM busybox @@ -4113,7 +4113,7 @@ exec "$@"`, }) } -func (s *DockerDaemonSuite) TestRunWithUlimitAndDaemonDefault(c *check.C) { +func (s *DockerDaemonSuite) TestRunWithUlimitAndDaemonDefault(c *testing.T) { s.d.StartWithBusybox(c, "--debug", "--default-ulimit=nofile=65535") name := "test-A" @@ -4135,7 +4135,7 @@ func (s *DockerDaemonSuite) TestRunWithUlimitAndDaemonDefault(c *check.C) { assert.Assert(c, strings.Contains(out, "[nofile=42:42]")) } -func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *check.C) { +func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *testing.T) { nroutines, err := getGoroutineNumber() assert.NilError(c, err) @@ -4149,7 +4149,7 @@ func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *check.C) { // Handles error conditions for --credentialspec. Validating E2E success cases // requires additional infrastructure (AD for example) on CI servers. -func (s *DockerSuite) TestRunCredentialSpecFailures(c *check.C) { +func (s *DockerSuite) TestRunCredentialSpecFailures(c *testing.T) { testRequires(c, DaemonIsWindows) attempts := []struct{ value, expectedError string }{ @@ -4168,7 +4168,7 @@ func (s *DockerSuite) TestRunCredentialSpecFailures(c *check.C) { } // Windows specific test to validate credential specs with a well-formed spec. -func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *check.C) { +func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *testing.T) { testRequires(c, DaemonIsWindows, testEnv.IsLocalDaemon) validCredSpecs := readFile(`fixtures\credentialspecs\valid.json`, c) @@ -4184,7 +4184,7 @@ func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *check.C) { } } -func (s *DockerSuite) TestRunDuplicateMount(c *check.C) { +func (s *DockerSuite) TestRunDuplicateMount(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace) tmpFile, err := ioutil.TempFile("", "touch-me") @@ -4205,7 +4205,7 @@ func (s *DockerSuite) TestRunDuplicateMount(c *check.C) { assert.Assert(c, out, checker.Contains, "null") } -func (s *DockerSuite) TestRunWindowsWithCPUCount(c *check.C) { +func (s *DockerSuite) TestRunWindowsWithCPUCount(c *testing.T) { testRequires(c, DaemonIsWindows) out, _ := dockerCmd(c, "run", "--cpu-count=1", "--name", "test", "busybox", "echo", "testing") @@ -4215,7 +4215,7 @@ func (s *DockerSuite) TestRunWindowsWithCPUCount(c *check.C) { assert.Equal(c, out, "1") } -func (s *DockerSuite) TestRunWindowsWithCPUShares(c *check.C) { +func (s *DockerSuite) TestRunWindowsWithCPUShares(c *testing.T) { testRequires(c, DaemonIsWindows) out, _ := dockerCmd(c, "run", "--cpu-shares=1000", "--name", "test", "busybox", "echo", "testing") @@ -4225,7 +4225,7 @@ func (s *DockerSuite) TestRunWindowsWithCPUShares(c *check.C) { assert.Equal(c, out, "1000") } -func (s *DockerSuite) TestRunWindowsWithCPUPercent(c *check.C) { +func (s *DockerSuite) TestRunWindowsWithCPUPercent(c *testing.T) { testRequires(c, DaemonIsWindows) out, _ := dockerCmd(c, "run", "--cpu-percent=80", "--name", "test", "busybox", "echo", "testing") @@ -4235,7 +4235,7 @@ func (s *DockerSuite) TestRunWindowsWithCPUPercent(c *check.C) { assert.Equal(c, out, "80") } -func (s *DockerSuite) TestRunProcessIsolationWithCPUCountCPUSharesAndCPUPercent(c *check.C) { +func (s *DockerSuite) TestRunProcessIsolationWithCPUCountCPUSharesAndCPUPercent(c *testing.T) { testRequires(c, DaemonIsWindows, IsolationIsProcess) out, _ := dockerCmd(c, "run", "--cpu-count=1", "--cpu-shares=1000", "--cpu-percent=80", "--name", "test", "busybox", "echo", "testing") @@ -4253,7 +4253,7 @@ func (s *DockerSuite) TestRunProcessIsolationWithCPUCountCPUSharesAndCPUPercent( assert.Equal(c, out, "0") } -func (s *DockerSuite) TestRunHypervIsolationWithCPUCountCPUSharesAndCPUPercent(c *check.C) { +func (s *DockerSuite) TestRunHypervIsolationWithCPUCountCPUSharesAndCPUPercent(c *testing.T) { testRequires(c, DaemonIsWindows, IsolationIsHyperv) out, _ := dockerCmd(c, "run", "--cpu-count=1", "--cpu-shares=1000", "--cpu-percent=80", "--name", "test", "busybox", "echo", "testing") @@ -4270,7 +4270,7 @@ func (s *DockerSuite) TestRunHypervIsolationWithCPUCountCPUSharesAndCPUPercent(c } // Test for #25099 -func (s *DockerSuite) TestRunEmptyEnv(c *check.C) { +func (s *DockerSuite) TestRunEmptyEnv(c *testing.T) { testRequires(c, DaemonIsLinux) expectedOutput := "invalid environment variable:" @@ -4289,7 +4289,7 @@ func (s *DockerSuite) TestRunEmptyEnv(c *check.C) { } // #28658 -func (s *DockerSuite) TestSlowStdinClosing(c *check.C) { +func (s *DockerSuite) TestSlowStdinClosing(c *testing.T) { name := "testslowstdinclosing" repeat := 3 // regression happened 50% of the time for i := 0; i < repeat; i++ { @@ -4320,7 +4320,7 @@ func (s *delayedReader) Read([]byte) (int, error) { } // #28823 (originally #28639) -func (s *DockerSuite) TestRunMountReadOnlyDevShm(c *check.C) { +func (s *DockerSuite) TestRunMountReadOnlyDevShm(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace) emptyDir, err := ioutil.TempDir("", "test-read-only-dev-shm") assert.NilError(c, err) @@ -4332,7 +4332,7 @@ func (s *DockerSuite) TestRunMountReadOnlyDevShm(c *check.C) { assert.Assert(c, out, checker.Contains, "Read-only file system") } -func (s *DockerSuite) TestRunMount(c *check.C) { +func (s *DockerSuite) TestRunMount(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon, NotUserNamespace) // mnt1, mnt2, and testCatFooBar are commonly used in multiple test cases @@ -4509,7 +4509,7 @@ func (s *DockerSuite) TestRunMount(c *check.C) { // Test that passing a FQDN as hostname properly sets hostname, and // /etc/hostname. Test case for 29100 -func (s *DockerSuite) TestRunHostnameFQDN(c *check.C) { +func (s *DockerSuite) TestRunHostnameFQDN(c *testing.T) { testRequires(c, DaemonIsLinux) expectedOutput := "foobar.example.com\nfoobar.example.com\nfoobar\nexample.com\nfoobar.example.com" @@ -4522,7 +4522,7 @@ func (s *DockerSuite) TestRunHostnameFQDN(c *check.C) { } // Test case for 29129 -func (s *DockerSuite) TestRunHostnameInHostMode(c *check.C) { +func (s *DockerSuite) TestRunHostnameInHostMode(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) expectedOutput := "foobar\nfoobar" @@ -4530,7 +4530,7 @@ func (s *DockerSuite) TestRunHostnameInHostMode(c *check.C) { assert.Equal(c, strings.TrimSpace(out), expectedOutput) } -func (s *DockerSuite) TestRunAddDeviceCgroupRule(c *check.C) { +func (s *DockerSuite) TestRunAddDeviceCgroupRule(c *testing.T) { testRequires(c, DaemonIsLinux) deviceRule := "c 7:128 rwm" @@ -4545,7 +4545,7 @@ func (s *DockerSuite) TestRunAddDeviceCgroupRule(c *check.C) { } // Verifies that running as local system is operating correctly on Windows -func (s *DockerSuite) TestWindowsRunAsSystem(c *check.C) { +func (s *DockerSuite) TestWindowsRunAsSystem(c *testing.T) { testRequires(c, DaemonIsWindowsAtLeastBuild(15000)) out, _ := dockerCmd(c, "run", "--net=none", `--user=nt authority\system`, "--hostname=XYZZY", minimalBaseImage(), "cmd", "/c", `@echo %USERNAME%`) assert.Equal(c, strings.TrimSpace(out), "XYZZY$") diff --git a/integration-cli/docker_cli_run_unix_test.go b/integration-cli/docker_cli_run_unix_test.go index 44fc4ca61f..ce7fcdaff5 100644 --- a/integration-cli/docker_cli_run_unix_test.go +++ b/integration-cli/docker_cli_run_unix_test.go @@ -32,7 +32,7 @@ import ( ) // #6509 -func (s *DockerSuite) TestRunRedirectStdout(c *check.C) { +func (s *DockerSuite) TestRunRedirectStdout(c *testing.T) { checkRedirect := func(command string) { _, tty, err := pty.Open() assert.Assert(c, err, checker.IsNil, check.Commentf("Could not open pty")) @@ -60,7 +60,7 @@ func (s *DockerSuite) TestRunRedirectStdout(c *check.C) { } // Test recursive bind mount works by default -func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *check.C) { +func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *testing.T) { // /tmp gets permission denied testRequires(c, NotUserNamespace, testEnv.IsLocalDaemon) tmpDir, err := ioutil.TempDir("", "docker_recursive_mount_test") @@ -81,7 +81,7 @@ func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *check.C) { assert.Assert(c, out, checker.Contains, filepath.Base(f.Name()), check.Commentf("Recursive bind mount test failed. Expected file not found")) } -func (s *DockerSuite) TestRunDeviceDirectory(c *check.C) { +func (s *DockerSuite) TestRunDeviceDirectory(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) if _, err := os.Stat("/dev/snd"); err != nil { c.Skip("Host does not have /dev/snd") @@ -95,7 +95,7 @@ func (s *DockerSuite) TestRunDeviceDirectory(c *check.C) { } // TestRunAttachDetach checks attaching and detaching with the default escape sequence. -func (s *DockerSuite) TestRunAttachDetach(c *check.C) { +func (s *DockerSuite) TestRunAttachDetach(c *testing.T) { name := "attach-detach" dockerCmd(c, "run", "--name", name, "-itd", "busybox", "cat") @@ -146,7 +146,7 @@ func (s *DockerSuite) TestRunAttachDetach(c *check.C) { } // TestRunAttachDetachFromFlag checks attaching and detaching with the escape sequence specified via flags. -func (s *DockerSuite) TestRunAttachDetachFromFlag(c *check.C) { +func (s *DockerSuite) TestRunAttachDetachFromFlag(c *testing.T) { name := "attach-detach" keyCtrlA := []byte{1} keyA := []byte{97} @@ -207,7 +207,7 @@ func (s *DockerSuite) TestRunAttachDetachFromFlag(c *check.C) { } // TestRunAttachDetachFromInvalidFlag checks attaching and detaching with the escape sequence specified via flags. -func (s *DockerSuite) TestRunAttachDetachFromInvalidFlag(c *check.C) { +func (s *DockerSuite) TestRunAttachDetachFromInvalidFlag(c *testing.T) { name := "attach-detach" dockerCmd(c, "run", "--name", name, "-itd", "busybox", "top") assert.Assert(c, waitRun(name), check.IsNil) @@ -240,7 +240,7 @@ func (s *DockerSuite) TestRunAttachDetachFromInvalidFlag(c *check.C) { } // TestRunAttachDetachFromConfig checks attaching and detaching with the escape sequence specified via config file. -func (s *DockerSuite) TestRunAttachDetachFromConfig(c *check.C) { +func (s *DockerSuite) TestRunAttachDetachFromConfig(c *testing.T) { keyCtrlA := []byte{1} keyA := []byte{97} @@ -323,7 +323,7 @@ func (s *DockerSuite) TestRunAttachDetachFromConfig(c *check.C) { } // TestRunAttachDetachKeysOverrideConfig checks attaching and detaching with the detach flags, making sure it overrides config file -func (s *DockerSuite) TestRunAttachDetachKeysOverrideConfig(c *check.C) { +func (s *DockerSuite) TestRunAttachDetachKeysOverrideConfig(c *testing.T) { keyCtrlA := []byte{1} keyA := []byte{97} @@ -405,7 +405,7 @@ func (s *DockerSuite) TestRunAttachDetachKeysOverrideConfig(c *check.C) { assert.Assert(c, running, checker.Equals, "true", check.Commentf("expected container to still be running")) } -func (s *DockerSuite) TestRunAttachInvalidDetachKeySequencePreserved(c *check.C) { +func (s *DockerSuite) TestRunAttachInvalidDetachKeySequencePreserved(c *testing.T) { name := "attach-detach" keyA := []byte{97} keyB := []byte{98} @@ -456,7 +456,7 @@ func (s *DockerSuite) TestRunAttachInvalidDetachKeySequencePreserved(c *check.C) } // "test" should be printed -func (s *DockerSuite) TestRunWithCPUQuota(c *check.C) { +func (s *DockerSuite) TestRunWithCPUQuota(c *testing.T) { testRequires(c, cpuCfsQuota) file := "/sys/fs/cgroup/cpu/cpu.cfs_quota_us" @@ -467,7 +467,7 @@ func (s *DockerSuite) TestRunWithCPUQuota(c *check.C) { assert.Equal(c, out, "8000", "setting the CPU CFS quota failed") } -func (s *DockerSuite) TestRunWithCpuPeriod(c *check.C) { +func (s *DockerSuite) TestRunWithCpuPeriod(c *testing.T) { testRequires(c, cpuCfsPeriod) file := "/sys/fs/cgroup/cpu/cpu.cfs_period_us" @@ -481,7 +481,7 @@ func (s *DockerSuite) TestRunWithCpuPeriod(c *check.C) { assert.Equal(c, out, "50000", "setting the CPU CFS period failed") } -func (s *DockerSuite) TestRunWithInvalidCpuPeriod(c *check.C) { +func (s *DockerSuite) TestRunWithInvalidCpuPeriod(c *testing.T) { testRequires(c, cpuCfsPeriod) out, _, err := dockerCmdWithError("run", "--cpu-period", "900", "busybox", "true") assert.ErrorContains(c, err, "") @@ -497,7 +497,7 @@ func (s *DockerSuite) TestRunWithInvalidCpuPeriod(c *check.C) { assert.Assert(c, strings.Contains(out, expected)) } -func (s *DockerSuite) TestRunWithKernelMemory(c *check.C) { +func (s *DockerSuite) TestRunWithKernelMemory(c *testing.T) { testRequires(c, DaemonIsLinux, kernelMemorySupport) file := "/sys/fs/cgroup/memory/memory.kmem.limit_in_bytes" @@ -510,7 +510,7 @@ func (s *DockerSuite) TestRunWithKernelMemory(c *check.C) { }) } -func (s *DockerSuite) TestRunWithInvalidKernelMemory(c *check.C) { +func (s *DockerSuite) TestRunWithInvalidKernelMemory(c *testing.T) { testRequires(c, DaemonIsLinux, kernelMemorySupport) out, _, err := dockerCmdWithError("run", "--kernel-memory", "2M", "busybox", "true") @@ -524,7 +524,7 @@ func (s *DockerSuite) TestRunWithInvalidKernelMemory(c *check.C) { assert.Assert(c, strings.Contains(out, expected)) } -func (s *DockerSuite) TestRunWithCPUShares(c *check.C) { +func (s *DockerSuite) TestRunWithCPUShares(c *testing.T) { testRequires(c, cpuShare) file := "/sys/fs/cgroup/cpu/cpu.shares" @@ -536,7 +536,7 @@ func (s *DockerSuite) TestRunWithCPUShares(c *check.C) { } // "test" should be printed -func (s *DockerSuite) TestRunEchoStdoutWithCPUSharesAndMemoryLimit(c *check.C) { +func (s *DockerSuite) TestRunEchoStdoutWithCPUSharesAndMemoryLimit(c *testing.T) { testRequires(c, cpuShare) testRequires(c, memoryLimitSupport) cli.DockerCmd(c, "run", "--cpu-shares", "1000", "-m", "32m", "busybox", "echo", "test").Assert(c, icmd.Expected{ @@ -544,7 +544,7 @@ func (s *DockerSuite) TestRunEchoStdoutWithCPUSharesAndMemoryLimit(c *check.C) { }) } -func (s *DockerSuite) TestRunWithCpusetCpus(c *check.C) { +func (s *DockerSuite) TestRunWithCpusetCpus(c *testing.T) { testRequires(c, cgroupCpuset) file := "/sys/fs/cgroup/cpuset/cpuset.cpus" @@ -555,7 +555,7 @@ func (s *DockerSuite) TestRunWithCpusetCpus(c *check.C) { assert.Equal(c, out, "0") } -func (s *DockerSuite) TestRunWithCpusetMems(c *check.C) { +func (s *DockerSuite) TestRunWithCpusetMems(c *testing.T) { testRequires(c, cgroupCpuset) file := "/sys/fs/cgroup/cpuset/cpuset.mems" @@ -566,7 +566,7 @@ func (s *DockerSuite) TestRunWithCpusetMems(c *check.C) { assert.Equal(c, out, "0") } -func (s *DockerSuite) TestRunWithBlkioWeight(c *check.C) { +func (s *DockerSuite) TestRunWithBlkioWeight(c *testing.T) { testRequires(c, blkioWeight) file := "/sys/fs/cgroup/blkio/blkio.weight" @@ -577,7 +577,7 @@ func (s *DockerSuite) TestRunWithBlkioWeight(c *check.C) { assert.Equal(c, out, "300") } -func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *check.C) { +func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *testing.T) { testRequires(c, blkioWeight) out, _, err := dockerCmdWithError("run", "--blkio-weight", "5", "busybox", "true") assert.ErrorContains(c, err, "", out) @@ -585,37 +585,37 @@ func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *check.C) { assert.Assert(c, strings.Contains(out, expected)) } -func (s *DockerSuite) TestRunWithInvalidPathforBlkioWeightDevice(c *check.C) { +func (s *DockerSuite) TestRunWithInvalidPathforBlkioWeightDevice(c *testing.T) { testRequires(c, blkioWeight) out, _, err := dockerCmdWithError("run", "--blkio-weight-device", "/dev/sdX:100", "busybox", "true") assert.ErrorContains(c, err, "", out) } -func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadBps(c *check.C) { +func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadBps(c *testing.T) { testRequires(c, blkioWeight) out, _, err := dockerCmdWithError("run", "--device-read-bps", "/dev/sdX:500", "busybox", "true") assert.ErrorContains(c, err, "", out) } -func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteBps(c *check.C) { +func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteBps(c *testing.T) { testRequires(c, blkioWeight) out, _, err := dockerCmdWithError("run", "--device-write-bps", "/dev/sdX:500", "busybox", "true") assert.ErrorContains(c, err, "", out) } -func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadIOps(c *check.C) { +func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadIOps(c *testing.T) { testRequires(c, blkioWeight) out, _, err := dockerCmdWithError("run", "--device-read-iops", "/dev/sdX:500", "busybox", "true") assert.ErrorContains(c, err, "", out) } -func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteIOps(c *check.C) { +func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteIOps(c *testing.T) { testRequires(c, blkioWeight) out, _, err := dockerCmdWithError("run", "--device-write-iops", "/dev/sdX:500", "busybox", "true") assert.ErrorContains(c, err, "", out) } -func (s *DockerSuite) TestRunOOMExitCode(c *check.C) { +func (s *DockerSuite) TestRunOOMExitCode(c *testing.T) { testRequires(c, memoryLimitSupport, swapMemorySupport, NotPpc64le) errChan := make(chan error) go func() { @@ -635,7 +635,7 @@ func (s *DockerSuite) TestRunOOMExitCode(c *check.C) { } } -func (s *DockerSuite) TestRunWithMemoryLimit(c *check.C) { +func (s *DockerSuite) TestRunWithMemoryLimit(c *testing.T) { testRequires(c, memoryLimitSupport) file := "/sys/fs/cgroup/memory/memory.limit_in_bytes" @@ -651,14 +651,14 @@ func (s *DockerSuite) TestRunWithMemoryLimit(c *check.C) { // memory limit, this means the processes in the container can use // 16M memory and as much swap memory as they need (if the host // supports swap memory). -func (s *DockerSuite) TestRunWithoutMemoryswapLimit(c *check.C) { +func (s *DockerSuite) TestRunWithoutMemoryswapLimit(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, memoryLimitSupport) testRequires(c, swapMemorySupport) dockerCmd(c, "run", "-m", "32m", "--memory-swap", "-1", "busybox", "true") } -func (s *DockerSuite) TestRunWithSwappiness(c *check.C) { +func (s *DockerSuite) TestRunWithSwappiness(c *testing.T) { testRequires(c, memorySwappinessSupport) file := "/sys/fs/cgroup/memory/memory.swappiness" out, _ := dockerCmd(c, "run", "--memory-swappiness", "0", "--name", "test", "busybox", "cat", file) @@ -668,7 +668,7 @@ func (s *DockerSuite) TestRunWithSwappiness(c *check.C) { assert.Equal(c, out, "0") } -func (s *DockerSuite) TestRunWithSwappinessInvalid(c *check.C) { +func (s *DockerSuite) TestRunWithSwappinessInvalid(c *testing.T) { testRequires(c, memorySwappinessSupport) out, _, err := dockerCmdWithError("run", "--memory-swappiness", "101", "busybox", "true") assert.ErrorContains(c, err, "") @@ -680,7 +680,7 @@ func (s *DockerSuite) TestRunWithSwappinessInvalid(c *check.C) { assert.Assert(c, out, checker.Contains, expected, check.Commentf("Expected output to contain %q, not %q", out, expected)) } -func (s *DockerSuite) TestRunWithMemoryReservation(c *check.C) { +func (s *DockerSuite) TestRunWithMemoryReservation(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, memoryReservationSupport) file := "/sys/fs/cgroup/memory/memory.soft_limit_in_bytes" @@ -691,7 +691,7 @@ func (s *DockerSuite) TestRunWithMemoryReservation(c *check.C) { assert.Equal(c, out, "209715200") } -func (s *DockerSuite) TestRunWithMemoryReservationInvalid(c *check.C) { +func (s *DockerSuite) TestRunWithMemoryReservationInvalid(c *testing.T) { testRequires(c, memoryLimitSupport) testRequires(c, testEnv.IsLocalDaemon, memoryReservationSupport) out, _, err := dockerCmdWithError("run", "-m", "500M", "--memory-reservation", "800M", "busybox", "true") @@ -705,7 +705,7 @@ func (s *DockerSuite) TestRunWithMemoryReservationInvalid(c *check.C) { assert.Assert(c, strings.TrimSpace(out), checker.Contains, expected, check.Commentf("run container should fail with invalid memory reservation")) } -func (s *DockerSuite) TestStopContainerSignal(c *check.C) { +func (s *DockerSuite) TestStopContainerSignal(c *testing.T) { out, _ := dockerCmd(c, "run", "--stop-signal", "SIGUSR1", "-d", "busybox", "/bin/sh", "-c", `trap 'echo "exit trapped"; exit 0' USR1; while true; do sleep 1; done`) containerID := strings.TrimSpace(out) @@ -717,7 +717,7 @@ func (s *DockerSuite) TestStopContainerSignal(c *check.C) { assert.Assert(c, out, checker.Contains, "exit trapped", check.Commentf("Expected `exit trapped` in the log")) } -func (s *DockerSuite) TestRunSwapLessThanMemoryLimit(c *check.C) { +func (s *DockerSuite) TestRunSwapLessThanMemoryLimit(c *testing.T) { testRequires(c, memoryLimitSupport) testRequires(c, swapMemorySupport) out, _, err := dockerCmdWithError("run", "-m", "16m", "--memory-swap", "15m", "busybox", "echo", "test") @@ -727,7 +727,7 @@ func (s *DockerSuite) TestRunSwapLessThanMemoryLimit(c *check.C) { assert.Assert(c, strings.Contains(out, expected)) } -func (s *DockerSuite) TestRunInvalidCpusetCpusFlagValue(c *check.C) { +func (s *DockerSuite) TestRunInvalidCpusetCpusFlagValue(c *testing.T) { testRequires(c, cgroupCpuset, testEnv.IsLocalDaemon) sysInfo := sysinfo.New(true) @@ -746,7 +746,7 @@ func (s *DockerSuite) TestRunInvalidCpusetCpusFlagValue(c *check.C) { assert.Assert(c, strings.Contains(out, expected)) } -func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *check.C) { +func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *testing.T) { testRequires(c, cgroupCpuset) sysInfo := sysinfo.New(true) @@ -765,7 +765,7 @@ func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *check.C) { assert.Assert(c, strings.Contains(out, expected)) } -func (s *DockerSuite) TestRunInvalidCPUShares(c *check.C) { +func (s *DockerSuite) TestRunInvalidCPUShares(c *testing.T) { testRequires(c, cpuShare, DaemonIsLinux) out, _, err := dockerCmdWithError("run", "--cpu-shares", "1", "busybox", "echo", "test") assert.ErrorContains(c, err, "", out) @@ -783,7 +783,7 @@ func (s *DockerSuite) TestRunInvalidCPUShares(c *check.C) { assert.Assert(c, strings.Contains(out, expected)) } -func (s *DockerSuite) TestRunWithDefaultShmSize(c *check.C) { +func (s *DockerSuite) TestRunWithDefaultShmSize(c *testing.T) { testRequires(c, DaemonIsLinux) name := "shm-default" @@ -796,7 +796,7 @@ func (s *DockerSuite) TestRunWithDefaultShmSize(c *check.C) { assert.Assert(c, shmSize, check.Equals, "67108864") } -func (s *DockerSuite) TestRunWithShmSize(c *check.C) { +func (s *DockerSuite) TestRunWithShmSize(c *testing.T) { testRequires(c, DaemonIsLinux) name := "shm" @@ -809,7 +809,7 @@ func (s *DockerSuite) TestRunWithShmSize(c *check.C) { assert.Assert(c, shmSize, check.Equals, "1073741824") } -func (s *DockerSuite) TestRunTmpfsMountsEnsureOrdered(c *check.C) { +func (s *DockerSuite) TestRunTmpfsMountsEnsureOrdered(c *testing.T) { tmpFile, err := ioutil.TempFile("", "test") assert.NilError(c, err) defer tmpFile.Close() @@ -817,7 +817,7 @@ func (s *DockerSuite) TestRunTmpfsMountsEnsureOrdered(c *check.C) { assert.Assert(c, out, checker.Contains, "test") } -func (s *DockerSuite) TestRunTmpfsMounts(c *check.C) { +func (s *DockerSuite) TestRunTmpfsMounts(c *testing.T) { // TODO Windows (Post TP5): This test cannot run on a Windows daemon as // Windows does not support tmpfs mounts. testRequires(c, DaemonIsLinux) @@ -838,7 +838,7 @@ func (s *DockerSuite) TestRunTmpfsMounts(c *check.C) { } } -func (s *DockerSuite) TestRunTmpfsMountsOverrideImageVolumes(c *check.C) { +func (s *DockerSuite) TestRunTmpfsMountsOverrideImageVolumes(c *testing.T) { name := "img-with-volumes" buildImageSuccessfully(c, name, build.WithDockerfile(` FROM busybox @@ -850,7 +850,7 @@ func (s *DockerSuite) TestRunTmpfsMountsOverrideImageVolumes(c *check.C) { } // Test case for #22420 -func (s *DockerSuite) TestRunTmpfsMountsWithOptions(c *check.C) { +func (s *DockerSuite) TestRunTmpfsMountsWithOptions(c *testing.T) { testRequires(c, DaemonIsLinux) expectedOptions := []string{"rw", "nosuid", "nodev", "noexec", "relatime"} @@ -890,7 +890,7 @@ func (s *DockerSuite) TestRunTmpfsMountsWithOptions(c *check.C) { } } -func (s *DockerSuite) TestRunSysctls(c *check.C) { +func (s *DockerSuite) TestRunSysctls(c *testing.T) { testRequires(c, DaemonIsLinux) var err error @@ -921,7 +921,7 @@ func (s *DockerSuite) TestRunSysctls(c *check.C) { } // TestRunSeccompProfileDenyUnshare checks that 'docker run --security-opt seccomp=/tmp/profile.json debian:jessie unshare' exits with operation not permitted. -func (s *DockerSuite) TestRunSeccompProfileDenyUnshare(c *check.C) { +func (s *DockerSuite) TestRunSeccompProfileDenyUnshare(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, NotArm, Apparmor) jsonData := `{ "defaultAction": "SCMP_ACT_ALLOW", @@ -950,7 +950,7 @@ func (s *DockerSuite) TestRunSeccompProfileDenyUnshare(c *check.C) { } // TestRunSeccompProfileDenyChmod checks that 'docker run --security-opt seccomp=/tmp/profile.json busybox chmod 400 /etc/hostname' exits with operation not permitted. -func (s *DockerSuite) TestRunSeccompProfileDenyChmod(c *check.C) { +func (s *DockerSuite) TestRunSeccompProfileDenyChmod(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, seccompEnabled) jsonData := `{ "defaultAction": "SCMP_ACT_ALLOW", @@ -985,7 +985,7 @@ func (s *DockerSuite) TestRunSeccompProfileDenyChmod(c *check.C) { // TestRunSeccompProfileDenyUnshareUserns checks that 'docker run debian:jessie unshare --map-root-user --user sh -c whoami' with a specific profile to // deny unshare of a userns exits with operation not permitted. -func (s *DockerSuite) TestRunSeccompProfileDenyUnshareUserns(c *check.C) { +func (s *DockerSuite) TestRunSeccompProfileDenyUnshareUserns(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, NotArm, Apparmor) // from sched.h jsonData := fmt.Sprintf(`{ @@ -1023,7 +1023,7 @@ func (s *DockerSuite) TestRunSeccompProfileDenyUnshareUserns(c *check.C) { // TestRunSeccompProfileDenyCloneUserns checks that 'docker run syscall-test' // with a the default seccomp profile exits with operation not permitted. -func (s *DockerSuite) TestRunSeccompProfileDenyCloneUserns(c *check.C) { +func (s *DockerSuite) TestRunSeccompProfileDenyCloneUserns(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, seccompEnabled) ensureSyscallTest(c) @@ -1035,7 +1035,7 @@ func (s *DockerSuite) TestRunSeccompProfileDenyCloneUserns(c *check.C) { // TestRunSeccompUnconfinedCloneUserns checks that // 'docker run --security-opt seccomp=unconfined syscall-test' allows creating a userns. -func (s *DockerSuite) TestRunSeccompUnconfinedCloneUserns(c *check.C) { +func (s *DockerSuite) TestRunSeccompUnconfinedCloneUserns(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, UserNamespaceInKernel, NotUserNamespace, unprivilegedUsernsClone) ensureSyscallTest(c) @@ -1048,7 +1048,7 @@ func (s *DockerSuite) TestRunSeccompUnconfinedCloneUserns(c *check.C) { // TestRunSeccompAllowPrivCloneUserns checks that 'docker run --privileged syscall-test' // allows creating a userns. -func (s *DockerSuite) TestRunSeccompAllowPrivCloneUserns(c *check.C) { +func (s *DockerSuite) TestRunSeccompAllowPrivCloneUserns(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, UserNamespaceInKernel, NotUserNamespace) ensureSyscallTest(c) @@ -1060,7 +1060,7 @@ func (s *DockerSuite) TestRunSeccompAllowPrivCloneUserns(c *check.C) { // TestRunSeccompProfileAllow32Bit checks that 32 bit code can run on x86_64 // with the default seccomp profile. -func (s *DockerSuite) TestRunSeccompProfileAllow32Bit(c *check.C) { +func (s *DockerSuite) TestRunSeccompProfileAllow32Bit(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, IsAmd64) ensureSyscallTest(c) @@ -1068,14 +1068,14 @@ func (s *DockerSuite) TestRunSeccompProfileAllow32Bit(c *check.C) { } // TestRunSeccompAllowSetrlimit checks that 'docker run debian:jessie ulimit -v 1048510' succeeds. -func (s *DockerSuite) TestRunSeccompAllowSetrlimit(c *check.C) { +func (s *DockerSuite) TestRunSeccompAllowSetrlimit(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, seccompEnabled) // ulimit uses setrlimit, so we want to make sure we don't break it icmd.RunCommand(dockerBinary, "run", "debian:jessie", "bash", "-c", "ulimit -v 1048510").Assert(c, icmd.Success) } -func (s *DockerSuite) TestRunSeccompDefaultProfileAcct(c *check.C) { +func (s *DockerSuite) TestRunSeccompDefaultProfileAcct(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, NotUserNamespace) ensureSyscallTest(c) @@ -1105,7 +1105,7 @@ func (s *DockerSuite) TestRunSeccompDefaultProfileAcct(c *check.C) { } } -func (s *DockerSuite) TestRunSeccompDefaultProfileNS(c *check.C) { +func (s *DockerSuite) TestRunSeccompDefaultProfileNS(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, NotUserNamespace) ensureSyscallTest(c) @@ -1142,7 +1142,7 @@ func (s *DockerSuite) TestRunSeccompDefaultProfileNS(c *check.C) { // TestRunNoNewPrivSetuid checks that --security-opt='no-new-privileges=true' prevents // effective uid transitions on executing setuid binaries. -func (s *DockerSuite) TestRunNoNewPrivSetuid(c *check.C) { +func (s *DockerSuite) TestRunNoNewPrivSetuid(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, testEnv.IsLocalDaemon) ensureNNPTest(c) @@ -1155,7 +1155,7 @@ func (s *DockerSuite) TestRunNoNewPrivSetuid(c *check.C) { // TestLegacyRunNoNewPrivSetuid checks that --security-opt=no-new-privileges prevents // effective uid transitions on executing setuid binaries. -func (s *DockerSuite) TestLegacyRunNoNewPrivSetuid(c *check.C) { +func (s *DockerSuite) TestLegacyRunNoNewPrivSetuid(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, testEnv.IsLocalDaemon) ensureNNPTest(c) @@ -1166,7 +1166,7 @@ func (s *DockerSuite) TestLegacyRunNoNewPrivSetuid(c *check.C) { }) } -func (s *DockerSuite) TestUserNoEffectiveCapabilitiesChown(c *check.C) { +func (s *DockerSuite) TestUserNoEffectiveCapabilitiesChown(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) ensureSyscallTest(c) @@ -1184,7 +1184,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesChown(c *check.C) { }) } -func (s *DockerSuite) TestUserNoEffectiveCapabilitiesDacOverride(c *check.C) { +func (s *DockerSuite) TestUserNoEffectiveCapabilitiesDacOverride(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) ensureSyscallTest(c) @@ -1197,7 +1197,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesDacOverride(c *check.C) { }) } -func (s *DockerSuite) TestUserNoEffectiveCapabilitiesFowner(c *check.C) { +func (s *DockerSuite) TestUserNoEffectiveCapabilitiesFowner(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) ensureSyscallTest(c) @@ -1213,7 +1213,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesFowner(c *check.C) { // TODO CAP_KILL -func (s *DockerSuite) TestUserNoEffectiveCapabilitiesSetuid(c *check.C) { +func (s *DockerSuite) TestUserNoEffectiveCapabilitiesSetuid(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) ensureSyscallTest(c) @@ -1231,7 +1231,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesSetuid(c *check.C) { }) } -func (s *DockerSuite) TestUserNoEffectiveCapabilitiesSetgid(c *check.C) { +func (s *DockerSuite) TestUserNoEffectiveCapabilitiesSetgid(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) ensureSyscallTest(c) @@ -1251,7 +1251,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesSetgid(c *check.C) { // TODO CAP_SETPCAP -func (s *DockerSuite) TestUserNoEffectiveCapabilitiesNetBindService(c *check.C) { +func (s *DockerSuite) TestUserNoEffectiveCapabilitiesNetBindService(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) ensureSyscallTest(c) @@ -1269,7 +1269,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesNetBindService(c *check.C) }) } -func (s *DockerSuite) TestUserNoEffectiveCapabilitiesNetRaw(c *check.C) { +func (s *DockerSuite) TestUserNoEffectiveCapabilitiesNetRaw(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) ensureSyscallTest(c) @@ -1287,7 +1287,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesNetRaw(c *check.C) { }) } -func (s *DockerSuite) TestUserNoEffectiveCapabilitiesChroot(c *check.C) { +func (s *DockerSuite) TestUserNoEffectiveCapabilitiesChroot(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) ensureSyscallTest(c) @@ -1305,7 +1305,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesChroot(c *check.C) { }) } -func (s *DockerSuite) TestUserNoEffectiveCapabilitiesMknod(c *check.C) { +func (s *DockerSuite) TestUserNoEffectiveCapabilitiesMknod(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, testEnv.IsLocalDaemon) ensureSyscallTest(c) @@ -1327,7 +1327,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesMknod(c *check.C) { // TODO CAP_AUDIT_WRITE // TODO CAP_SETFCAP -func (s *DockerSuite) TestRunApparmorProcDirectory(c *check.C) { +func (s *DockerSuite) TestRunApparmorProcDirectory(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, Apparmor) // running w seccomp unconfined tests the apparmor profile @@ -1346,7 +1346,7 @@ func (s *DockerSuite) TestRunApparmorProcDirectory(c *check.C) { // make sure the default profile can be successfully parsed (using unshare as it is // something which we know is blocked in the default profile) -func (s *DockerSuite) TestRunSeccompWithDefaultProfile(c *check.C) { +func (s *DockerSuite) TestRunSeccompWithDefaultProfile(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, seccompEnabled) out, _, err := dockerCmdWithError("run", "--security-opt", "seccomp=../profiles/seccomp/default.json", "debian:jessie", "unshare", "--map-root-user", "--user", "sh", "-c", "whoami") @@ -1355,7 +1355,7 @@ func (s *DockerSuite) TestRunSeccompWithDefaultProfile(c *check.C) { } // TestRunDeviceSymlink checks run with device that follows symlink (#13840 and #22271) -func (s *DockerSuite) TestRunDeviceSymlink(c *check.C) { +func (s *DockerSuite) TestRunDeviceSymlink(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm, testEnv.IsLocalDaemon) if _, err := os.Stat("/dev/zero"); err != nil { c.Skip("Host does not have /dev/zero") @@ -1404,7 +1404,7 @@ func (s *DockerSuite) TestRunDeviceSymlink(c *check.C) { } // TestRunPIDsLimit makes sure the pids cgroup is set with --pids-limit -func (s *DockerSuite) TestRunPIDsLimit(c *check.C) { +func (s *DockerSuite) TestRunPIDsLimit(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, pidsLimit) file := "/sys/fs/cgroup/pids/pids.max" @@ -1415,7 +1415,7 @@ func (s *DockerSuite) TestRunPIDsLimit(c *check.C) { assert.Equal(c, out, "4", "setting the pids limit failed") } -func (s *DockerSuite) TestRunPrivilegedAllowedDevices(c *check.C) { +func (s *DockerSuite) TestRunPrivilegedAllowedDevices(c *testing.T) { testRequires(c, DaemonIsLinux, NotUserNamespace) file := "/sys/fs/cgroup/devices/devices.list" @@ -1424,7 +1424,7 @@ func (s *DockerSuite) TestRunPrivilegedAllowedDevices(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "a *:* rwm") } -func (s *DockerSuite) TestRunUserDeviceAllowed(c *check.C) { +func (s *DockerSuite) TestRunUserDeviceAllowed(c *testing.T) { testRequires(c, DaemonIsLinux) fi, err := os.Stat("/dev/snd/timer") @@ -1441,7 +1441,7 @@ func (s *DockerSuite) TestRunUserDeviceAllowed(c *check.C) { assert.Assert(c, out, checker.Contains, fmt.Sprintf("c %d:%d w", stat.Rdev/256, stat.Rdev%256)) } -func (s *DockerDaemonSuite) TestRunSeccompJSONNewFormat(c *check.C) { +func (s *DockerDaemonSuite) TestRunSeccompJSONNewFormat(c *testing.T) { testRequires(c, seccompEnabled) s.d.StartWithBusybox(c) @@ -1466,7 +1466,7 @@ func (s *DockerDaemonSuite) TestRunSeccompJSONNewFormat(c *check.C) { assert.Assert(c, out, checker.Contains, "Operation not permitted") } -func (s *DockerDaemonSuite) TestRunSeccompJSONNoNameAndNames(c *check.C) { +func (s *DockerDaemonSuite) TestRunSeccompJSONNoNameAndNames(c *testing.T) { testRequires(c, seccompEnabled) s.d.StartWithBusybox(c) @@ -1492,7 +1492,7 @@ func (s *DockerDaemonSuite) TestRunSeccompJSONNoNameAndNames(c *check.C) { assert.Assert(c, out, checker.Contains, "'name' and 'names' were specified in the seccomp profile, use either 'name' or 'names'") } -func (s *DockerDaemonSuite) TestRunSeccompJSONNoArchAndArchMap(c *check.C) { +func (s *DockerDaemonSuite) TestRunSeccompJSONNoArchAndArchMap(c *testing.T) { testRequires(c, seccompEnabled) s.d.StartWithBusybox(c) @@ -1529,7 +1529,7 @@ func (s *DockerDaemonSuite) TestRunSeccompJSONNoArchAndArchMap(c *check.C) { assert.Assert(c, out, checker.Contains, "'architectures' and 'archMap' were specified in the seccomp profile, use either 'architectures' or 'archMap'") } -func (s *DockerDaemonSuite) TestRunWithDaemonDefaultSeccompProfile(c *check.C) { +func (s *DockerDaemonSuite) TestRunWithDaemonDefaultSeccompProfile(c *testing.T) { testRequires(c, seccompEnabled) s.d.StartWithBusybox(c) @@ -1565,7 +1565,7 @@ func (s *DockerDaemonSuite) TestRunWithDaemonDefaultSeccompProfile(c *check.C) { assert.Assert(c, out, checker.Contains, "Operation not permitted") } -func (s *DockerSuite) TestRunWithNanoCPUs(c *check.C) { +func (s *DockerSuite) TestRunWithNanoCPUs(c *testing.T) { testRequires(c, cpuCfsQuota, cpuCfsPeriod) file1 := "/sys/fs/cgroup/cpu/cpu.cfs_quota_us" diff --git a/integration-cli/docker_cli_save_load_test.go b/integration-cli/docker_cli_save_load_test.go index 1587c4792e..0e319300e6 100644 --- a/integration-cli/docker_cli_save_load_test.go +++ b/integration-cli/docker_cli_save_load_test.go @@ -25,7 +25,7 @@ import ( ) // save a repo using gz compression and try to load it using stdout -func (s *DockerSuite) TestSaveXzAndLoadRepoStdout(c *check.C) { +func (s *DockerSuite) TestSaveXzAndLoadRepoStdout(c *testing.T) { testRequires(c, DaemonIsLinux) name := "test-save-xz-and-load-repo-stdout" dockerCmd(c, "run", "--name", name, "busybox", "true") @@ -54,7 +54,7 @@ func (s *DockerSuite) TestSaveXzAndLoadRepoStdout(c *check.C) { } // save a repo using xz+gz compression and try to load it using stdout -func (s *DockerSuite) TestSaveXzGzAndLoadRepoStdout(c *check.C) { +func (s *DockerSuite) TestSaveXzGzAndLoadRepoStdout(c *testing.T) { testRequires(c, DaemonIsLinux) name := "test-save-xz-gz-and-load-repo-stdout" dockerCmd(c, "run", "--name", name, "busybox", "true") @@ -83,7 +83,7 @@ func (s *DockerSuite) TestSaveXzGzAndLoadRepoStdout(c *check.C) { assert.ErrorContains(c, err, "", "the repo should not exist: %v", after) } -func (s *DockerSuite) TestSaveSingleTag(c *check.C) { +func (s *DockerSuite) TestSaveSingleTag(c *testing.T) { testRequires(c, DaemonIsLinux) repoName := "foobar-save-single-tag-test" dockerCmd(c, "tag", "busybox:latest", fmt.Sprintf("%v:latest", repoName)) @@ -98,7 +98,7 @@ func (s *DockerSuite) TestSaveSingleTag(c *check.C) { assert.NilError(c, err, "failed to save repo with image ID and 'repositories' file: %s, %v", out, err) } -func (s *DockerSuite) TestSaveCheckTimes(c *check.C) { +func (s *DockerSuite) TestSaveCheckTimes(c *testing.T) { testRequires(c, DaemonIsLinux) repoName := "busybox:latest" out, _ := dockerCmd(c, "inspect", repoName) @@ -117,7 +117,7 @@ func (s *DockerSuite) TestSaveCheckTimes(c *check.C) { assert.NilError(c, err, "failed to save repo with image ID and 'repositories' file: %s, %v", out, err) } -func (s *DockerSuite) TestSaveImageId(c *check.C) { +func (s *DockerSuite) TestSaveImageId(c *testing.T) { testRequires(c, DaemonIsLinux) repoName := "foobar-save-image-id-test" dockerCmd(c, "tag", "emptyfs:latest", fmt.Sprintf("%v:latest", repoName)) @@ -156,7 +156,7 @@ func (s *DockerSuite) TestSaveImageId(c *check.C) { } // save a repo and try to load it using flags -func (s *DockerSuite) TestSaveAndLoadRepoFlags(c *check.C) { +func (s *DockerSuite) TestSaveAndLoadRepoFlags(c *testing.T) { testRequires(c, DaemonIsLinux) name := "test-save-and-load-repo-flags" dockerCmd(c, "run", "--name", name, "busybox", "true") @@ -177,7 +177,7 @@ func (s *DockerSuite) TestSaveAndLoadRepoFlags(c *check.C) { assert.Equal(c, before, after, "inspect is not the same after a save / load") } -func (s *DockerSuite) TestSaveWithNoExistImage(c *check.C) { +func (s *DockerSuite) TestSaveWithNoExistImage(c *testing.T) { testRequires(c, DaemonIsLinux) imgName := "foobar-non-existing-image" @@ -187,7 +187,7 @@ func (s *DockerSuite) TestSaveWithNoExistImage(c *check.C) { assert.Assert(c, strings.Contains(out, fmt.Sprintf("No such image: %s", imgName))) } -func (s *DockerSuite) TestSaveMultipleNames(c *check.C) { +func (s *DockerSuite) TestSaveMultipleNames(c *testing.T) { testRequires(c, DaemonIsLinux) repoName := "foobar-save-multi-name-test" @@ -205,7 +205,7 @@ func (s *DockerSuite) TestSaveMultipleNames(c *check.C) { assert.NilError(c, err, "failed to save multiple repos: %s, %v", out, err) } -func (s *DockerSuite) TestSaveRepoWithMultipleImages(c *check.C) { +func (s *DockerSuite) TestSaveRepoWithMultipleImages(c *testing.T) { testRequires(c, DaemonIsLinux) makeImage := func(from string, tag string) string { var ( @@ -257,7 +257,7 @@ func (s *DockerSuite) TestSaveRepoWithMultipleImages(c *check.C) { } // Issue #6722 #5892 ensure directories are included in changes -func (s *DockerSuite) TestSaveDirectoryPermissions(c *check.C) { +func (s *DockerSuite) TestSaveDirectoryPermissions(c *testing.T) { testRequires(c, DaemonIsLinux) layerEntries := []string{"opt/", "opt/a/", "opt/a/b/", "opt/a/b/c"} layerEntriesAUFS := []string{"./", ".wh..wh.aufs", ".wh..wh.orph/", ".wh..wh.plnk/", "opt/", "opt/a/", "opt/a/b/", "opt/a/b/c"} @@ -331,7 +331,7 @@ func listTar(f io.Reader) ([]string, error) { // Test loading a weird image where one of the layers is of zero size. // The layer.tar file is actually zero bytes, no padding or anything else. // See issue: 18170 -func (s *DockerSuite) TestLoadZeroSizeLayer(c *check.C) { +func (s *DockerSuite) TestLoadZeroSizeLayer(c *testing.T) { // this will definitely not work if using remote daemon // very weird test testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) @@ -339,7 +339,7 @@ func (s *DockerSuite) TestLoadZeroSizeLayer(c *check.C) { dockerCmd(c, "load", "-i", "testdata/emptyLayer.tar") } -func (s *DockerSuite) TestSaveLoadParents(c *check.C) { +func (s *DockerSuite) TestSaveLoadParents(c *testing.T) { testRequires(c, DaemonIsLinux) makeImage := func(from string, addfile string) string { @@ -378,7 +378,7 @@ func (s *DockerSuite) TestSaveLoadParents(c *check.C) { assert.Equal(c, inspectOut, "") } -func (s *DockerSuite) TestSaveLoadNoTag(c *check.C) { +func (s *DockerSuite) TestSaveLoadNoTag(c *testing.T) { testRequires(c, DaemonIsLinux) name := "saveloadnotag" diff --git a/integration-cli/docker_cli_save_load_unix_test.go b/integration-cli/docker_cli_save_load_unix_test.go index cbe1dd2511..2bdd127a4e 100644 --- a/integration-cli/docker_cli_save_load_unix_test.go +++ b/integration-cli/docker_cli_save_load_unix_test.go @@ -19,7 +19,7 @@ import ( ) // save a repo and try to load it using stdout -func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *check.C) { +func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *testing.T) { name := "test-save-and-load-repo-stdout" dockerCmd(c, "run", "--name", name, "busybox", "true") @@ -70,7 +70,7 @@ func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *check.C) { assert.Assert(c, strings.Contains(string(buf[:n]), "cowardly refusing"), "help output is not being yielded") } -func (s *DockerSuite) TestSaveAndLoadWithProgressBar(c *check.C) { +func (s *DockerSuite) TestSaveAndLoadWithProgressBar(c *testing.T) { name := "test-load" buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox RUN touch aa @@ -88,7 +88,7 @@ func (s *DockerSuite) TestSaveAndLoadWithProgressBar(c *check.C) { } // fail because load didn't receive data from stdin -func (s *DockerSuite) TestLoadNoStdinFail(c *check.C) { +func (s *DockerSuite) TestLoadNoStdinFail(c *testing.T) { pty, tty, err := pty.Open() assert.NilError(c, err) ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) diff --git a/integration-cli/docker_cli_search_test.go b/integration-cli/docker_cli_search_test.go index 4226453ca0..c68c1ea8c9 100644 --- a/integration-cli/docker_cli_search_test.go +++ b/integration-cli/docker_cli_search_test.go @@ -9,12 +9,12 @@ import ( ) // search for repos named "registry" on the central registry -func (s *DockerSuite) TestSearchOnCentralRegistry(c *check.C) { +func (s *DockerSuite) TestSearchOnCentralRegistry(c *testing.T) { out, _ := dockerCmd(c, "search", "busybox") assert.Assert(c, strings.Contains(out, "Busybox base image."), "couldn't find any repository named (or containing) 'Busybox base image.'") } -func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *check.C) { +func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *testing.T) { out, _, err := dockerCmdWithError("search", "--filter", "stars=a", "busybox") assert.ErrorContains(c, err, "", out) assert.Assert(c, strings.Contains(out, "Invalid filter"), "couldn't find the invalid filter warning") @@ -32,7 +32,7 @@ func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *check.C) { assert.Assert(c, strings.Contains(out, "Invalid filter"), "couldn't find the invalid filter warning") } -func (s *DockerSuite) TestSearchCmdOptions(c *check.C) { +func (s *DockerSuite) TestSearchCmdOptions(c *testing.T) { outSearchCmd, _ := dockerCmd(c, "search", "busybox") assert.Assert(c, strings.Count(outSearchCmd, "\n") > 3, outSearchCmd) @@ -60,12 +60,12 @@ func (s *DockerSuite) TestSearchCmdOptions(c *check.C) { } // search for repos which start with "ubuntu-" on the central registry -func (s *DockerSuite) TestSearchOnCentralRegistryWithDash(c *check.C) { +func (s *DockerSuite) TestSearchOnCentralRegistryWithDash(c *testing.T) { dockerCmd(c, "search", "ubuntu-") } // test case for #23055 -func (s *DockerSuite) TestSearchWithLimit(c *check.C) { +func (s *DockerSuite) TestSearchWithLimit(c *testing.T) { for _, limit := range []int{10, 50, 100} { out, _, err := dockerCmdWithError("search", fmt.Sprintf("--limit=%d", limit), "docker") assert.NilError(c, err) diff --git a/integration-cli/docker_cli_service_create_test.go b/integration-cli/docker_cli_service_create_test.go index 41f176695b..521e7e388a 100644 --- a/integration-cli/docker_cli_service_create_test.go +++ b/integration-cli/docker_cli_service_create_test.go @@ -16,20 +16,20 @@ import ( "gotest.tools/assert" ) -func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) { +func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--mount", "type=volume,source=foo,target=/foo,volume-nocopy", "busybox", "top") assert.NilError(c, err, out) id := strings.TrimSpace(out) var tasks []swarm.Task - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { tasks = d.GetServiceTasks(c, id) return len(tasks) > 0, nil }, checker.Equals, true) task := tasks[0] - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { if task.NodeID == "" || task.Status.ContainerStatus == nil { task = d.GetTask(c, task.ID) } @@ -64,7 +64,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) { assert.Assert(c, mounts[0].RW, checker.Equals, true) } -func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *check.C) { +func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *testing.T) { d := s.AddDaemon(c, true, true) serviceName := "test-service-secret" @@ -98,7 +98,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *check.C) { d.DeleteSecret(c, testName) } -func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *check.C) { +func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *testing.T) { d := s.AddDaemon(c, true, true) testPaths := map[string]string{ @@ -137,13 +137,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *check assert.Equal(c, len(refs), len(testPaths)) var tasks []swarm.Task - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { tasks = d.GetServiceTasks(c, serviceName) return len(tasks) > 0, nil }, checker.Equals, true) task := tasks[0] - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { if task.NodeID == "" || task.Status.ContainerStatus == nil { task = d.GetTask(c, task.ID) } @@ -164,7 +164,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *check assert.NilError(c, err, out) } -func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C) { +func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *testing.T) { d := s.AddDaemon(c, true, true) id := d.CreateSecret(c, swarm.SecretSpec{ @@ -187,13 +187,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C assert.Equal(c, len(refs), 2) var tasks []swarm.Task - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { tasks = d.GetServiceTasks(c, serviceName) return len(tasks) > 0, nil }, checker.Equals, true) task := tasks[0] - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { if task.NodeID == "" || task.Status.ContainerStatus == nil { task = d.GetTask(c, task.ID) } @@ -212,7 +212,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C assert.NilError(c, err, out) } -func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *check.C) { +func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *testing.T) { d := s.AddDaemon(c, true, true) serviceName := "test-service-config" @@ -246,7 +246,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *check.C) { d.DeleteConfig(c, testName) } -func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *check.C) { +func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *testing.T) { d := s.AddDaemon(c, true, true) testPaths := map[string]string{ @@ -284,13 +284,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *check assert.Equal(c, len(refs), len(testPaths)) var tasks []swarm.Task - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { tasks = d.GetServiceTasks(c, serviceName) return len(tasks) > 0, nil }, checker.Equals, true) task := tasks[0] - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { if task.NodeID == "" || task.Status.ContainerStatus == nil { task = d.GetTask(c, task.ID) } @@ -311,7 +311,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *check assert.NilError(c, err, out) } -func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C) { +func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *testing.T) { d := s.AddDaemon(c, true, true) id := d.CreateConfig(c, swarm.ConfigSpec{ @@ -334,13 +334,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C assert.Equal(c, len(refs), 2) var tasks []swarm.Task - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { tasks = d.GetServiceTasks(c, serviceName) return len(tasks) > 0, nil }, checker.Equals, true) task := tasks[0] - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { if task.NodeID == "" || task.Status.ContainerStatus == nil { task = d.GetTask(c, task.ID) } @@ -359,20 +359,20 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C assert.NilError(c, err, out) } -func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) { +func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--mount", "type=tmpfs,target=/foo,tmpfs-size=1MB", "busybox", "sh", "-c", "mount | grep foo; tail -f /dev/null") assert.NilError(c, err, out) id := strings.TrimSpace(out) var tasks []swarm.Task - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { tasks = d.GetServiceTasks(c, id) return len(tasks) > 0, nil }, checker.Equals, true) task := tasks[0] - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { if task.NodeID == "" || task.Status.ContainerStatus == nil { task = d.GetTask(c, task.ID) } @@ -412,7 +412,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) { assert.Assert(c, strings.Contains(strings.TrimSpace(out), "size=1024k")) } -func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *check.C) { +func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("network", "create", "--scope=swarm", "test_swarm_br") assert.NilError(c, err, out) @@ -422,13 +422,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *check.C) { id := strings.TrimSpace(out) var tasks []swarm.Task - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { tasks = d.GetServiceTasks(c, id) return len(tasks) > 0, nil }, checker.Equals, true) task := tasks[0] - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { if task.NodeID == "" || task.Status.ContainerStatus == nil { task = d.GetTask(c, task.ID) } diff --git a/integration-cli/docker_cli_service_health_test.go b/integration-cli/docker_cli_service_health_test.go index 082761f6ba..df7a4af50e 100644 --- a/integration-cli/docker_cli_service_health_test.go +++ b/integration-cli/docker_cli_service_health_test.go @@ -18,7 +18,7 @@ import ( // start a service, and then make its task unhealthy during running // finally, unhealthy task should be detected and killed -func (s *DockerSwarmSuite) TestServiceHealthRun(c *check.C) { +func (s *DockerSwarmSuite) TestServiceHealthRun(c *testing.T) { testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows d := s.AddDaemon(c, true, true) @@ -39,7 +39,7 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *check.C) { id := strings.TrimSpace(out) var tasks []swarm.Task - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { tasks = d.GetServiceTasks(c, id) return tasks, nil }, checker.HasLen, 1) @@ -47,14 +47,14 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *check.C) { task := tasks[0] // wait for task to start - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { task = d.GetTask(c, task.ID) return task.Status.State, nil }, checker.Equals, swarm.TaskStateRunning) containerID := task.Status.ContainerStatus.ContainerID // wait for container to be healthy - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { out, _ := d.Cmd("inspect", "--format={{.State.Health.Status}}", containerID) return strings.TrimSpace(out), nil }, checker.Equals, "healthy") @@ -62,13 +62,13 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *check.C) { // make it fail d.Cmd("exec", containerID, "rm", "/status") // wait for container to be unhealthy - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { out, _ := d.Cmd("inspect", "--format={{.State.Health.Status}}", containerID) return strings.TrimSpace(out), nil }, checker.Equals, "unhealthy") // Task should be terminated - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { task = d.GetTask(c, task.ID) return task.Status.State, nil }, checker.Equals, swarm.TaskStateFailed) @@ -80,7 +80,7 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *check.C) { // start a service whose task is unhealthy at beginning // its tasks should be blocked in starting stage, until health check is passed -func (s *DockerSwarmSuite) TestServiceHealthStart(c *check.C) { +func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) { testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows d := s.AddDaemon(c, true, true) @@ -100,7 +100,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *check.C) { id := strings.TrimSpace(out) var tasks []swarm.Task - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { tasks = d.GetServiceTasks(c, id) return tasks, nil }, checker.HasLen, 1) @@ -108,7 +108,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *check.C) { task := tasks[0] // wait for task to start - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { task = d.GetTask(c, task.ID) return task.Status.State, nil }, checker.Equals, swarm.TaskStateStarting) @@ -116,7 +116,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *check.C) { containerID := task.Status.ContainerStatus.ContainerID // wait for health check to work - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { out, _ := d.Cmd("inspect", "--format={{.State.Health.FailingStreak}}", containerID) failingStreak, _ := strconv.Atoi(strings.TrimSpace(out)) return failingStreak, nil @@ -130,7 +130,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *check.C) { d.Cmd("exec", containerID, "touch", "/status") // Task should be at running status - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { task = d.GetTask(c, task.ID) return task.Status.State, nil }, checker.Equals, swarm.TaskStateRunning) diff --git a/integration-cli/docker_cli_service_logs_test.go b/integration-cli/docker_cli_service_logs_test.go index d85286676e..95a050ad2c 100644 --- a/integration-cli/docker_cli_service_logs_test.go +++ b/integration-cli/docker_cli_service_logs_test.go @@ -22,7 +22,7 @@ type logMessage struct { data []byte } -func (s *DockerSwarmSuite) TestServiceLogs(c *check.C) { +func (s *DockerSwarmSuite) TestServiceLogs(c *testing.T) { d := s.AddDaemon(c, true, true) // we have multiple services here for detecting the goroutine issue #28915 @@ -54,8 +54,8 @@ func (s *DockerSwarmSuite) TestServiceLogs(c *check.C) { // countLogLines returns a closure that can be used with waitAndAssert to // verify that a minimum number of expected container log messages have been // output. -func countLogLines(d *daemon.Daemon, name string) func(*check.C) (interface{}, check.CommentInterface) { - return func(c *check.C) (interface{}, check.CommentInterface) { +func countLogLines(d *daemon.Daemon, name string) func(*testing.T) (interface{}, check.CommentInterface) { + return func(c *testing.T) (interface{}, check.CommentInterface) { result := icmd.RunCmd(d.Command("service", "logs", "-t", "--raw", name)) result.Assert(c, icmd.Expected{}) // if this returns an emptystring, trying to split it later will return @@ -69,7 +69,7 @@ func countLogLines(d *daemon.Daemon, name string) func(*check.C) (interface{}, c } } -func (s *DockerSwarmSuite) TestServiceLogsCompleteness(c *check.C) { +func (s *DockerSwarmSuite) TestServiceLogsCompleteness(c *testing.T) { d := s.AddDaemon(c, true, true) name := "TestServiceLogsCompleteness" @@ -96,7 +96,7 @@ func (s *DockerSwarmSuite) TestServiceLogsCompleteness(c *check.C) { } } -func (s *DockerSwarmSuite) TestServiceLogsTail(c *check.C) { +func (s *DockerSwarmSuite) TestServiceLogsTail(c *testing.T) { d := s.AddDaemon(c, true, true) name := "TestServiceLogsTail" @@ -120,7 +120,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTail(c *check.C) { } } -func (s *DockerSwarmSuite) TestServiceLogsSince(c *check.C) { +func (s *DockerSwarmSuite) TestServiceLogsSince(c *testing.T) { // See DockerSuite.TestLogsSince, which is where this comes from d := s.AddDaemon(c, true, true) @@ -155,7 +155,7 @@ func (s *DockerSwarmSuite) TestServiceLogsSince(c *check.C) { } } -func (s *DockerSwarmSuite) TestServiceLogsFollow(c *check.C) { +func (s *DockerSwarmSuite) TestServiceLogsFollow(c *testing.T) { d := s.AddDaemon(c, true, true) name := "TestServiceLogsFollow" @@ -201,7 +201,7 @@ func (s *DockerSwarmSuite) TestServiceLogsFollow(c *check.C) { assert.NilError(c, cmd.Process.Kill()) } -func (s *DockerSwarmSuite) TestServiceLogsTaskLogs(c *check.C) { +func (s *DockerSwarmSuite) TestServiceLogsTaskLogs(c *testing.T) { d := s.AddDaemon(c, true, true) name := "TestServicelogsTaskLogs" @@ -254,7 +254,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTaskLogs(c *check.C) { } } -func (s *DockerSwarmSuite) TestServiceLogsTTY(c *check.C) { +func (s *DockerSwarmSuite) TestServiceLogsTTY(c *testing.T) { d := s.AddDaemon(c, true, true) name := "TestServiceLogsTTY" @@ -292,7 +292,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTTY(c *check.C) { result.Assert(c, icmd.Expected{Out: "out\r\nerr\r\n"}) } -func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) { +func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *testing.T) { d := s.AddDaemon(c, true, true) name := "TestServiceLogsNoHangDeletedContainer" @@ -341,7 +341,7 @@ func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) { result.Assert(c, icmd.Expected{}) } -func (s *DockerSwarmSuite) TestServiceLogsDetails(c *check.C) { +func (s *DockerSwarmSuite) TestServiceLogsDetails(c *testing.T) { d := s.AddDaemon(c, true, true) name := "TestServiceLogsDetails" diff --git a/integration-cli/docker_cli_service_scale_test.go b/integration-cli/docker_cli_service_scale_test.go index 25a0e145c1..f8259de8de 100644 --- a/integration-cli/docker_cli_service_scale_test.go +++ b/integration-cli/docker_cli_service_scale_test.go @@ -10,7 +10,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSwarmSuite) TestServiceScale(c *check.C) { +func (s *DockerSwarmSuite) TestServiceScale(c *testing.T) { d := s.AddDaemon(c, true, true) service1Name := "TestService1" diff --git a/integration-cli/docker_cli_sni_test.go b/integration-cli/docker_cli_sni_test.go index e64911de42..ca27ba236b 100644 --- a/integration-cli/docker_cli_sni_test.go +++ b/integration-cli/docker_cli_sni_test.go @@ -14,7 +14,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSuite) TestClientSetsTLSServerName(c *check.C) { +func (s *DockerSuite) TestClientSetsTLSServerName(c *testing.T) { c.Skip("Flakey test") // there may be more than one hit to the server for each registry request var serverNameReceived []string diff --git a/integration-cli/docker_cli_start_test.go b/integration-cli/docker_cli_start_test.go index c8c885269b..07ed752d74 100644 --- a/integration-cli/docker_cli_start_test.go +++ b/integration-cli/docker_cli_start_test.go @@ -13,7 +13,7 @@ import ( ) // Regression test for https://github.com/docker/docker/issues/7843 -func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) { +func (s *DockerSuite) TestStartAttachReturnsOnError(c *testing.T) { // Windows does not support link testRequires(c, DaemonIsLinux) dockerCmd(c, "run", "--name", "test", "busybox") @@ -42,7 +42,7 @@ func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) { } // gh#8555: Exit code should be passed through when using start -a -func (s *DockerSuite) TestStartAttachCorrectExitCode(c *check.C) { +func (s *DockerSuite) TestStartAttachCorrectExitCode(c *testing.T) { testRequires(c, DaemonIsLinux) out := cli.DockerCmd(c, "run", "-d", "busybox", "sh", "-c", "sleep 2; exit 1").Stdout() out = strings.TrimSpace(out) @@ -55,7 +55,7 @@ func (s *DockerSuite) TestStartAttachCorrectExitCode(c *check.C) { }) } -func (s *DockerSuite) TestStartAttachSilent(c *check.C) { +func (s *DockerSuite) TestStartAttachSilent(c *testing.T) { name := "teststartattachcorrectexitcode" dockerCmd(c, "run", "--name", name, "busybox", "echo", "test") @@ -67,7 +67,7 @@ func (s *DockerSuite) TestStartAttachSilent(c *check.C) { assert.Assert(c, startOut, checker.Equals, "test\n") } -func (s *DockerSuite) TestStartRecordError(c *check.C) { +func (s *DockerSuite) TestStartRecordError(c *testing.T) { // TODO Windows CI: Requires further porting work. Should be possible. testRequires(c, DaemonIsLinux) // when container runs successfully, we should not have state.Error @@ -92,7 +92,7 @@ func (s *DockerSuite) TestStartRecordError(c *check.C) { assert.Assert(c, stateErr, checker.Equals, "") } -func (s *DockerSuite) TestStartPausedContainer(c *check.C) { +func (s *DockerSuite) TestStartPausedContainer(c *testing.T) { // Windows does not support pausing containers testRequires(c, IsPausable) @@ -107,7 +107,7 @@ func (s *DockerSuite) TestStartPausedContainer(c *check.C) { assert.Assert(c, strings.ToLower(out), checker.Contains, "cannot start a paused container, try unpause instead") } -func (s *DockerSuite) TestStartMultipleContainers(c *check.C) { +func (s *DockerSuite) TestStartMultipleContainers(c *testing.T) { // Windows does not support --link testRequires(c, DaemonIsLinux) // run a container named 'parent' and create two container link to `parent` @@ -143,7 +143,7 @@ func (s *DockerSuite) TestStartMultipleContainers(c *check.C) { } } -func (s *DockerSuite) TestStartAttachMultipleContainers(c *check.C) { +func (s *DockerSuite) TestStartAttachMultipleContainers(c *testing.T) { // run multiple containers to test for _, container := range []string{"test1", "test2", "test3"} { runSleepingContainer(c, "--name", container) @@ -172,7 +172,7 @@ func (s *DockerSuite) TestStartAttachMultipleContainers(c *check.C) { } // Test case for #23716 -func (s *DockerSuite) TestStartAttachWithRename(c *check.C) { +func (s *DockerSuite) TestStartAttachWithRename(c *testing.T) { testRequires(c, DaemonIsLinux) cli.DockerCmd(c, "create", "-t", "--name", "before", "busybox") go func() { @@ -187,7 +187,7 @@ func (s *DockerSuite) TestStartAttachWithRename(c *check.C) { assert.Assert(c, result.Stderr(), checker.Not(checker.Contains), "No such container") } -func (s *DockerSuite) TestStartReturnCorrectExitCode(c *check.C) { +func (s *DockerSuite) TestStartReturnCorrectExitCode(c *testing.T) { dockerCmd(c, "create", "--restart=on-failure:2", "--name", "withRestart", "busybox", "sh", "-c", "exit 11") dockerCmd(c, "create", "--rm", "--name", "withRm", "busybox", "sh", "-c", "exit 12") diff --git a/integration-cli/docker_cli_stats_test.go b/integration-cli/docker_cli_stats_test.go index c21b730506..adc4bb96de 100644 --- a/integration-cli/docker_cli_stats_test.go +++ b/integration-cli/docker_cli_stats_test.go @@ -13,7 +13,7 @@ import ( is "gotest.tools/assert/cmp" ) -func (s *DockerSuite) TestStatsNoStream(c *check.C) { +func (s *DockerSuite) TestStatsNoStream(c *testing.T) { // Windows does not support stats testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "top") @@ -42,7 +42,7 @@ func (s *DockerSuite) TestStatsNoStream(c *check.C) { } } -func (s *DockerSuite) TestStatsContainerNotFound(c *check.C) { +func (s *DockerSuite) TestStatsContainerNotFound(c *testing.T) { // Windows does not support stats testRequires(c, DaemonIsLinux) @@ -55,7 +55,7 @@ func (s *DockerSuite) TestStatsContainerNotFound(c *check.C) { assert.Assert(c, is.Contains(out, "No such container: notfound"), "Expected to fail on not found container stats with --no-stream, got %q instead", out) } -func (s *DockerSuite) TestStatsAllRunningNoStream(c *check.C) { +func (s *DockerSuite) TestStatsAllRunningNoStream(c *testing.T) { // Windows does not support stats testRequires(c, DaemonIsLinux) @@ -91,7 +91,7 @@ func (s *DockerSuite) TestStatsAllRunningNoStream(c *check.C) { assert.Assert(c, realData != nil, "stat result are empty: %s", out) } -func (s *DockerSuite) TestStatsAllNoStream(c *check.C) { +func (s *DockerSuite) TestStatsAllNoStream(c *testing.T) { // Windows does not support stats testRequires(c, DaemonIsLinux) @@ -121,7 +121,7 @@ func (s *DockerSuite) TestStatsAllNoStream(c *check.C) { assert.Assert(c, realData == nil, "stat result of %s should be empty : %s", id1, out) } -func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) { +func (s *DockerSuite) TestStatsAllNewContainersAdded(c *testing.T) { // Windows does not support stats testRequires(c, DaemonIsLinux) @@ -162,7 +162,7 @@ func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) { } } -func (s *DockerSuite) TestStatsFormatAll(c *check.C) { +func (s *DockerSuite) TestStatsFormatAll(c *testing.T) { // Windows does not support stats testRequires(c, DaemonIsLinux) diff --git a/integration-cli/docker_cli_swarm_test.go b/integration-cli/docker_cli_swarm_test.go index c1766db408..888d1528a4 100644 --- a/integration-cli/docker_cli_swarm_test.go +++ b/integration-cli/docker_cli_swarm_test.go @@ -34,7 +34,7 @@ import ( "gotest.tools/icmd" ) -func (s *DockerSwarmSuite) TestSwarmUpdate(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmUpdate(c *testing.T) { d := s.AddDaemon(c, true, true) getSpec := func() swarm.Spec { @@ -82,7 +82,7 @@ func (s *DockerSwarmSuite) TestSwarmUpdate(c *check.C) { }) } -func (s *DockerSwarmSuite) TestSwarmInit(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmInit(c *testing.T) { d := s.AddDaemon(c, false, false) getSpec := func() swarm.Spec { @@ -125,7 +125,7 @@ func (s *DockerSwarmSuite) TestSwarmInit(c *check.C) { assert.Assert(c, spec.Dispatcher.HeartbeatPeriod, checker.Equals, 5*time.Second) } -func (s *DockerSwarmSuite) TestSwarmInitIPv6(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmInitIPv6(c *testing.T) { testRequires(c, IPv6) d1 := s.AddDaemon(c, false, false) cli.Docker(cli.Args("swarm", "init", "--listen-add", "::1"), cli.Daemon(d1)).Assert(c, icmd.Success) @@ -137,14 +137,14 @@ func (s *DockerSwarmSuite) TestSwarmInitIPv6(c *check.C) { assert.Assert(c, out, checker.Contains, "Swarm: active") } -func (s *DockerSwarmSuite) TestSwarmInitUnspecifiedAdvertiseAddr(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmInitUnspecifiedAdvertiseAddr(c *testing.T) { d := s.AddDaemon(c, false, false) out, err := d.Cmd("swarm", "init", "--advertise-addr", "0.0.0.0") assert.ErrorContains(c, err, "") assert.Assert(c, out, checker.Contains, "advertise address must be a non-zero IP address") } -func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *testing.T) { // init swarm mode and stop a daemon d := s.AddDaemon(c, true, true) info := d.SwarmInfo(c) @@ -168,7 +168,7 @@ func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *check.C) { d.StartNode(c) } -func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *testing.T) { d := s.AddDaemon(c, true, true) hostname, err := d.Cmd("node", "inspect", "--format", "{{.Description.Hostname}}", "self") assert.Assert(c, err, checker.IsNil, check.Commentf("%s", hostname)) @@ -186,7 +186,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *check.C) { } // Test case for #24270 -func (s *DockerSwarmSuite) TestSwarmServiceListFilter(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmServiceListFilter(c *testing.T) { d := s.AddDaemon(c, true, true) name1 := "redis-cluster-md5" @@ -227,7 +227,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceListFilter(c *check.C) { assert.Assert(c, out, checker.Contains, name3+" ") } -func (s *DockerSwarmSuite) TestSwarmNodeListFilter(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmNodeListFilter(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("node", "inspect", "--format", "{{ .Description.Hostname }}", "self") @@ -246,7 +246,7 @@ func (s *DockerSwarmSuite) TestSwarmNodeListFilter(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), name) } -func (s *DockerSwarmSuite) TestSwarmNodeTaskListFilter(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmNodeTaskListFilter(c *testing.T) { d := s.AddDaemon(c, true, true) name := "redis-cluster-md5" @@ -273,7 +273,7 @@ func (s *DockerSwarmSuite) TestSwarmNodeTaskListFilter(c *check.C) { } // Test case for #25375 -func (s *DockerSwarmSuite) TestSwarmPublishAdd(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmPublishAdd(c *testing.T) { d := s.AddDaemon(c, true, true) name := "top" @@ -299,7 +299,7 @@ func (s *DockerSwarmSuite) TestSwarmPublishAdd(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "[{ tcp 80 80 ingress}]") } -func (s *DockerSwarmSuite) TestSwarmServiceWithGroup(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmServiceWithGroup(c *testing.T) { d := s.AddDaemon(c, true, true) name := "top" @@ -321,7 +321,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceWithGroup(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "uid=0(root) gid=0(root) groups=10(wheel),29(audio),50(staff),777") } -func (s *DockerSwarmSuite) TestSwarmContainerAutoStart(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmContainerAutoStart(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("network", "create", "--attachable", "-d", "overlay", "foo") @@ -343,7 +343,7 @@ func (s *DockerSwarmSuite) TestSwarmContainerAutoStart(c *check.C) { assert.Assert(c, strings.TrimSpace(out) != "") } -func (s *DockerSwarmSuite) TestSwarmContainerEndpointOptions(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmContainerEndpointOptions(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("network", "create", "--attachable", "-d", "overlay", "foo") @@ -368,7 +368,7 @@ func (s *DockerSwarmSuite) TestSwarmContainerEndpointOptions(c *check.C) { assert.NilError(c, err, out) } -func (s *DockerSwarmSuite) TestSwarmContainerAttachByNetworkId(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmContainerAttachByNetworkId(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("network", "create", "--attachable", "-d", "overlay", "testnet") @@ -387,7 +387,7 @@ func (s *DockerSwarmSuite) TestSwarmContainerAttachByNetworkId(c *check.C) { out, err = d.Cmd("network", "rm", "testnet") assert.NilError(c, err, out) - checkNetwork := func(*check.C) (interface{}, check.CommentInterface) { + checkNetwork := func(*testing.T) (interface{}, check.CommentInterface) { out, err := d.Cmd("network", "ls") assert.NilError(c, err) return out, nil @@ -396,7 +396,7 @@ func (s *DockerSwarmSuite) TestSwarmContainerAttachByNetworkId(c *check.C) { waitAndAssert(c, 3*time.Second, checkNetwork, checker.Not(checker.Contains), "testnet") } -func (s *DockerSwarmSuite) TestOverlayAttachable(c *check.C) { +func (s *DockerSwarmSuite) TestOverlayAttachable(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("network", "create", "-d", "overlay", "--attachable", "ovnet") @@ -418,7 +418,7 @@ func (s *DockerSwarmSuite) TestOverlayAttachable(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "true") } -func (s *DockerSwarmSuite) TestOverlayAttachableOnSwarmLeave(c *check.C) { +func (s *DockerSwarmSuite) TestOverlayAttachableOnSwarmLeave(c *testing.T) { d := s.AddDaemon(c, true, true) // Create an attachable swarm network @@ -444,7 +444,7 @@ func (s *DockerSwarmSuite) TestOverlayAttachableOnSwarmLeave(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), nwName) } -func (s *DockerSwarmSuite) TestOverlayAttachableReleaseResourcesOnFailure(c *check.C) { +func (s *DockerSwarmSuite) TestOverlayAttachableReleaseResourcesOnFailure(c *testing.T) { d := s.AddDaemon(c, true, true) // Create attachable network @@ -468,7 +468,7 @@ func (s *DockerSwarmSuite) TestOverlayAttachableReleaseResourcesOnFailure(c *che assert.NilError(c, err, out) } -func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *testing.T) { d := s.AddDaemon(c, true, true) // Ingress network can be removed @@ -522,7 +522,7 @@ func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) { assert.NilError(c, err, out) } -func (s *DockerSwarmSuite) TestSwarmCreateServiceWithNoIngressNetwork(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmCreateServiceWithNoIngressNetwork(c *testing.T) { d := s.AddDaemon(c, true, true) // Remove ingress network @@ -541,7 +541,7 @@ func (s *DockerSwarmSuite) TestSwarmCreateServiceWithNoIngressNetwork(c *check.C // Test case for #24108, also the case from: // https://github.com/docker/docker/pull/24620#issuecomment-233715656 -func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *testing.T) { d := s.AddDaemon(c, true, true) name := "redis-cluster-md5" @@ -551,7 +551,7 @@ func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *check.C) { filter := "name=redis-cluster" - checkNumTasks := func(*check.C) (interface{}, check.CommentInterface) { + checkNumTasks := func(*testing.T) (interface{}, check.CommentInterface) { out, err := d.Cmd("service", "ps", "--filter", filter, name) assert.NilError(c, err, out) return len(strings.Split(out, "\n")) - 2, nil // includes header and nl in last line @@ -599,7 +599,7 @@ func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), name) } -func (s *DockerSwarmSuite) TestPsListContainersFilterIsTask(c *check.C) { +func (s *DockerSwarmSuite) TestPsListContainersFilterIsTask(c *testing.T) { d := s.AddDaemon(c, true, true) // Create a bare container @@ -632,7 +632,7 @@ func (s *DockerSwarmSuite) TestPsListContainersFilterIsTask(c *check.C) { const globalNetworkPlugin = "global-network-plugin" const globalIPAMPlugin = "global-ipam-plugin" -func setupRemoteGlobalNetworkPlugin(c *check.C, mux *http.ServeMux, url, netDrv, ipamDrv string) { +func setupRemoteGlobalNetworkPlugin(c *testing.T, mux *http.ServeMux, url, netDrv, ipamDrv string) { mux.HandleFunc("/Plugin.Activate", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") @@ -800,7 +800,7 @@ func setupRemoteGlobalNetworkPlugin(c *check.C, mux *http.ServeMux, url, netDrv, assert.NilError(c, err) } -func (s *DockerSwarmSuite) TestSwarmNetworkPlugin(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmNetworkPlugin(c *testing.T) { mux := http.NewServeMux() s.server = httptest.NewServer(mux) assert.Assert(c, s.server, check.NotNil) // check that HTTP server has started @@ -819,7 +819,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkPlugin(c *check.C) { } // Test case for #24712 -func (s *DockerSwarmSuite) TestSwarmServiceEnvFile(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmServiceEnvFile(c *testing.T) { d := s.AddDaemon(c, true, true) path := filepath.Join(d.Folder, "env.txt") @@ -837,7 +837,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceEnvFile(c *check.C) { assert.Assert(c, out, checker.Contains, "[VAR1=C VAR2]") } -func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *testing.T) { d := s.AddDaemon(c, true, true) name := "top" @@ -885,7 +885,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *check.C) { assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out)) } -func (s *DockerSwarmSuite) TestSwarmServiceTTYUpdate(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmServiceTTYUpdate(c *testing.T) { d := s.AddDaemon(c, true, true) // Create a service @@ -908,7 +908,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceTTYUpdate(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "true") } -func (s *DockerSwarmSuite) TestSwarmServiceNetworkUpdate(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmServiceNetworkUpdate(c *testing.T) { d := s.AddDaemon(c, true, true) result := icmd.RunCmd(d.Command("network", "create", "-d", "overlay", "foo")) @@ -947,7 +947,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceNetworkUpdate(c *check.C) { map[string]int{barNetwork: 1, bazNetwork: 1}) } -func (s *DockerSwarmSuite) TestDNSConfig(c *check.C) { +func (s *DockerSwarmSuite) TestDNSConfig(c *testing.T) { d := s.AddDaemon(c, true, true) // Create a service @@ -974,7 +974,7 @@ func (s *DockerSwarmSuite) TestDNSConfig(c *check.C) { assert.Assert(c, out, checker.Contains, expectedOutput3, check.Commentf("Expected '%s', but got %q", expectedOutput3, out)) } -func (s *DockerSwarmSuite) TestDNSConfigUpdate(c *check.C) { +func (s *DockerSwarmSuite) TestDNSConfigUpdate(c *testing.T) { d := s.AddDaemon(c, true, true) // Create a service @@ -993,13 +993,13 @@ func (s *DockerSwarmSuite) TestDNSConfigUpdate(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "{[1.2.3.4] [example.com] [timeout:3]}") } -func getNodeStatus(c *check.C, d *daemon.Daemon) swarm.LocalNodeState { +func getNodeStatus(c *testing.T, d *daemon.Daemon) swarm.LocalNodeState { info := d.SwarmInfo(c) return info.LocalNodeState } -func checkKeyIsEncrypted(d *daemon.Daemon) func(*check.C) (interface{}, check.CommentInterface) { - return func(c *check.C) (interface{}, check.CommentInterface) { +func checkKeyIsEncrypted(d *daemon.Daemon) func(*testing.T) (interface{}, check.CommentInterface) { + return func(c *testing.T) (interface{}, check.CommentInterface) { keyBytes, err := ioutil.ReadFile(filepath.Join(d.Folder, "root", "swarm", "certificates", "swarm-node.key")) if err != nil { return fmt.Errorf("error reading key: %v", err), nil @@ -1014,7 +1014,7 @@ func checkKeyIsEncrypted(d *daemon.Daemon) func(*check.C) (interface{}, check.Co } } -func checkSwarmLockedToUnlocked(c *check.C, d *daemon.Daemon) { +func checkSwarmLockedToUnlocked(c *testing.T, d *daemon.Daemon) { // Wait for the PEM file to become unencrypted waitAndAssert(c, defaultReconciliationTimeout, checkKeyIsEncrypted(d), checker.Equals, false) @@ -1022,7 +1022,7 @@ func checkSwarmLockedToUnlocked(c *check.C, d *daemon.Daemon) { waitAndAssert(c, time.Second, d.CheckLocalNodeState, checker.Equals, swarm.LocalNodeStateActive) } -func checkSwarmUnlockedToLocked(c *check.C, d *daemon.Daemon) { +func checkSwarmUnlockedToLocked(c *testing.T, d *daemon.Daemon) { // Wait for the PEM file to become encrypted waitAndAssert(c, defaultReconciliationTimeout, checkKeyIsEncrypted(d), checker.Equals, true) @@ -1030,7 +1030,7 @@ func checkSwarmUnlockedToLocked(c *check.C, d *daemon.Daemon) { waitAndAssert(c, time.Second, d.CheckLocalNodeState, checker.Equals, swarm.LocalNodeStateLocked) } -func (s *DockerSwarmSuite) TestUnlockEngineAndUnlockedSwarm(c *check.C) { +func (s *DockerSwarmSuite) TestUnlockEngineAndUnlockedSwarm(c *testing.T) { d := s.AddDaemon(c, false, false) // unlocking a normal engine should return an error - it does not even ask for the key @@ -1055,7 +1055,7 @@ func (s *DockerSwarmSuite) TestUnlockEngineAndUnlockedSwarm(c *check.C) { assert.Assert(c, result.Combined(), checker.Not(checker.Contains), "Please enter unlock key") } -func (s *DockerSwarmSuite) TestSwarmInitLocked(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmInitLocked(c *testing.T) { d := s.AddDaemon(c, false, false) outs, err := d.Cmd("swarm", "init", "--autolock") @@ -1097,7 +1097,7 @@ func (s *DockerSwarmSuite) TestSwarmInitLocked(c *check.C) { assert.Assert(c, outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked") } -func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *testing.T) { d := s.AddDaemon(c, false, false) outs, err := d.Cmd("swarm", "init", "--autolock") @@ -1130,7 +1130,7 @@ func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *check.C) { assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive) } -func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *testing.T) { d1 := s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, true, true) d3 := s.AddDaemon(c, true, true) @@ -1191,7 +1191,7 @@ func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *check.C) { assert.Assert(c, getNodeStatus(c, d4), checker.Equals, swarm.LocalNodeStateActive) } -func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *testing.T) { d1 := s.AddDaemon(c, true, true) // enable autolock @@ -1233,7 +1233,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *check.C) { // (because we never want a manager TLS key to be on disk unencrypted if the cluster // is set to autolock) waitAndAssert(c, defaultReconciliationTimeout, d3.CheckControlAvailable, checker.False) - waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { + waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) { certBytes, err := ioutil.ReadFile(filepath.Join(d3.Folder, "root", "swarm", "certificates", "swarm-node.crt")) if err != nil { return "", check.Commentf("error: %v", err) @@ -1250,7 +1250,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *check.C) { waitAndAssert(c, time.Second, d3.CheckLocalNodeState, checker.Equals, swarm.LocalNodeStateActive) } -func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *testing.T) { d := s.AddDaemon(c, true, true) outs, err := d.Cmd("swarm", "update", "--autolock") @@ -1330,7 +1330,7 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *check.C) { // This differs from `TestSwarmRotateUnlockKey` because that one rotates a single node, which is the leader. // This one keeps the leader up, and asserts that other manager nodes in the cluster also have their unlock // key rotated. -func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) { if runtime.GOARCH == "s390x" { c.Skip("Disabled on s390x") } @@ -1420,7 +1420,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) { } } -func (s *DockerSwarmSuite) TestSwarmAlternateLockUnlock(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmAlternateLockUnlock(c *testing.T) { d := s.AddDaemon(c, true, true) for i := 0; i < 2; i++ { @@ -1445,7 +1445,7 @@ func (s *DockerSwarmSuite) TestSwarmAlternateLockUnlock(c *check.C) { } } -func (s *DockerSwarmSuite) TestExtraHosts(c *check.C) { +func (s *DockerSwarmSuite) TestExtraHosts(c *testing.T) { d := s.AddDaemon(c, true, true) // Create a service @@ -1468,7 +1468,7 @@ func (s *DockerSwarmSuite) TestExtraHosts(c *check.C) { assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out)) } -func (s *DockerSwarmSuite) TestSwarmManagerAddress(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmManagerAddress(c *testing.T) { d1 := s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, true, false) d3 := s.AddDaemon(c, true, false) @@ -1489,7 +1489,7 @@ func (s *DockerSwarmSuite) TestSwarmManagerAddress(c *check.C) { assert.Assert(c, strings.Contains(out, expectedOutput)) } -func (s *DockerSwarmSuite) TestSwarmNetworkIPAMOptions(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmNetworkIPAMOptions(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("network", "create", "-d", "overlay", "--ipam-opt", "foo=bar", "foo") @@ -1515,7 +1515,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkIPAMOptions(c *check.C) { // Test case for issue #27866, which did not allow NW name that is the prefix of a swarm NW ID. // e.g. if the ingress ID starts with "n1", it was impossible to create a NW named "n1". -func (s *DockerSwarmSuite) TestSwarmNetworkCreateIssue27866(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmNetworkCreateIssue27866(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("network", "inspect", "-f", "{{.Id}}", "ingress") assert.NilError(c, err, "out: %v", out) @@ -1538,7 +1538,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkCreateIssue27866(c *check.C) { // "network with name FOO already exists". // Note that it is to ok have multiple networks with the same name if the operations are done // in parallel. (#18864) -func (s *DockerSwarmSuite) TestSwarmNetworkCreateDup(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmNetworkCreateDup(c *testing.T) { d := s.AddDaemon(c, true, true) drivers := []string{"bridge", "overlay"} for i, driver1 := range drivers { @@ -1559,7 +1559,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkCreateDup(c *check.C) { } } -func (s *DockerSwarmSuite) TestSwarmPublishDuplicatePorts(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmPublishDuplicatePorts(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--publish", "5005:80", "--publish", "5006:80", "--publish", "80", "--publish", "80", "busybox", "top") @@ -1578,7 +1578,7 @@ func (s *DockerSwarmSuite) TestSwarmPublishDuplicatePorts(c *check.C) { assert.Assert(c, out, checker.Contains, "{ tcp 80 5006 ingress}") } -func (s *DockerSwarmSuite) TestSwarmJoinWithDrain(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmJoinWithDrain(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("node", "ls") @@ -1606,7 +1606,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinWithDrain(c *check.C) { assert.Assert(c, out, checker.Contains, "Drain") } -func (s *DockerSwarmSuite) TestSwarmInitWithDrain(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmInitWithDrain(c *testing.T) { d := s.AddDaemon(c, false, false) out, err := d.Cmd("swarm", "init", "--availability", "drain") @@ -1617,7 +1617,7 @@ func (s *DockerSwarmSuite) TestSwarmInitWithDrain(c *check.C) { assert.Assert(c, out, checker.Contains, "Drain") } -func (s *DockerSwarmSuite) TestSwarmReadonlyRootfs(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmReadonlyRootfs(c *testing.T) { testRequires(c, DaemonIsLinux, UserNamespaceROMount) d := s.AddDaemon(c, true, true) @@ -1638,7 +1638,7 @@ func (s *DockerSwarmSuite) TestSwarmReadonlyRootfs(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "true") } -func (s *DockerSwarmSuite) TestNetworkInspectWithDuplicateNames(c *check.C) { +func (s *DockerSwarmSuite) TestNetworkInspectWithDuplicateNames(c *testing.T) { d := s.AddDaemon(c, true, true) name := "foo" @@ -1703,7 +1703,7 @@ func (s *DockerSwarmSuite) TestNetworkInspectWithDuplicateNames(c *check.C) { assert.Assert(c, out, checker.Contains, "2 matches found based on name") } -func (s *DockerSwarmSuite) TestSwarmStopSignal(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmStopSignal(c *testing.T) { testRequires(c, DaemonIsLinux, UserNamespaceROMount) d := s.AddDaemon(c, true, true) @@ -1731,7 +1731,7 @@ func (s *DockerSwarmSuite) TestSwarmStopSignal(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "SIGUSR1") } -func (s *DockerSwarmSuite) TestSwarmServiceLsFilterMode(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmServiceLsFilterMode(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "top1", "busybox", "top") @@ -1762,7 +1762,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceLsFilterMode(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), "top2") } -func (s *DockerSwarmSuite) TestSwarmInitUnspecifiedDataPathAddr(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmInitUnspecifiedDataPathAddr(c *testing.T) { d := s.AddDaemon(c, false, false) out, err := d.Cmd("swarm", "init", "--data-path-addr", "0.0.0.0") @@ -1774,7 +1774,7 @@ func (s *DockerSwarmSuite) TestSwarmInitUnspecifiedDataPathAddr(c *check.C) { assert.Assert(c, out, checker.Contains, "data path address must be a non-zero IP") } -func (s *DockerSwarmSuite) TestSwarmJoinLeave(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmJoinLeave(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("swarm", "join-token", "-q", "worker") @@ -1797,7 +1797,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinLeave(c *check.C) { const defaultRetryCount = 10 -func waitForEvent(c *check.C, d *daemon.Daemon, since string, filter string, event string, retry int) string { +func waitForEvent(c *testing.T, d *daemon.Daemon, since string, filter string, event string, retry int) string { if retry < 1 { c.Fatalf("retry count %d is invalid. It should be no less than 1", retry) return "" @@ -1824,7 +1824,7 @@ func waitForEvent(c *check.C, d *daemon.Daemon, since string, filter string, eve return "" } -func (s *DockerSwarmSuite) TestSwarmClusterEventsSource(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmClusterEventsSource(c *testing.T) { d1 := s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, true, true) d3 := s.AddDaemon(c, true, false) @@ -1844,7 +1844,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsSource(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), "network create ") } -func (s *DockerSwarmSuite) TestSwarmClusterEventsScope(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmClusterEventsScope(c *testing.T) { d := s.AddDaemon(c, true, true) // create a service @@ -1865,7 +1865,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsScope(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), "service create ") } -func (s *DockerSwarmSuite) TestSwarmClusterEventsType(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmClusterEventsType(c *testing.T) { d := s.AddDaemon(c, true, true) // create a service @@ -1888,7 +1888,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsType(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), "service create") } -func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *testing.T) { d := s.AddDaemon(c, true, true) // create a service @@ -1928,7 +1928,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *check.C) { waitForEvent(c, d, t3, "-f scope=swarm", "service remove "+serviceID, defaultRetryCount) } -func (s *DockerSwarmSuite) TestSwarmClusterEventsNode(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmClusterEventsNode(c *testing.T) { d1 := s.AddDaemon(c, true, true) s.AddDaemon(c, true, true) d3 := s.AddDaemon(c, true, true) @@ -1958,7 +1958,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsNode(c *check.C) { waitForEvent(c, d1, t3, "-f scope=swarm", "node remove "+d3ID, defaultRetryCount) } -func (s *DockerSwarmSuite) TestSwarmClusterEventsNetwork(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmClusterEventsNetwork(c *testing.T) { d := s.AddDaemon(c, true, true) // create a network @@ -1977,7 +1977,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsNetwork(c *check.C) { waitForEvent(c, d, t1, "-f type=network", "network remove "+networkID, defaultRetryCount) } -func (s *DockerSwarmSuite) TestSwarmClusterEventsSecret(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmClusterEventsSecret(c *testing.T) { d := s.AddDaemon(c, true, true) testName := "test_secret" @@ -1997,7 +1997,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsSecret(c *check.C) { waitForEvent(c, d, t1, "-f type=secret", "secret remove "+id, defaultRetryCount) } -func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *testing.T) { d := s.AddDaemon(c, true, true) testName := "test_config" @@ -2017,7 +2017,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *check.C) { waitForEvent(c, d, t1, "-f type=config", "config remove "+id, defaultRetryCount) } -func getUnlockKey(d *daemon.Daemon, c *check.C, autolockOutput string) string { +func getUnlockKey(d *daemon.Daemon, c *testing.T, autolockOutput string) string { unlockKey, err := d.Cmd("swarm", "unlock-key", "-q") assert.Assert(c, err, checker.IsNil, check.Commentf("%s", unlockKey)) unlockKey = strings.TrimSuffix(unlockKey, "\n") diff --git a/integration-cli/docker_cli_swarm_unix_test.go b/integration-cli/docker_cli_swarm_unix_test.go index bfaa08b19b..eb85b8708a 100644 --- a/integration-cli/docker_cli_swarm_unix_test.go +++ b/integration-cli/docker_cli_swarm_unix_test.go @@ -13,7 +13,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSwarmSuite) TestSwarmVolumePlugin(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmVolumePlugin(c *testing.T) { d := s.AddDaemon(c, true, true) out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--mount", "type=volume,source=my-volume,destination=/foo,volume-driver=customvolumedriver", "--name", "top", "busybox", "top") @@ -55,7 +55,7 @@ func (s *DockerSwarmSuite) TestSwarmVolumePlugin(c *check.C) { } // Test network plugin filter in swarm -func (s *DockerSwarmSuite) TestSwarmNetworkPluginV2(c *check.C) { +func (s *DockerSwarmSuite) TestSwarmNetworkPluginV2(c *testing.T) { testRequires(c, IsAmd64) d1 := s.AddDaemon(c, true, true) d2 := s.AddDaemon(c, true, false) diff --git a/integration-cli/docker_cli_top_test.go b/integration-cli/docker_cli_top_test.go index b078b7b5fc..b85a91adcd 100644 --- a/integration-cli/docker_cli_top_test.go +++ b/integration-cli/docker_cli_top_test.go @@ -8,7 +8,7 @@ import ( "gotest.tools/icmd" ) -func (s *DockerSuite) TestTopMultipleArgs(c *check.C) { +func (s *DockerSuite) TestTopMultipleArgs(c *testing.T) { out := runSleepingContainer(c, "-d") cleanedContainerID := strings.TrimSpace(out) @@ -23,7 +23,7 @@ func (s *DockerSuite) TestTopMultipleArgs(c *check.C) { result.Assert(c, expected) } -func (s *DockerSuite) TestTopNonPrivileged(c *check.C) { +func (s *DockerSuite) TestTopNonPrivileged(c *testing.T) { out := runSleepingContainer(c, "-d") cleanedContainerID := strings.TrimSpace(out) @@ -47,7 +47,7 @@ func (s *DockerSuite) TestTopNonPrivileged(c *check.C) { // TestTopWindowsCoreProcesses validates that there are lines for the critical // processes which are found in a Windows container. Note Windows is architecturally // very different to Linux in this regard. -func (s *DockerSuite) TestTopWindowsCoreProcesses(c *check.C) { +func (s *DockerSuite) TestTopWindowsCoreProcesses(c *testing.T) { testRequires(c, DaemonIsWindows) out := runSleepingContainer(c, "-d") cleanedContainerID := strings.TrimSpace(out) @@ -58,7 +58,7 @@ func (s *DockerSuite) TestTopWindowsCoreProcesses(c *check.C) { } } -func (s *DockerSuite) TestTopPrivileged(c *check.C) { +func (s *DockerSuite) TestTopPrivileged(c *testing.T) { // Windows does not support --privileged testRequires(c, DaemonIsLinux, NotUserNamespace) out, _ := dockerCmd(c, "run", "--privileged", "-i", "-d", "busybox", "top") diff --git a/integration-cli/docker_cli_update_unix_test.go b/integration-cli/docker_cli_update_unix_test.go index 16b1a82e5b..ad52634992 100644 --- a/integration-cli/docker_cli_update_unix_test.go +++ b/integration-cli/docker_cli_update_unix_test.go @@ -19,7 +19,7 @@ import ( "gotest.tools/assert" ) -func (s *DockerSuite) TestUpdateRunningContainer(c *check.C) { +func (s *DockerSuite) TestUpdateRunningContainer(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, memoryLimitSupport) @@ -34,7 +34,7 @@ func (s *DockerSuite) TestUpdateRunningContainer(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "524288000") } -func (s *DockerSuite) TestUpdateRunningContainerWithRestart(c *check.C) { +func (s *DockerSuite) TestUpdateRunningContainerWithRestart(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, memoryLimitSupport) @@ -50,7 +50,7 @@ func (s *DockerSuite) TestUpdateRunningContainerWithRestart(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "524288000") } -func (s *DockerSuite) TestUpdateStoppedContainer(c *check.C) { +func (s *DockerSuite) TestUpdateStoppedContainer(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, memoryLimitSupport) @@ -65,7 +65,7 @@ func (s *DockerSuite) TestUpdateStoppedContainer(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "524288000") } -func (s *DockerSuite) TestUpdatePausedContainer(c *check.C) { +func (s *DockerSuite) TestUpdatePausedContainer(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, cpuShare) @@ -82,7 +82,7 @@ func (s *DockerSuite) TestUpdatePausedContainer(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "500") } -func (s *DockerSuite) TestUpdateWithUntouchedFields(c *check.C) { +func (s *DockerSuite) TestUpdateWithUntouchedFields(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, memoryLimitSupport) testRequires(c, cpuShare) @@ -100,7 +100,7 @@ func (s *DockerSuite) TestUpdateWithUntouchedFields(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "800") } -func (s *DockerSuite) TestUpdateContainerInvalidValue(c *check.C) { +func (s *DockerSuite) TestUpdateContainerInvalidValue(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, memoryLimitSupport) @@ -112,7 +112,7 @@ func (s *DockerSuite) TestUpdateContainerInvalidValue(c *check.C) { assert.Assert(c, strings.Contains(out, expected)) } -func (s *DockerSuite) TestUpdateContainerWithoutFlags(c *check.C) { +func (s *DockerSuite) TestUpdateContainerWithoutFlags(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, memoryLimitSupport) @@ -122,7 +122,7 @@ func (s *DockerSuite) TestUpdateContainerWithoutFlags(c *check.C) { assert.ErrorContains(c, err, "") } -func (s *DockerSuite) TestUpdateKernelMemory(c *check.C) { +func (s *DockerSuite) TestUpdateKernelMemory(c *testing.T) { testRequires(c, DaemonIsLinux, kernelMemorySupport) name := "test-update-container" @@ -136,7 +136,7 @@ func (s *DockerSuite) TestUpdateKernelMemory(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "104857600") } -func (s *DockerSuite) TestUpdateKernelMemoryUninitialized(c *check.C) { +func (s *DockerSuite) TestUpdateKernelMemoryUninitialized(c *testing.T) { testRequires(c, DaemonIsLinux, kernelMemorySupport) isNewKernel := CheckKernelVersion(4, 6, 0) @@ -183,7 +183,7 @@ func CheckKernelVersion(k, major, minor int) bool { return kernel.CompareKernelVersion(*GetKernelVersion(), kernel.VersionInfo{Kernel: k, Major: major, Minor: minor}) >= 0 } -func (s *DockerSuite) TestUpdateSwapMemoryOnly(c *check.C) { +func (s *DockerSuite) TestUpdateSwapMemoryOnly(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, memoryLimitSupport) testRequires(c, swapMemorySupport) @@ -199,7 +199,7 @@ func (s *DockerSuite) TestUpdateSwapMemoryOnly(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "629145600") } -func (s *DockerSuite) TestUpdateInvalidSwapMemory(c *check.C) { +func (s *DockerSuite) TestUpdateInvalidSwapMemory(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, memoryLimitSupport) testRequires(c, swapMemorySupport) @@ -224,7 +224,7 @@ func (s *DockerSuite) TestUpdateInvalidSwapMemory(c *check.C) { assert.Equal(c, strings.TrimSpace(out), "629145600") } -func (s *DockerSuite) TestUpdateStats(c *check.C) { +func (s *DockerSuite) TestUpdateStats(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, memoryLimitSupport) testRequires(c, cpuCfsQuota) @@ -253,7 +253,7 @@ func (s *DockerSuite) TestUpdateStats(c *check.C) { assert.Equal(c, preMemLimit, curMemLimit) } -func (s *DockerSuite) TestUpdateMemoryWithSwapMemory(c *check.C) { +func (s *DockerSuite) TestUpdateMemoryWithSwapMemory(c *testing.T) { testRequires(c, DaemonIsLinux) testRequires(c, memoryLimitSupport) testRequires(c, swapMemorySupport) @@ -267,7 +267,7 @@ func (s *DockerSuite) TestUpdateMemoryWithSwapMemory(c *check.C) { dockerCmd(c, "update", "--memory", "800M", "--memory-swap", "1000M", name) } -func (s *DockerSuite) TestUpdateNotAffectMonitorRestartPolicy(c *check.C) { +func (s *DockerSuite) TestUpdateNotAffectMonitorRestartPolicy(c *testing.T) { testRequires(c, DaemonIsLinux, cpuShare) out, _ := dockerCmd(c, "run", "-tid", "--restart=always", "busybox", "sh") @@ -295,7 +295,7 @@ func (s *DockerSuite) TestUpdateNotAffectMonitorRestartPolicy(c *check.C) { assert.NilError(c, waitRun(id)) } -func (s *DockerSuite) TestUpdateWithNanoCPUs(c *check.C) { +func (s *DockerSuite) TestUpdateWithNanoCPUs(c *testing.T) { testRequires(c, cpuCfsQuota, cpuCfsPeriod) file1 := "/sys/fs/cgroup/cpu/cpu.cfs_quota_us" diff --git a/integration-cli/docker_cli_userns_test.go b/integration-cli/docker_cli_userns_test.go index 78e4eb1e22..26072374c8 100644 --- a/integration-cli/docker_cli_userns_test.go +++ b/integration-cli/docker_cli_userns_test.go @@ -22,7 +22,7 @@ import ( // user namespaces test: run daemon with remapped root setting // 1. validate uid/gid maps are set properly // 2. verify that files created are owned by remapped root -func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *check.C) { +func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *testing.T) { testRequires(c, UserNamespaceInKernel) s.d.StartWithBusybox(c, "--userns-remap", "default") @@ -88,7 +88,7 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *check.C) { } // findUser finds the uid or name of the user of the first process that runs in a container -func (s *DockerDaemonSuite) findUser(c *check.C, container string) string { +func (s *DockerDaemonSuite) findUser(c *testing.T, container string) string { out, err := s.d.Cmd("top", container) assert.Assert(c, err, checker.IsNil, check.Commentf("Output: %s", out)) rows := strings.Split(out, "\n") diff --git a/integration-cli/docker_cli_v2_only_test.go b/integration-cli/docker_cli_v2_only_test.go index aa15694523..f51686e7b7 100644 --- a/integration-cli/docker_cli_v2_only_test.go +++ b/integration-cli/docker_cli_v2_only_test.go @@ -25,7 +25,7 @@ func makefile(path string, contents string) (string, error) { // TestV2Only ensures that a daemon does not // attempt to contact any v1 registry endpoints. -func (s *DockerRegistrySuite) TestV2Only(c *check.C) { +func (s *DockerRegistrySuite) TestV2Only(c *testing.T) { reg, err := registry.NewMock(c) defer reg.Close() assert.NilError(c, err) diff --git a/integration-cli/docker_cli_volume_test.go b/integration-cli/docker_cli_volume_test.go index 142af5dada..c4fc448c19 100644 --- a/integration-cli/docker_cli_volume_test.go +++ b/integration-cli/docker_cli_volume_test.go @@ -20,7 +20,7 @@ import ( "gotest.tools/icmd" ) -func (s *DockerSuite) TestVolumeCLICreate(c *check.C) { +func (s *DockerSuite) TestVolumeCLICreate(c *testing.T) { dockerCmd(c, "volume", "create") _, _, err := dockerCmdWithError("volume", "create", "-d", "nosuchdriver") @@ -36,7 +36,7 @@ func (s *DockerSuite) TestVolumeCLICreate(c *check.C) { assert.Assert(c, name, check.Equals, "test2") } -func (s *DockerSuite) TestVolumeCLIInspect(c *check.C) { +func (s *DockerSuite) TestVolumeCLIInspect(c *testing.T) { assert.Assert(c, exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run(), check.Not(check.IsNil), check.Commentf("volume inspect should error on non-existent volume")) out, _ := dockerCmd(c, "volume", "create") name := strings.TrimSpace(out) @@ -48,7 +48,7 @@ func (s *DockerSuite) TestVolumeCLIInspect(c *check.C) { assert.Assert(c, strings.TrimSpace(out), check.Equals, "test") } -func (s *DockerSuite) TestVolumeCLIInspectMulti(c *check.C) { +func (s *DockerSuite) TestVolumeCLIInspectMulti(c *testing.T) { dockerCmd(c, "volume", "create", "test1") dockerCmd(c, "volume", "create", "test2") dockerCmd(c, "volume", "create", "test3") @@ -65,7 +65,7 @@ func (s *DockerSuite) TestVolumeCLIInspectMulti(c *check.C) { assert.Assert(c, out, checker.Contains, "test3") } -func (s *DockerSuite) TestVolumeCLILs(c *check.C) { +func (s *DockerSuite) TestVolumeCLILs(c *testing.T) { prefix, _ := getPrefixAndSlashFromDaemonPlatform() dockerCmd(c, "volume", "create", "aaa") @@ -78,7 +78,7 @@ func (s *DockerSuite) TestVolumeCLILs(c *check.C) { assertVolumesInList(c, out, []string{"aaa", "soo", "test"}) } -func (s *DockerSuite) TestVolumeLsFormat(c *check.C) { +func (s *DockerSuite) TestVolumeLsFormat(c *testing.T) { dockerCmd(c, "volume", "create", "aaa") dockerCmd(c, "volume", "create", "test") dockerCmd(c, "volume", "create", "soo") @@ -87,7 +87,7 @@ func (s *DockerSuite) TestVolumeLsFormat(c *check.C) { assertVolumesInList(c, out, []string{"aaa", "soo", "test"}) } -func (s *DockerSuite) TestVolumeLsFormatDefaultFormat(c *check.C) { +func (s *DockerSuite) TestVolumeLsFormatDefaultFormat(c *testing.T) { dockerCmd(c, "volume", "create", "aaa") dockerCmd(c, "volume", "create", "test") dockerCmd(c, "volume", "create", "soo") @@ -106,7 +106,7 @@ func (s *DockerSuite) TestVolumeLsFormatDefaultFormat(c *check.C) { assertVolumesInList(c, out, []string{"aaa default", "soo default", "test default"}) } -func assertVolumesInList(c *check.C, out string, expected []string) { +func assertVolumesInList(c *testing.T, out string, expected []string) { lines := strings.Split(strings.TrimSpace(string(out)), "\n") for _, expect := range expected { found := false @@ -120,7 +120,7 @@ func assertVolumesInList(c *check.C, out string, expected []string) { } } -func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *check.C) { +func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *testing.T) { prefix, _ := getPrefixAndSlashFromDaemonPlatform() dockerCmd(c, "volume", "create", "testnotinuse1") dockerCmd(c, "volume", "create", "testisinuse1") @@ -170,19 +170,19 @@ func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *check.C) { assert.Assert(c, out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output")) } -func (s *DockerSuite) TestVolumeCLILsErrorWithInvalidFilterName(c *check.C) { +func (s *DockerSuite) TestVolumeCLILsErrorWithInvalidFilterName(c *testing.T) { out, _, err := dockerCmdWithError("volume", "ls", "-f", "FOO=123") assert.ErrorContains(c, err, "") assert.Assert(c, out, checker.Contains, "Invalid filter") } -func (s *DockerSuite) TestVolumeCLILsWithIncorrectFilterValue(c *check.C) { +func (s *DockerSuite) TestVolumeCLILsWithIncorrectFilterValue(c *testing.T) { out, _, err := dockerCmdWithError("volume", "ls", "-f", "dangling=invalid") assert.ErrorContains(c, err, "") assert.Assert(c, out, checker.Contains, "Invalid filter") } -func (s *DockerSuite) TestVolumeCLIRm(c *check.C) { +func (s *DockerSuite) TestVolumeCLIRm(c *testing.T) { prefix, _ := getPrefixAndSlashFromDaemonPlatform() out, _ := dockerCmd(c, "volume", "create") id := strings.TrimSpace(out) @@ -214,7 +214,7 @@ func (s *DockerSuite) TestVolumeCLIRm(c *check.C) { } // FIXME(vdemeester) should be a unit test in cli/command/volume package -func (s *DockerSuite) TestVolumeCLINoArgs(c *check.C) { +func (s *DockerSuite) TestVolumeCLINoArgs(c *testing.T) { out, _ := dockerCmd(c, "volume") // no args should produce the cmd usage output usage := "Usage: docker volume COMMAND" @@ -237,7 +237,7 @@ func (s *DockerSuite) TestVolumeCLINoArgs(c *check.C) { assert.Assert(c, result.Stderr(), checker.Contains, "unknown flag: --no-such-flag") } -func (s *DockerSuite) TestVolumeCLIInspectTmplError(c *check.C) { +func (s *DockerSuite) TestVolumeCLIInspectTmplError(c *testing.T) { out, _ := dockerCmd(c, "volume", "create") name := strings.TrimSpace(out) @@ -247,7 +247,7 @@ func (s *DockerSuite) TestVolumeCLIInspectTmplError(c *check.C) { assert.Assert(c, out, checker.Contains, "Template parsing error") } -func (s *DockerSuite) TestVolumeCLICreateWithOpts(c *check.C) { +func (s *DockerSuite) TestVolumeCLICreateWithOpts(c *testing.T) { testRequires(c, DaemonIsLinux) dockerCmd(c, "volume", "create", "-d", "local", "test", "--opt=type=tmpfs", "--opt=device=tmpfs", "--opt=o=size=1m,uid=1000") @@ -271,7 +271,7 @@ func (s *DockerSuite) TestVolumeCLICreateWithOpts(c *check.C) { assert.Assert(c, found, checker.Equals, true) } -func (s *DockerSuite) TestVolumeCLICreateLabel(c *check.C) { +func (s *DockerSuite) TestVolumeCLICreateLabel(c *testing.T) { testVol := "testvolcreatelabel" testLabel := "foo" testValue := "bar" @@ -283,7 +283,7 @@ func (s *DockerSuite) TestVolumeCLICreateLabel(c *check.C) { assert.Assert(c, strings.TrimSpace(out), check.Equals, testValue) } -func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *check.C) { +func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *testing.T) { testVol := "testvolcreatelabel" testLabels := map[string]string{ @@ -310,7 +310,7 @@ func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *check.C) { } } -func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *check.C) { +func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *testing.T) { testVol1 := "testvolcreatelabel-1" _, _, err := dockerCmdWithError("volume", "create", "--label", "foo=bar1", testVol1) assert.NilError(c, err) @@ -340,7 +340,7 @@ func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *check.C) { assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("\n%s", out)) } -func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *check.C) { +func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *testing.T) { // using default volume driver local to create volumes testVol1 := "testvol-1" _, _, err := dockerCmdWithError("volume", "create", testVol1) @@ -371,7 +371,7 @@ func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *check.C) { assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("\n%s", out)) } -func (s *DockerSuite) TestVolumeCLIRmForceUsage(c *check.C) { +func (s *DockerSuite) TestVolumeCLIRmForceUsage(c *testing.T) { out, _ := dockerCmd(c, "volume", "create") id := strings.TrimSpace(out) @@ -379,7 +379,7 @@ func (s *DockerSuite) TestVolumeCLIRmForceUsage(c *check.C) { dockerCmd(c, "volume", "rm", "--force", "nonexist") } -func (s *DockerSuite) TestVolumeCLIRmForce(c *check.C) { +func (s *DockerSuite) TestVolumeCLIRmForce(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) name := "test" @@ -403,7 +403,7 @@ func (s *DockerSuite) TestVolumeCLIRmForce(c *check.C) { // TestVolumeCLIRmForceInUse verifies that repeated `docker volume rm -f` calls does not remove a volume // if it is in use. Test case for https://github.com/docker/docker/issues/31446 -func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *check.C) { +func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *testing.T) { name := "testvolume" out, _ := dockerCmd(c, "volume", "create", name) id := strings.TrimSpace(out) @@ -441,7 +441,7 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *check.C) { assert.Assert(c, out, checker.Not(checker.Contains), name) } -func (s *DockerSuite) TestVolumeCliInspectWithVolumeOpts(c *check.C) { +func (s *DockerSuite) TestVolumeCliInspectWithVolumeOpts(c *testing.T) { testRequires(c, DaemonIsLinux) // Without options @@ -463,7 +463,7 @@ func (s *DockerSuite) TestVolumeCliInspectWithVolumeOpts(c *check.C) { } // Test case (1) for 21845: duplicate targets for --volumes-from -func (s *DockerSuite) TestDuplicateMountpointsForVolumesFrom(c *check.C) { +func (s *DockerSuite) TestDuplicateMountpointsForVolumesFrom(c *testing.T) { testRequires(c, DaemonIsLinux) image := "vimage" @@ -505,7 +505,7 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFrom(c *check.C) { } // Test case (2) for 21845: duplicate targets for --volumes-from and -v (bind) -func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *check.C) { +func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *testing.T) { testRequires(c, DaemonIsLinux) image := "vimage" @@ -549,7 +549,7 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *check.C) } // Test case (3) for 21845: duplicate targets for --volumes-from and `Mounts` (API only) -func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c *check.C) { +func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c *testing.T) { testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux) image := "vimage" diff --git a/integration-cli/docker_deprecated_api_v124_test.go b/integration-cli/docker_deprecated_api_v124_test.go index 03fc72de33..6f92db4460 100644 --- a/integration-cli/docker_deprecated_api_v124_test.go +++ b/integration-cli/docker_deprecated_api_v124_test.go @@ -18,7 +18,7 @@ func formatV123StartAPIURL(url string) string { return "/v1.23" + url } -func (s *DockerSuite) TestDeprecatedContainerAPIStartHostConfig(c *check.C) { +func (s *DockerSuite) TestDeprecatedContainerAPIStartHostConfig(c *testing.T) { name := "test-deprecated-api-124" dockerCmd(c, "create", "--name", name, "busybox") config := map[string]interface{}{ @@ -37,7 +37,7 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartHostConfig(c *check.C) { } } -func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumeBinds(c *check.C) { +func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumeBinds(c *testing.T) { // TODO Windows CI: Investigate further why this fails on Windows to Windows CI. testRequires(c, DaemonIsLinux) path := "/foo" @@ -68,7 +68,7 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumeBinds(c *check.C) { } // Test for GH#10618 -func (s *DockerSuite) TestDeprecatedContainerAPIStartDupVolumeBinds(c *check.C) { +func (s *DockerSuite) TestDeprecatedContainerAPIStartDupVolumeBinds(c *testing.T) { // TODO Windows to Windows CI - Port this testRequires(c, DaemonIsLinux) name := "testdups" @@ -101,7 +101,7 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartDupVolumeBinds(c *check.C) assert.Assert(c, strings.Contains(string(buf), "Duplicate mount point"), "Expected failure due to duplicate bind mounts to same path, instead got: %q with error: %v", string(buf), err) } -func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumesFrom(c *check.C) { +func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumesFrom(c *testing.T) { // TODO Windows to Windows CI - Port this testRequires(c, DaemonIsLinux) volName := "voltst" @@ -134,7 +134,7 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumesFrom(c *check.C) { } // #9981 - Allow a docker created volume (ie, one in /var/lib/docker/volumes) to be used to overwrite (via passing in Binds on api start) an existing volume -func (s *DockerSuite) TestDeprecatedPostContainerBindNormalVolume(c *check.C) { +func (s *DockerSuite) TestDeprecatedPostContainerBindNormalVolume(c *testing.T) { // TODO Windows to Windows CI - Port this testRequires(c, DaemonIsLinux) dockerCmd(c, "create", "-v", "/foo", "--name=one", "busybox") @@ -154,7 +154,7 @@ func (s *DockerSuite) TestDeprecatedPostContainerBindNormalVolume(c *check.C) { assert.Equal(c, fooDir2, fooDir, "expected volume path to be %s, got: %s", fooDir, fooDir2) } -func (s *DockerSuite) TestDeprecatedStartWithTooLowMemoryLimit(c *check.C) { +func (s *DockerSuite) TestDeprecatedStartWithTooLowMemoryLimit(c *testing.T) { // TODO Windows: Port once memory is supported testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "create", "busybox") @@ -179,7 +179,7 @@ func (s *DockerSuite) TestDeprecatedStartWithTooLowMemoryLimit(c *check.C) { } // #14640 -func (s *DockerSuite) TestDeprecatedPostContainersStartWithoutLinksInHostConfig(c *check.C) { +func (s *DockerSuite) TestDeprecatedPostContainersStartWithoutLinksInHostConfig(c *testing.T) { // TODO Windows: Windows doesn't support supplying a hostconfig on start. // An alternate test could be written to validate the negative testing aspect of this testRequires(c, DaemonIsLinux) @@ -196,7 +196,7 @@ func (s *DockerSuite) TestDeprecatedPostContainersStartWithoutLinksInHostConfig( } // #14640 -func (s *DockerSuite) TestDeprecatedPostContainersStartWithLinksInHostConfig(c *check.C) { +func (s *DockerSuite) TestDeprecatedPostContainersStartWithLinksInHostConfig(c *testing.T) { // TODO Windows: Windows doesn't support supplying a hostconfig on start. // An alternate test could be written to validate the negative testing aspect of this testRequires(c, DaemonIsLinux) @@ -214,7 +214,7 @@ func (s *DockerSuite) TestDeprecatedPostContainersStartWithLinksInHostConfig(c * } // #14640 -func (s *DockerSuite) TestDeprecatedPostContainersStartWithLinksInHostConfigIdLinked(c *check.C) { +func (s *DockerSuite) TestDeprecatedPostContainersStartWithLinksInHostConfigIdLinked(c *testing.T) { // Windows does not support links testRequires(c, DaemonIsLinux) name := "test-host-config-links" @@ -233,7 +233,7 @@ func (s *DockerSuite) TestDeprecatedPostContainersStartWithLinksInHostConfigIdLi b.Close() } -func (s *DockerSuite) TestDeprecatedStartWithNilDNS(c *check.C) { +func (s *DockerSuite) TestDeprecatedStartWithNilDNS(c *testing.T) { // TODO Windows: Add once DNS is supported testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "create", "busybox") diff --git a/integration-cli/docker_deprecated_api_v124_unix_test.go b/integration-cli/docker_deprecated_api_v124_unix_test.go index 0aae30be80..135f101323 100644 --- a/integration-cli/docker_deprecated_api_v124_unix_test.go +++ b/integration-cli/docker_deprecated_api_v124_unix_test.go @@ -11,7 +11,7 @@ import ( ) // #19100 This is a deprecated feature test, it should be removed in Docker 1.12 -func (s *DockerNetworkSuite) TestDeprecatedDockerNetworkStartAPIWithHostconfig(c *check.C) { +func (s *DockerNetworkSuite) TestDeprecatedDockerNetworkStartAPIWithHostconfig(c *testing.T) { netName := "test" conName := "foo" dockerCmd(c, "network", "create", netName) diff --git a/integration-cli/docker_hub_pull_suite_test.go b/integration-cli/docker_hub_pull_suite_test.go index 39cd41622b..7165ff722c 100644 --- a/integration-cli/docker_hub_pull_suite_test.go +++ b/integration-cli/docker_hub_pull_suite_test.go @@ -39,26 +39,26 @@ func newDockerHubPullSuite() *DockerHubPullSuite { } // SetUpSuite starts the suite daemon. -func (s *DockerHubPullSuite) SetUpSuite(c *check.C) { +func (s *DockerHubPullSuite) SetUpSuite(c *testing.T) { testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon) s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) s.d.Start(c) } // TearDownSuite stops the suite daemon. -func (s *DockerHubPullSuite) TearDownSuite(c *check.C) { +func (s *DockerHubPullSuite) TearDownSuite(c *testing.T) { if s.d != nil { s.d.Stop(c) } } // SetUpTest declares that all tests of this suite require network. -func (s *DockerHubPullSuite) SetUpTest(c *check.C) { +func (s *DockerHubPullSuite) SetUpTest(c *testing.T) { testRequires(c, Network) } // TearDownTest removes all images from the suite daemon. -func (s *DockerHubPullSuite) TearDownTest(c *check.C) { +func (s *DockerHubPullSuite) TearDownTest(c *testing.T) { out := s.Cmd(c, "images", "-aq") images := strings.Split(out, "\n") images = append([]string{"rmi", "-f"}, images...) @@ -68,7 +68,7 @@ func (s *DockerHubPullSuite) TearDownTest(c *check.C) { // Cmd executes a command against the suite daemon and returns the combined // output. The function fails the test when the command returns an error. -func (s *DockerHubPullSuite) Cmd(c *check.C, name string, arg ...string) string { +func (s *DockerHubPullSuite) Cmd(c *testing.T, name string, arg ...string) string { out, err := s.CmdWithError(name, arg...) assert.Assert(c, err, checker.IsNil, check.Commentf("%q failed with errors: %s, %v", strings.Join(arg, " "), out, err)) return out diff --git a/integration-cli/docker_utils_test.go b/integration-cli/docker_utils_test.go index fc220e6175..5852afae50 100644 --- a/integration-cli/docker_utils_test.go +++ b/integration-cli/docker_utils_test.go @@ -48,12 +48,12 @@ func dockerCmdWithResult(args ...string) *icmd.Result { return cli.Docker(cli.Args(args...)) } -func findContainerIP(c *check.C, id string, network string) string { +func findContainerIP(c *testing.T, id string, network string) string { out, _ := dockerCmd(c, "inspect", fmt.Sprintf("--format='{{ .NetworkSettings.Networks.%s.IPAddress }}'", network), id) return strings.Trim(out, " \r\n'") } -func getContainerCount(c *check.C) int { +func getContainerCount(c *testing.T) int { const containers = "Containers:" result := icmd.RunCommand(dockerBinary, "info") @@ -73,7 +73,7 @@ func getContainerCount(c *check.C) int { return 0 } -func inspectFieldAndUnmarshall(c *check.C, name, field string, output interface{}) { +func inspectFieldAndUnmarshall(c *testing.T, name, field string, output interface{}) { str := inspectFieldJSON(c, name, field) err := json.Unmarshal([]byte(str), output) if c != nil { @@ -97,7 +97,7 @@ func inspectFieldWithError(name, field string) (string, error) { } // Deprecated: use cli.Inspect -func inspectField(c *check.C, name, field string) string { +func inspectField(c *testing.T, name, field string) string { out, err := inspectFilter(name, fmt.Sprintf(".%s", field)) if c != nil { assert.NilError(c, err) @@ -106,7 +106,7 @@ func inspectField(c *check.C, name, field string) string { } // Deprecated: use cli.Inspect -func inspectFieldJSON(c *check.C, name, field string) string { +func inspectFieldJSON(c *testing.T, name, field string) string { out, err := inspectFilter(name, fmt.Sprintf("json .%s", field)) if c != nil { assert.NilError(c, err) @@ -115,7 +115,7 @@ func inspectFieldJSON(c *check.C, name, field string) string { } // Deprecated: use cli.Inspect -func inspectFieldMap(c *check.C, name, path, field string) string { +func inspectFieldMap(c *testing.T, name, path, field string) string { out, err := inspectFilter(name, fmt.Sprintf("index .%s %q", path, field)) if c != nil { assert.NilError(c, err) @@ -167,7 +167,7 @@ func inspectMountPointJSON(j, destination string) (types.MountPoint, error) { } // Deprecated: use cli.Inspect -func inspectImage(c *check.C, name, filter string) string { +func inspectImage(c *testing.T, name, filter string) string { args := []string{"inspect", "--type", "image"} if filter != "" { format := fmt.Sprintf("{{%s}}", filter) @@ -179,14 +179,14 @@ func inspectImage(c *check.C, name, filter string) string { return strings.TrimSpace(result.Combined()) } -func getIDByName(c *check.C, name string) string { +func getIDByName(c *testing.T, name string) string { id, err := inspectFieldWithError(name, "Id") assert.NilError(c, err) return id } // Deprecated: use cli.Build -func buildImageSuccessfully(c *check.C, name string, cmdOperators ...cli.CmdOperator) { +func buildImageSuccessfully(c *testing.T, name string, cmdOperators ...cli.CmdOperator) { buildImage(name, cmdOperators...).Assert(c, icmd.Success) } @@ -199,7 +199,7 @@ func buildImage(name string, cmdOperators ...cli.CmdOperator) *icmd.Result { // as well as any missing directories. // The file is truncated if it already exists. // Fail the test when error occurs. -func writeFile(dst, content string, c *check.C) { +func writeFile(dst, content string, c *testing.T) { // Create subdirectories if necessary assert.Assert(c, os.MkdirAll(path.Dir(dst), 0700), check.IsNil) f, err := os.OpenFile(dst, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0700) @@ -212,7 +212,7 @@ func writeFile(dst, content string, c *check.C) { // Return the contents of file at path `src`. // Fail the test when error occurs. -func readFile(src string, c *check.C) (content string) { +func readFile(src string, c *testing.T) (content string) { data, err := ioutil.ReadFile(src) assert.NilError(c, err) @@ -224,7 +224,7 @@ func containerStorageFile(containerID, basename string) string { } // docker commands that use this function must be run with the '-d' switch. -func runCommandAndReadContainerFile(c *check.C, filename string, command string, args ...string) []byte { +func runCommandAndReadContainerFile(c *testing.T, filename string, command string, args ...string) []byte { result := icmd.RunCommand(command, args...) result.Assert(c, icmd.Success) contID := strings.TrimSpace(result.Combined()) @@ -234,7 +234,7 @@ func runCommandAndReadContainerFile(c *check.C, filename string, command string, return readContainerFile(c, contID, filename) } -func readContainerFile(c *check.C, containerID, filename string) []byte { +func readContainerFile(c *testing.T, containerID, filename string) []byte { f, err := os.Open(containerStorageFile(containerID, filename)) assert.NilError(c, err) defer f.Close() @@ -244,14 +244,14 @@ func readContainerFile(c *check.C, containerID, filename string) []byte { return content } -func readContainerFileWithExec(c *check.C, containerID, filename string) []byte { +func readContainerFileWithExec(c *testing.T, containerID, filename string) []byte { result := icmd.RunCommand(dockerBinary, "exec", containerID, "cat", filename) result.Assert(c, icmd.Success) return []byte(result.Combined()) } // daemonTime provides the current time on the daemon host -func daemonTime(c *check.C) time.Time { +func daemonTime(c *testing.T) time.Time { if testEnv.IsLocalDaemon() { return time.Now() } @@ -269,7 +269,7 @@ func daemonTime(c *check.C) time.Time { // daemonUnixTime returns the current time on the daemon host with nanoseconds precision. // It return the time formatted how the client sends timestamps to the server. -func daemonUnixTime(c *check.C) string { +func daemonUnixTime(c *testing.T) string { return parseEventTime(daemonTime(c)) } @@ -304,7 +304,7 @@ func appendBaseEnv(isTLS bool, env ...string) []string { return env } -func createTmpFile(c *check.C, content string) string { +func createTmpFile(c *testing.T, content string) string { f, err := ioutil.TempFile("", "testfile") assert.NilError(c, err) @@ -335,7 +335,7 @@ func waitInspectWithArgs(name, expr, expected string, timeout time.Duration, arg return daemon.WaitInspectWithArgs(dockerBinary, name, expr, expected, timeout, arg...) } -func getInspectBody(c *check.C, version, id string) []byte { +func getInspectBody(c *testing.T, version, id string) []byte { cli, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion(version)) assert.NilError(c, err) defer cli.Close() @@ -346,13 +346,13 @@ func getInspectBody(c *check.C, version, id string) []byte { // Run a long running idle task in a background container using the // system-specific default image and command. -func runSleepingContainer(c *check.C, extraArgs ...string) string { +func runSleepingContainer(c *testing.T, extraArgs ...string) string { return runSleepingContainerInImage(c, "busybox", extraArgs...) } // Run a long running idle task in a background container using the specified // image and the system-specific command. -func runSleepingContainerInImage(c *check.C, image string, extraArgs ...string) string { +func runSleepingContainerInImage(c *testing.T, image string, extraArgs ...string) string { args := []string{"run", "-d"} args = append(args, extraArgs...) args = append(args, image) @@ -406,7 +406,7 @@ func waitForGoroutines(expected int) error { } // getErrorMessage returns the error message from an error API response -func getErrorMessage(c *check.C, body []byte) string { +func getErrorMessage(c *testing.T, body []byte) string { var resp types.ErrorResponse assert.Assert(c, json.Unmarshal(body, &resp), check.IsNil) return strings.TrimSpace(resp.Message) @@ -421,7 +421,7 @@ func waitAndAssert(t assert.TestingT, timeout time.Duration, f checkF, compariso after := time.After(timeout) for { - v, comment := f(t.(*check.C)) + v, comment := f(t.(*testing.T)) args = append([]interface{}{v}, args...) shouldAssert := assert.Check(t, comparison, args...) select { @@ -440,11 +440,11 @@ func waitAndAssert(t assert.TestingT, timeout time.Duration, f checkF, compariso } } -type checkF func(*check.C) (interface{}, check.CommentInterface) +type checkF func(*testing.T) (interface{}, check.CommentInterface) type reducer func(...interface{}) interface{} func reducedCheck(r reducer, funcs ...checkF) checkF { - return func(c *check.C) (interface{}, check.CommentInterface) { + return func(c *testing.T) (interface{}, check.CommentInterface) { var values []interface{} var comments []string for _, f := range funcs { diff --git a/integration-cli/events_utils_test.go b/integration-cli/events_utils_test.go index f63082af9f..b89b446b1d 100644 --- a/integration-cli/events_utils_test.go +++ b/integration-cli/events_utils_test.go @@ -35,13 +35,13 @@ type eventObserver struct { // newEventObserver creates the observer and initializes the command // without running it. Users must call `eventObserver.Start` to start the command. -func newEventObserver(c *check.C, args ...string) (*eventObserver, error) { +func newEventObserver(c *testing.T, args ...string) (*eventObserver, error) { since := daemonTime(c).Unix() return newEventObserverWithBacklog(c, since, args...) } // newEventObserverWithBacklog creates a new observer changing the start time of the backlog to return. -func newEventObserverWithBacklog(c *check.C, since int64, args ...string) (*eventObserver, error) { +func newEventObserverWithBacklog(c *testing.T, since int64, args ...string) (*eventObserver, error) { startTime := strconv.FormatInt(since, 10) cmdArgs := []string{"events", "--since", startTime} if len(args) > 0 { @@ -93,7 +93,7 @@ func (e *eventObserver) Match(match eventMatcher, process eventMatchProcessor) { e.disconnectionError = err } -func (e *eventObserver) CheckEventError(c *check.C, id, event string, match eventMatcher) { +func (e *eventObserver) CheckEventError(c *testing.T, id, event string, match eventMatcher) { var foundEvent bool scannerOut := e.buffer.String() @@ -144,14 +144,14 @@ func processEventMatch(actions map[string]chan bool) eventMatchProcessor { // parseEventAction parses an event text and returns the action. // It fails if the text is not in the event format. -func parseEventAction(c *check.C, text string) string { +func parseEventAction(c *testing.T, text string) string { matches := eventstestutils.ScanMap(text) return matches["action"] } // eventActionsByIDAndType returns the actions for a given id and type. // It fails if the text is not in the event format. -func eventActionsByIDAndType(c *check.C, events []string, id, eventType string) []string { +func eventActionsByIDAndType(c *testing.T, events []string, id, eventType string) []string { var filtered []string for _, event := range events { matches := eventstestutils.ScanMap(event) @@ -183,7 +183,7 @@ func matchEventID(matches map[string]string, id string) bool { return matchID } -func parseEvents(c *check.C, out, match string) { +func parseEvents(c *testing.T, out, match string) { events := strings.Split(strings.TrimSpace(out), "\n") for _, event := range events { matches := eventstestutils.ScanMap(event) @@ -193,7 +193,7 @@ func parseEvents(c *check.C, out, match string) { } } -func parseEventsWithID(c *check.C, out, match, id string) { +func parseEventsWithID(c *testing.T, out, match, id string) { events := strings.Split(strings.TrimSpace(out), "\n") for _, event := range events { matches := eventstestutils.ScanMap(event) diff --git a/integration-cli/fixtures_linux_daemon_test.go b/integration-cli/fixtures_linux_daemon_test.go index ab152f4a99..f17a0284f3 100644 --- a/integration-cli/fixtures_linux_daemon_test.go +++ b/integration-cli/fixtures_linux_daemon_test.go @@ -23,7 +23,7 @@ type logT interface { Logf(string, ...interface{}) } -func ensureSyscallTest(c *check.C) { +func ensureSyscallTest(c *testing.T) { defer testEnv.ProtectImage(c, "syscall-test:latest") // If the image already exists, there's nothing left to do. @@ -73,7 +73,7 @@ func ensureSyscallTest(c *check.C) { dockerCmd(c, buildArgs...) } -func ensureSyscallTestBuild(c *check.C) { +func ensureSyscallTestBuild(c *testing.T) { err := load.FrozenImagesLinux(testEnv.APIClient(), "buildpack-deps:jessie") assert.NilError(c, err) @@ -86,7 +86,7 @@ func ensureSyscallTestBuild(c *check.C) { dockerCmd(c, buildArgs...) } -func ensureNNPTest(c *check.C) { +func ensureNNPTest(c *testing.T) { defer testEnv.ProtectImage(c, "nnp-test:latest") // If the image already exists, there's nothing left to do. @@ -128,7 +128,7 @@ func ensureNNPTest(c *check.C) { dockerCmd(c, buildArgs...) } -func ensureNNPTestBuild(c *check.C) { +func ensureNNPTestBuild(c *testing.T) { err := load.FrozenImagesLinux(testEnv.APIClient(), "buildpack-deps:jessie") assert.NilError(c, err) diff --git a/integration-cli/utils_test.go b/integration-cli/utils_test.go index fd083681f2..867467726c 100644 --- a/integration-cli/utils_test.go +++ b/integration-cli/utils_test.go @@ -118,7 +118,7 @@ type elementListOptions struct { element, format string } -func existingElements(c *check.C, opts elementListOptions) []string { +func existingElements(c *testing.T, opts elementListOptions) []string { var args []string switch opts.element { case "container": @@ -146,12 +146,12 @@ func existingElements(c *check.C, opts elementListOptions) []string { } // ExistingContainerIDs returns a list of currently existing container IDs. -func ExistingContainerIDs(c *check.C) []string { +func ExistingContainerIDs(c *testing.T) []string { return existingElements(c, elementListOptions{element: "container", format: "{{.ID}}"}) } // ExistingContainerNames returns a list of existing container names. -func ExistingContainerNames(c *check.C) []string { +func ExistingContainerNames(c *testing.T) []string { return existingElements(c, elementListOptions{element: "container", format: "{{.Names}}"}) } diff --git a/pkg/discovery/discovery_test.go b/pkg/discovery/discovery_test.go index e68c53b45d..11c74040a5 100644 --- a/pkg/discovery/discovery_test.go +++ b/pkg/discovery/discovery_test.go @@ -13,7 +13,7 @@ type DiscoverySuite struct{} var _ = check.Suite(&DiscoverySuite{}) -func (s *DiscoverySuite) TestNewEntry(c *check.C) { +func (s *DiscoverySuite) TestNewEntry(c *testing.T) { entry, err := NewEntry("127.0.0.1:2375") assert.Assert(c, err, check.IsNil) assert.Assert(c, entry.Equals(&Entry{Host: "127.0.0.1", Port: "2375"}), check.Equals, true) @@ -28,7 +28,7 @@ func (s *DiscoverySuite) TestNewEntry(c *check.C) { assert.Assert(c, err, check.NotNil) } -func (s *DiscoverySuite) TestParse(c *check.C) { +func (s *DiscoverySuite) TestParse(c *testing.T) { scheme, uri := parse("127.0.0.1:2375") assert.Assert(c, scheme, check.Equals, "nodes") assert.Assert(c, uri, check.Equals, "127.0.0.1:2375") @@ -50,7 +50,7 @@ func (s *DiscoverySuite) TestParse(c *check.C) { assert.Assert(c, uri, check.Equals, "") } -func (s *DiscoverySuite) TestCreateEntries(c *check.C) { +func (s *DiscoverySuite) TestCreateEntries(c *testing.T) { entries, err := CreateEntries(nil) assert.Assert(c, entries, check.DeepEquals, Entries{}) assert.Assert(c, err, check.IsNil) @@ -68,14 +68,14 @@ func (s *DiscoverySuite) TestCreateEntries(c *check.C) { assert.Assert(c, err, check.NotNil) } -func (s *DiscoverySuite) TestContainsEntry(c *check.C) { +func (s *DiscoverySuite) TestContainsEntry(c *testing.T) { entries, err := CreateEntries([]string{"127.0.0.1:2375", "127.0.0.2:2375", ""}) assert.Assert(c, err, check.IsNil) assert.Assert(c, entries.Contains(&Entry{Host: "127.0.0.1", Port: "2375"}), check.Equals, true) assert.Assert(c, entries.Contains(&Entry{Host: "127.0.0.3", Port: "2375"}), check.Equals, false) } -func (s *DiscoverySuite) TestEntriesEquality(c *check.C) { +func (s *DiscoverySuite) TestEntriesEquality(c *testing.T) { entries := Entries{ &Entry{Host: "127.0.0.1", Port: "2375"}, &Entry{Host: "127.0.0.2", Port: "2375"}, @@ -102,7 +102,7 @@ func (s *DiscoverySuite) TestEntriesEquality(c *check.C) { } -func (s *DiscoverySuite) TestEntriesDiff(c *check.C) { +func (s *DiscoverySuite) TestEntriesDiff(c *testing.T) { entry1 := &Entry{Host: "1.1.1.1", Port: "1111"} entry2 := &Entry{Host: "2.2.2.2", Port: "2222"} entry3 := &Entry{Host: "3.3.3.3", Port: "3333"} diff --git a/pkg/discovery/file/file_test.go b/pkg/discovery/file/file_test.go index 366b1ee755..5d026b06dc 100644 --- a/pkg/discovery/file/file_test.go +++ b/pkg/discovery/file/file_test.go @@ -17,19 +17,19 @@ type DiscoverySuite struct{} var _ = check.Suite(&DiscoverySuite{}) -func (s *DiscoverySuite) TestInitialize(c *check.C) { +func (s *DiscoverySuite) TestInitialize(c *testing.T) { d := &Discovery{} d.Initialize("/path/to/file", 1000, 0, nil) assert.Assert(c, d.path, check.Equals, "/path/to/file") } -func (s *DiscoverySuite) TestNew(c *check.C) { +func (s *DiscoverySuite) TestNew(c *testing.T) { d, err := discovery.New("file:///path/to/file", 0, 0, nil) assert.Assert(c, err, check.IsNil) assert.Assert(c, d.(*Discovery).path, check.Equals, "/path/to/file") } -func (s *DiscoverySuite) TestContent(c *check.C) { +func (s *DiscoverySuite) TestContent(c *testing.T) { data := ` 1.1.1.[1:2]:1111 2.2.2.[2:4]:2222 @@ -43,12 +43,12 @@ func (s *DiscoverySuite) TestContent(c *check.C) { assert.Assert(c, ips[4], check.Equals, "2.2.2.4:2222") } -func (s *DiscoverySuite) TestRegister(c *check.C) { +func (s *DiscoverySuite) TestRegister(c *testing.T) { discovery := &Discovery{path: "/path/to/file"} assert.Assert(c, discovery.Register("0.0.0.0"), check.NotNil) } -func (s *DiscoverySuite) TestParsingContentsWithComments(c *check.C) { +func (s *DiscoverySuite) TestParsingContentsWithComments(c *testing.T) { data := ` ### test ### 1.1.1.1:1111 # inline comment @@ -63,7 +63,7 @@ func (s *DiscoverySuite) TestParsingContentsWithComments(c *check.C) { assert.Assert(c, "3.3.3.3:3333", check.Equals, ips[1]) } -func (s *DiscoverySuite) TestWatch(c *check.C) { +func (s *DiscoverySuite) TestWatch(c *testing.T) { data := ` 1.1.1.1:1111 2.2.2.2:2222 diff --git a/pkg/discovery/generator_test.go b/pkg/discovery/generator_test.go index 051eaec7d8..cbfbf8ec8e 100644 --- a/pkg/discovery/generator_test.go +++ b/pkg/discovery/generator_test.go @@ -4,25 +4,25 @@ import ( "github.com/go-check/check" ) -func (s *DiscoverySuite) TestGeneratorNotGenerate(c *check.C) { +func (s *DiscoverySuite) TestGeneratorNotGenerate(c *testing.T) { ips := Generate("127.0.0.1") assert.Assert(c, len(ips), check.Equals, 1) assert.Assert(c, ips[0], check.Equals, "127.0.0.1") } -func (s *DiscoverySuite) TestGeneratorWithPortNotGenerate(c *check.C) { +func (s *DiscoverySuite) TestGeneratorWithPortNotGenerate(c *testing.T) { ips := Generate("127.0.0.1:8080") assert.Assert(c, len(ips), check.Equals, 1) assert.Assert(c, ips[0], check.Equals, "127.0.0.1:8080") } -func (s *DiscoverySuite) TestGeneratorMatchFailedNotGenerate(c *check.C) { +func (s *DiscoverySuite) TestGeneratorMatchFailedNotGenerate(c *testing.T) { ips := Generate("127.0.0.[1]") assert.Assert(c, len(ips), check.Equals, 1) assert.Assert(c, ips[0], check.Equals, "127.0.0.[1]") } -func (s *DiscoverySuite) TestGeneratorWithPort(c *check.C) { +func (s *DiscoverySuite) TestGeneratorWithPort(c *testing.T) { ips := Generate("127.0.0.[1:11]:2375") assert.Assert(c, len(ips), check.Equals, 11) assert.Assert(c, ips[0], check.Equals, "127.0.0.1:2375") @@ -38,14 +38,14 @@ func (s *DiscoverySuite) TestGeneratorWithPort(c *check.C) { assert.Assert(c, ips[10], check.Equals, "127.0.0.11:2375") } -func (s *DiscoverySuite) TestGenerateWithMalformedInputAtRangeStart(c *check.C) { +func (s *DiscoverySuite) TestGenerateWithMalformedInputAtRangeStart(c *testing.T) { malformedInput := "127.0.0.[x:11]:2375" ips := Generate(malformedInput) assert.Assert(c, len(ips), check.Equals, 1) assert.Assert(c, ips[0], check.Equals, malformedInput) } -func (s *DiscoverySuite) TestGenerateWithMalformedInputAtRangeEnd(c *check.C) { +func (s *DiscoverySuite) TestGenerateWithMalformedInputAtRangeEnd(c *testing.T) { malformedInput := "127.0.0.[1:x]:2375" ips := Generate(malformedInput) assert.Assert(c, len(ips), check.Equals, 1) diff --git a/pkg/discovery/kv/kv_test.go b/pkg/discovery/kv/kv_test.go index 4c80838495..2cda6dee47 100644 --- a/pkg/discovery/kv/kv_test.go +++ b/pkg/discovery/kv/kv_test.go @@ -21,7 +21,7 @@ type DiscoverySuite struct{} var _ = check.Suite(&DiscoverySuite{}) -func (ds *DiscoverySuite) TestInitialize(c *check.C) { +func (ds *DiscoverySuite) TestInitialize(c *testing.T) { storeMock := &FakeStore{ Endpoints: []string{"127.0.0.1"}, } @@ -131,7 +131,7 @@ func (s *Mock) AtomicDelete(key string, previous *store.KVPair) (bool, error) { func (s *Mock) Close() { } -func (ds *DiscoverySuite) TestInitializeWithCerts(c *check.C) { +func (ds *DiscoverySuite) TestInitializeWithCerts(c *testing.T) { cert := `-----BEGIN CERTIFICATE----- MIIDCDCCAfKgAwIBAgIICifG7YeiQOEwCwYJKoZIhvcNAQELMBIxEDAOBgNVBAMT B1Rlc3QgQ0EwHhcNMTUxMDAxMjMwMDAwWhcNMjAwOTI5MjMwMDAwWjASMRAwDgYD @@ -205,7 +205,7 @@ BFrwkQE4HQtQBV60hYQUzzlSk44VFDz+jxIEtacRHaomDRh2FtOTz+I= assert.Assert(c, s.Options.TLS.Certificates, check.HasLen, 1) } -func (ds *DiscoverySuite) TestWatch(c *check.C) { +func (ds *DiscoverySuite) TestWatch(c *testing.T) { mockCh := make(chan []*store.KVPair) storeMock := &FakeStore{ diff --git a/pkg/discovery/memory/memory_test.go b/pkg/discovery/memory/memory_test.go index 2c53817029..9fd7874577 100644 --- a/pkg/discovery/memory/memory_test.go +++ b/pkg/discovery/memory/memory_test.go @@ -14,7 +14,7 @@ type discoverySuite struct{} var _ = check.Suite(&discoverySuite{}) -func (s *discoverySuite) TestWatch(c *check.C) { +func (s *discoverySuite) TestWatch(c *testing.T) { d := &Discovery{} d.Initialize("foo", 1000, 0, nil) stopCh := make(chan struct{}) diff --git a/pkg/discovery/nodes/nodes_test.go b/pkg/discovery/nodes/nodes_test.go index a7e15f46df..5f8e7263a0 100644 --- a/pkg/discovery/nodes/nodes_test.go +++ b/pkg/discovery/nodes/nodes_test.go @@ -15,7 +15,7 @@ type DiscoverySuite struct{} var _ = check.Suite(&DiscoverySuite{}) -func (s *DiscoverySuite) TestInitialize(c *check.C) { +func (s *DiscoverySuite) TestInitialize(c *testing.T) { d := &Discovery{} d.Initialize("1.1.1.1:1111,2.2.2.2:2222", 0, 0, nil) assert.Assert(c, len(d.entries), check.Equals, 2) @@ -23,7 +23,7 @@ func (s *DiscoverySuite) TestInitialize(c *check.C) { assert.Assert(c, d.entries[1].String(), check.Equals, "2.2.2.2:2222") } -func (s *DiscoverySuite) TestInitializeWithPattern(c *check.C) { +func (s *DiscoverySuite) TestInitializeWithPattern(c *testing.T) { d := &Discovery{} d.Initialize("1.1.1.[1:2]:1111,2.2.2.[2:4]:2222", 0, 0, nil) assert.Assert(c, len(d.entries), check.Equals, 5) @@ -34,7 +34,7 @@ func (s *DiscoverySuite) TestInitializeWithPattern(c *check.C) { assert.Assert(c, d.entries[4].String(), check.Equals, "2.2.2.4:2222") } -func (s *DiscoverySuite) TestWatch(c *check.C) { +func (s *DiscoverySuite) TestWatch(c *testing.T) { d := &Discovery{} d.Initialize("1.1.1.1:1111,2.2.2.2:2222", 0, 0, nil) expected := discovery.Entries{ @@ -45,7 +45,7 @@ func (s *DiscoverySuite) TestWatch(c *check.C) { assert.Assert(c, expected.Equals(<-ch), check.Equals, true) } -func (s *DiscoverySuite) TestRegister(c *check.C) { +func (s *DiscoverySuite) TestRegister(c *testing.T) { d := &Discovery{} assert.Assert(c, d.Register("0.0.0.0"), check.NotNil) }