瀏覽代碼

Merge pull request #281 from thaJeztah/19.03_backport_fix_golint_again

[19.03 backport] Integration: change signatures to fix golint warnings
Andrew Hsu 5 年之前
父節點
當前提交
c5754a7329
共有 48 個文件被更改,包括 177 次插入181 次删除
  1. 3 3
      integration/build/build_squash_test.go
  2. 1 1
      integration/container/checkpoint_test.go
  3. 5 5
      integration/container/copy_test.go
  4. 3 3
      integration/container/daemon_linux_test.go
  5. 1 1
      integration/container/diff_test.go
  6. 3 3
      integration/container/exec_test.go
  7. 2 2
      integration/container/export_test.go
  8. 2 2
      integration/container/health_test.go
  9. 1 1
      integration/container/inspect_test.go
  10. 2 2
      integration/container/ipcmode_linux_test.go
  11. 8 8
      integration/container/kill_test.go
  12. 3 3
      integration/container/links_linux_test.go
  13. 1 1
      integration/container/logs_test.go
  14. 3 3
      integration/container/mounts_linux_test.go
  15. 2 2
      integration/container/nat_test.go
  16. 3 3
      integration/container/pause_test.go
  17. 3 3
      integration/container/ps_test.go
  18. 4 4
      integration/container/remove_test.go
  19. 13 13
      integration/container/rename_test.go
  20. 3 3
      integration/container/resize_test.go
  21. 2 2
      integration/container/run_linux_test.go
  22. 1 1
      integration/container/stats_test.go
  23. 2 2
      integration/container/stop_linux_test.go
  24. 1 1
      integration/container/stop_test.go
  25. 1 1
      integration/container/stop_windows_test.go
  26. 3 3
      integration/container/update_linux_test.go
  27. 2 2
      integration/container/update_test.go
  28. 2 2
      integration/container/wait_test.go
  29. 2 2
      integration/image/commit_test.go
  30. 2 2
      integration/image/remove_test.go
  31. 3 5
      integration/internal/container/container.go
  32. 1 2
      integration/internal/network/network.go
  33. 6 6
      integration/network/delete_test.go
  34. 1 1
      integration/network/inspect_test.go
  35. 29 29
      integration/network/ipvlan/ipvlan_test.go
  36. 16 16
      integration/network/macvlan/macvlan_test.go
  37. 3 3
      integration/network/network_test.go
  38. 9 9
      integration/network/service_test.go
  39. 4 4
      integration/plugin/authz/authz_plugin_test.go
  40. 1 1
      integration/plugin/authz/authz_plugin_v2_test.go
  41. 5 6
      integration/plugin/graphdriver/external_test.go
  42. 1 1
      integration/plugin/logging/logging_linux_test.go
  43. 4 4
      integration/service/create_test.go
  44. 5 5
      integration/service/network_test.go
  45. 1 1
      integration/service/update_test.go
  46. 1 1
      integration/system/cgroupdriver_systemd_test.go
  47. 2 2
      integration/system/event_test.go
  48. 1 1
      integration/volume/volume_test.go

+ 3 - 3
integration/build/build_squash_test.go

@@ -79,7 +79,7 @@ func TestBuildSquashParent(t *testing.T) {
 	resp.Body.Close()
 	resp.Body.Close()
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
-	cid := container.Run(t, ctx, client,
+	cid := container.Run(ctx, t, client,
 		container.WithImage(name),
 		container.WithImage(name),
 		container.WithCmd("/bin/sh", "-c", "cat /hello"),
 		container.WithCmd("/bin/sh", "-c", "cat /hello"),
 	)
 	)
@@ -94,11 +94,11 @@ func TestBuildSquashParent(t *testing.T) {
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Check(t, is.Equal(strings.TrimSpace(actualStdout.String()), "hello\nworld"))
 	assert.Check(t, is.Equal(strings.TrimSpace(actualStdout.String()), "hello\nworld"))
 
 
-	container.Run(t, ctx, client,
+	container.Run(ctx, t, client,
 		container.WithImage(name),
 		container.WithImage(name),
 		container.WithCmd("/bin/sh", "-c", "[ ! -f /remove_me ]"),
 		container.WithCmd("/bin/sh", "-c", "[ ! -f /remove_me ]"),
 	)
 	)
-	container.Run(t, ctx, client,
+	container.Run(ctx, t, client,
 		container.WithImage(name),
 		container.WithImage(name),
 		container.WithCmd("/bin/sh", "-c", `[ "$(echo $HELLO)" == "world" ]`),
 		container.WithCmd("/bin/sh", "-c", `[ "$(echo $HELLO)" == "world" ]`),
 	)
 	)

+ 1 - 1
integration/container/checkpoint_test.go

@@ -50,7 +50,7 @@ func TestCheckpoint(t *testing.T) {
 	}
 	}
 
 
 	t.Log("Start a container")
 	t.Log("Start a container")
-	cID := container.Run(t, ctx, client, container.WithMount(mnt))
+	cID := container.Run(ctx, t, client, container.WithMount(mnt))
 	poll.WaitOn(t,
 	poll.WaitOn(t,
 		container.IsInState(ctx, client, cID, "running"),
 		container.IsInState(ctx, client, cID, "running"),
 		poll.WithDelay(100*time.Millisecond),
 		poll.WithDelay(100*time.Millisecond),

+ 5 - 5
integration/container/copy_test.go

@@ -26,7 +26,7 @@ func TestCopyFromContainerPathDoesNotExist(t *testing.T) {
 
 
 	ctx := context.Background()
 	ctx := context.Background()
 	apiclient := testEnv.APIClient()
 	apiclient := testEnv.APIClient()
-	cid := container.Create(t, ctx, apiclient)
+	cid := container.Create(ctx, t, apiclient)
 
 
 	_, _, err := apiclient.CopyFromContainer(ctx, cid, "/dne")
 	_, _, err := apiclient.CopyFromContainer(ctx, cid, "/dne")
 	assert.Check(t, client.IsErrNotFound(err))
 	assert.Check(t, client.IsErrNotFound(err))
@@ -40,7 +40,7 @@ func TestCopyFromContainerPathIsNotDir(t *testing.T) {
 
 
 	ctx := context.Background()
 	ctx := context.Background()
 	apiclient := testEnv.APIClient()
 	apiclient := testEnv.APIClient()
-	cid := container.Create(t, ctx, apiclient)
+	cid := container.Create(ctx, t, apiclient)
 
 
 	_, _, err := apiclient.CopyFromContainer(ctx, cid, "/etc/passwd/")
 	_, _, err := apiclient.CopyFromContainer(ctx, cid, "/etc/passwd/")
 	assert.Assert(t, is.ErrorContains(err, "not a directory"))
 	assert.Assert(t, is.ErrorContains(err, "not a directory"))
@@ -52,7 +52,7 @@ func TestCopyToContainerPathDoesNotExist(t *testing.T) {
 
 
 	ctx := context.Background()
 	ctx := context.Background()
 	apiclient := testEnv.APIClient()
 	apiclient := testEnv.APIClient()
-	cid := container.Create(t, ctx, apiclient)
+	cid := container.Create(ctx, t, apiclient)
 
 
 	err := apiclient.CopyToContainer(ctx, cid, "/dne", nil, types.CopyToContainerOptions{})
 	err := apiclient.CopyToContainer(ctx, cid, "/dne", nil, types.CopyToContainerOptions{})
 	assert.Check(t, client.IsErrNotFound(err))
 	assert.Check(t, client.IsErrNotFound(err))
@@ -66,7 +66,7 @@ func TestCopyToContainerPathIsNotDir(t *testing.T) {
 
 
 	ctx := context.Background()
 	ctx := context.Background()
 	apiclient := testEnv.APIClient()
 	apiclient := testEnv.APIClient()
-	cid := container.Create(t, ctx, apiclient)
+	cid := container.Create(ctx, t, apiclient)
 
 
 	err := apiclient.CopyToContainer(ctx, cid, "/etc/passwd/", nil, types.CopyToContainerOptions{})
 	err := apiclient.CopyToContainer(ctx, cid, "/etc/passwd/", nil, types.CopyToContainerOptions{})
 	assert.Assert(t, is.ErrorContains(err, "not a directory"))
 	assert.Assert(t, is.ErrorContains(err, "not a directory"))
@@ -105,7 +105,7 @@ func TestCopyFromContainer(t *testing.T) {
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Assert(t, imageID != "")
 	assert.Assert(t, imageID != "")
 
 
-	cid := container.Create(t, ctx, apiClient, container.WithImage(imageID))
+	cid := container.Create(ctx, t, apiClient, container.WithImage(imageID))
 
 
 	for _, x := range []struct {
 	for _, x := range []struct {
 		src    string
 		src    string

+ 3 - 3
integration/container/daemon_linux_test.go

@@ -40,7 +40,7 @@ func TestContainerStartOnDaemonRestart(t *testing.T) {
 
 
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Create(t, ctx, c)
+	cID := container.Create(ctx, t, c)
 	defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
 	defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
 
 
 	err := c.ContainerStart(ctx, cID, types.ContainerStartOptions{})
 	err := c.ContainerStart(ctx, cID, types.ContainerStartOptions{})
@@ -94,7 +94,7 @@ func TestDaemonRestartIpcMode(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 
 
 	// check the container is created with private ipc mode as per daemon default
 	// check the container is created with private ipc mode as per daemon default
-	cID := container.Run(t, ctx, c,
+	cID := container.Run(ctx, t, c,
 		container.WithCmd("top"),
 		container.WithCmd("top"),
 		container.WithRestartPolicy("always"),
 		container.WithRestartPolicy("always"),
 	)
 	)
@@ -113,7 +113,7 @@ func TestDaemonRestartIpcMode(t *testing.T) {
 	assert.Check(t, is.Equal(string(inspect.HostConfig.IpcMode), "private"))
 	assert.Check(t, is.Equal(string(inspect.HostConfig.IpcMode), "private"))
 
 
 	// check a new container is created with shareable ipc mode as per new daemon default
 	// check a new container is created with shareable ipc mode as per new daemon default
-	cID = container.Run(t, ctx, c)
+	cID = container.Run(ctx, t, c)
 	defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
 	defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
 
 
 	inspect, err = c.ContainerInspect(ctx, cID)
 	inspect, err = c.ContainerInspect(ctx, cID)

+ 1 - 1
integration/container/diff_test.go

@@ -19,7 +19,7 @@ func TestDiff(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", `mkdir /foo; echo xyzzy > /foo/bar`))
+	cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", `mkdir /foo; echo xyzzy > /foo/bar`))
 
 
 	// Wait for it to exit as cannot diff a running container on Windows, and
 	// Wait for it to exit as cannot diff a running container on Windows, and
 	// it will take a few seconds to exit. Also there's no way in Windows to
 	// it will take a few seconds to exit. Also there's no way in Windows to

+ 3 - 3
integration/container/exec_test.go

@@ -24,7 +24,7 @@ func TestExecWithCloseStdin(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
 	// run top with detached mode
 	// run top with detached mode
-	cID := container.Run(t, ctx, client)
+	cID := container.Run(ctx, t, client)
 
 
 	expected := "closeIO"
 	expected := "closeIO"
 	execResp, err := client.ContainerExecCreate(ctx, cID,
 	execResp, err := client.ContainerExecCreate(ctx, cID,
@@ -90,7 +90,7 @@ func TestExec(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
-	cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/root"))
+	cID := container.Run(ctx, t, client, container.WithTty(true), container.WithWorkingDir("/root"))
 
 
 	id, err := client.ContainerExecCreate(ctx, cID,
 	id, err := client.ContainerExecCreate(ctx, cID,
 		types.ExecConfig{
 		types.ExecConfig{
@@ -125,7 +125,7 @@ func TestExecUser(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
-	cID := container.Run(t, ctx, client, container.WithTty(true), container.WithUser("1:1"))
+	cID := container.Run(ctx, t, client, container.WithTty(true), container.WithUser("1:1"))
 
 
 	result, err := container.Exec(ctx, client, cID, []string{"id"})
 	result, err := container.Exec(ctx, client, cID, []string{"id"})
 	assert.NilError(t, err)
 	assert.NilError(t, err)

+ 2 - 2
integration/container/export_test.go

@@ -25,7 +25,7 @@ func TestExportContainerAndImportImage(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client, container.WithCmd("true"))
+	cID := container.Run(ctx, t, client, container.WithCmd("true"))
 	poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
 
 
 	reference := "repo/testexp:v1"
 	reference := "repo/testexp:v1"
@@ -67,7 +67,7 @@ func TestExportContainerAfterDaemonRestart(t *testing.T) {
 	defer d.Stop(t)
 	defer d.Stop(t)
 
 
 	ctx := context.Background()
 	ctx := context.Background()
-	ctrID := container.Create(t, ctx, c)
+	ctrID := container.Create(ctx, t, c)
 
 
 	d.Restart(t)
 	d.Restart(t)
 
 

+ 2 - 2
integration/container/health_test.go

@@ -22,7 +22,7 @@ func TestHealthCheckWorkdir(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
-	cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
+	cID := container.Run(ctx, t, client, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
 		c.Config.Healthcheck = &containertypes.HealthConfig{
 		c.Config.Healthcheck = &containertypes.HealthConfig{
 			Test:     []string{"CMD-SHELL", "if [ \"$PWD\" = \"/foo\" ]; then exit 0; else exit 1; fi;"},
 			Test:     []string{"CMD-SHELL", "if [ \"$PWD\" = \"/foo\" ]; then exit 0; else exit 1; fi;"},
 			Interval: 50 * time.Millisecond,
 			Interval: 50 * time.Millisecond,
@@ -42,7 +42,7 @@ func TestHealthKillContainer(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
-	id := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
+	id := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
 		c.Config.Healthcheck = &containertypes.HealthConfig{
 		c.Config.Healthcheck = &containertypes.HealthConfig{
 			Test:     []string{"CMD-SHELL", "sleep 1"},
 			Test:     []string{"CMD-SHELL", "sleep 1"},
 			Interval: time.Second,
 			Interval: time.Second,

+ 1 - 1
integration/container/inspect_test.go

@@ -24,7 +24,7 @@ func TestInspectCpusetInConfigPre120(t *testing.T) {
 
 
 	name := "cpusetinconfig-pre120-" + t.Name()
 	name := "cpusetinconfig-pre120-" + t.Name()
 	// Create container with up to-date-API
 	// Create container with up to-date-API
-	container.Run(t, ctx, request.NewAPIClient(t), container.WithName(name),
+	container.Run(ctx, t, request.NewAPIClient(t), container.WithName(name),
 		container.WithCmd("true"),
 		container.WithCmd("true"),
 		func(c *container.TestContainerConfig) {
 		func(c *container.TestContainerConfig) {
 			c.HostConfig.Resources.CpusetCpus = "0"
 			c.HostConfig.Resources.CpusetCpus = "0"

+ 2 - 2
integration/container/ipcmode_linux_test.go

@@ -308,7 +308,7 @@ func TestIpcModeOlderClient(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 
 
 	// pre-check: default ipc mode in daemon is private
 	// pre-check: default ipc mode in daemon is private
-	cID := container.Create(t, ctx, c, container.WithAutoRemove)
+	cID := container.Create(ctx, t, c, container.WithAutoRemove)
 
 
 	inspect, err := c.ContainerInspect(ctx, cID)
 	inspect, err := c.ContainerInspect(ctx, cID)
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -316,7 +316,7 @@ func TestIpcModeOlderClient(t *testing.T) {
 
 
 	// main check: using older client creates "shareable" container
 	// main check: using older client creates "shareable" container
 	c = request.NewAPIClient(t, client.WithVersion("1.39"))
 	c = request.NewAPIClient(t, client.WithVersion("1.39"))
-	cID = container.Create(t, ctx, c, container.WithAutoRemove)
+	cID = container.Create(ctx, t, c, container.WithAutoRemove)
 
 
 	inspect, err = c.ContainerInspect(ctx, cID)
 	inspect, err = c.ContainerInspect(ctx, cID)
 	assert.NilError(t, err)
 	assert.NilError(t, err)

+ 8 - 8
integration/container/kill_test.go

@@ -18,7 +18,7 @@ func TestKillContainerInvalidSignal(t *testing.T) {
 	defer setupTest(t)()
 	defer setupTest(t)()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
-	id := container.Run(t, ctx, client)
+	id := container.Run(ctx, t, client)
 
 
 	err := client.ContainerKill(ctx, id, "0")
 	err := client.ContainerKill(ctx, id, "0")
 	assert.Error(t, err, "Error response from daemon: Invalid signal: 0")
 	assert.Error(t, err, "Error response from daemon: Invalid signal: 0")
@@ -60,7 +60,7 @@ func TestKillContainer(t *testing.T) {
 		tc := tc
 		tc := tc
 		t.Run(tc.doc, func(t *testing.T) {
 		t.Run(tc.doc, func(t *testing.T) {
 			ctx := context.Background()
 			ctx := context.Background()
-			id := container.Run(t, ctx, client)
+			id := container.Run(ctx, t, client)
 			err := client.ContainerKill(ctx, id, tc.signal)
 			err := client.ContainerKill(ctx, id, tc.signal)
 			assert.NilError(t, err)
 			assert.NilError(t, err)
 
 
@@ -95,7 +95,7 @@ func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
 		tc := tc
 		tc := tc
 		t.Run(tc.doc, func(t *testing.T) {
 		t.Run(tc.doc, func(t *testing.T) {
 			ctx := context.Background()
 			ctx := context.Background()
-			id := container.Run(t, ctx, client,
+			id := container.Run(ctx, t, client,
 				container.WithRestartPolicy("always"),
 				container.WithRestartPolicy("always"),
 				func(c *container.TestContainerConfig) {
 				func(c *container.TestContainerConfig) {
 					c.Config.StopSignal = tc.stopsignal
 					c.Config.StopSignal = tc.stopsignal
@@ -113,7 +113,7 @@ func TestKillStoppedContainer(t *testing.T) {
 	defer setupTest(t)()
 	defer setupTest(t)()
 	ctx := context.Background()
 	ctx := context.Background()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
-	id := container.Create(t, ctx, client)
+	id := container.Create(ctx, t, client)
 	err := client.ContainerKill(ctx, id, "SIGKILL")
 	err := client.ContainerKill(ctx, id, "SIGKILL")
 	assert.Assert(t, is.ErrorContains(err, ""))
 	assert.Assert(t, is.ErrorContains(err, ""))
 	assert.Assert(t, is.Contains(err.Error(), "is not running"))
 	assert.Assert(t, is.Contains(err.Error(), "is not running"))
@@ -124,7 +124,7 @@ func TestKillStoppedContainerAPIPre120(t *testing.T) {
 	defer setupTest(t)()
 	defer setupTest(t)()
 	ctx := context.Background()
 	ctx := context.Background()
 	client := request.NewAPIClient(t, client.WithVersion("1.19"))
 	client := request.NewAPIClient(t, client.WithVersion("1.19"))
-	id := container.Create(t, ctx, client)
+	id := container.Create(ctx, t, client)
 	err := client.ContainerKill(ctx, id, "SIGKILL")
 	err := client.ContainerKill(ctx, id, "SIGKILL")
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 }
 }
@@ -137,7 +137,7 @@ func TestKillDifferentUserContainer(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 	client := request.NewAPIClient(t, client.WithVersion("1.19"))
 	client := request.NewAPIClient(t, client.WithVersion("1.19"))
 
 
-	id := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
+	id := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
 		c.Config.User = "daemon"
 		c.Config.User = "daemon"
 	})
 	})
 	poll.WaitOn(t, container.IsInState(ctx, client, id, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, id, "running"), poll.WithDelay(100*time.Millisecond))
@@ -154,7 +154,7 @@ func TestInspectOomKilledTrue(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
-	cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "x=a; while true; do x=$x$x$x$x; done"), func(c *container.TestContainerConfig) {
+	cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", "x=a; while true; do x=$x$x$x$x; done"), func(c *container.TestContainerConfig) {
 		c.HostConfig.Resources.Memory = 32 * 1024 * 1024
 		c.HostConfig.Resources.Memory = 32 * 1024 * 1024
 	})
 	})
 
 
@@ -172,7 +172,7 @@ func TestInspectOomKilledFalse(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
-	cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "echo hello world"))
+	cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", "echo hello world"))
 
 
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
 
 

+ 3 - 3
integration/container/links_linux_test.go

@@ -24,7 +24,7 @@ func TestLinksEtcHostsContentMatch(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client, container.WithNetworkMode("host"))
+	cID := container.Run(ctx, t, client, container.WithNetworkMode("host"))
 	res, err := container.Exec(ctx, client, cID, []string{"cat", "/etc/hosts"})
 	res, err := container.Exec(ctx, client, cID, []string{"cat", "/etc/hosts"})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Assert(t, is.Len(res.Stderr(), 0))
 	assert.Assert(t, is.Len(res.Stderr(), 0))
@@ -42,8 +42,8 @@ func TestLinksContainerNames(t *testing.T) {
 
 
 	containerA := "first_" + t.Name()
 	containerA := "first_" + t.Name()
 	containerB := "second_" + t.Name()
 	containerB := "second_" + t.Name()
-	container.Run(t, ctx, client, container.WithName(containerA))
-	container.Run(t, ctx, client, container.WithName(containerB), container.WithLinks(containerA+":"+containerA))
+	container.Run(ctx, t, client, container.WithName(containerA))
+	container.Run(ctx, t, client, container.WithName(containerB), container.WithLinks(containerA+":"+containerA))
 
 
 	f := filters.NewArgs(filters.Arg("name", containerA))
 	f := filters.NewArgs(filters.Arg("name", containerA))
 
 

+ 1 - 1
integration/container/logs_test.go

@@ -21,7 +21,7 @@ func TestLogsFollowTailEmpty(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	id := container.Run(t, ctx, client, container.WithCmd("sleep", "100000"))
+	id := container.Run(ctx, t, client, container.WithCmd("sleep", "100000"))
 
 
 	logs, err := client.ContainerLogs(ctx, id, types.ContainerLogsOptions{ShowStdout: true, Tail: "2"})
 	logs, err := client.ContainerLogs(ctx, id, types.ContainerLogsOptions{ShowStdout: true, Tail: "2"})
 	if logs != nil {
 	if logs != nil {

+ 3 - 3
integration/container/mounts_linux_test.go

@@ -256,9 +256,9 @@ func TestContainerBindMountNonRecursive(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	containers := []string{
 	containers := []string{
-		container.Run(t, ctx, client, container.WithMount(implicit), container.WithCmd(recursiveVerifier...)),
-		container.Run(t, ctx, client, container.WithMount(recursive), container.WithCmd(recursiveVerifier...)),
-		container.Run(t, ctx, client, container.WithMount(nonRecursive), container.WithCmd(nonRecursiveVerifier...)),
+		container.Run(ctx, t, client, container.WithMount(implicit), container.WithCmd(recursiveVerifier...)),
+		container.Run(ctx, t, client, container.WithMount(recursive), container.WithCmd(recursiveVerifier...)),
+		container.Run(ctx, t, client, container.WithMount(nonRecursive), container.WithCmd(nonRecursiveVerifier...)),
 	}
 	}
 
 
 	for _, c := range containers {
 	for _, c := range containers {

+ 2 - 2
integration/container/nat_test.go

@@ -71,7 +71,7 @@ func TestNetworkLoopbackNat(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", fmt.Sprintf("stty raw && nc -w 5 %s 8080", endpoint.String())), container.WithTty(true), container.WithNetworkMode("container:"+serverContainerID))
+	cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", fmt.Sprintf("stty raw && nc -w 5 %s 8080", endpoint.String())), container.WithTty(true), container.WithNetworkMode("container:"+serverContainerID))
 
 
 	poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
 
 
@@ -93,7 +93,7 @@ func startServerContainer(t *testing.T, msg string, port int) string {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client, container.WithName("server-"+t.Name()), container.WithCmd("sh", "-c", fmt.Sprintf("echo %q | nc -lp %d", msg, port)), container.WithExposedPorts(fmt.Sprintf("%d/tcp", port)), func(c *container.TestContainerConfig) {
+	cID := container.Run(ctx, t, client, container.WithName("server-"+t.Name()), container.WithCmd("sh", "-c", fmt.Sprintf("echo %q | nc -lp %d", msg, port)), container.WithExposedPorts(fmt.Sprintf("%d/tcp", port)), func(c *container.TestContainerConfig) {
 		c.HostConfig.PortBindings = nat.PortMap{
 		c.HostConfig.PortBindings = nat.PortMap{
 			nat.Port(fmt.Sprintf("%d/tcp", port)): []nat.PortBinding{
 			nat.Port(fmt.Sprintf("%d/tcp", port)): []nat.PortBinding{
 				{
 				{

+ 3 - 3
integration/container/pause_test.go

@@ -25,7 +25,7 @@ func TestPause(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client)
+	cID := container.Run(ctx, t, client)
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 
 
 	since := request.DaemonUnixTime(ctx, t, client, testEnv)
 	since := request.DaemonUnixTime(ctx, t, client, testEnv)
@@ -57,7 +57,7 @@ func TestPauseFailsOnWindowsServerContainers(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client)
+	cID := container.Run(ctx, t, client)
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 
 
 	err := client.ContainerPause(ctx, cID)
 	err := client.ContainerPause(ctx, cID)
@@ -71,7 +71,7 @@ func TestPauseStopPausedContainer(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client)
+	cID := container.Run(ctx, t, client)
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 
 
 	err := client.ContainerPause(ctx, cID)
 	err := client.ContainerPause(ctx, cID)

+ 3 - 3
integration/container/ps_test.go

@@ -16,9 +16,9 @@ func TestPsFilter(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	prev := container.Create(t, ctx, client)
-	top := container.Create(t, ctx, client)
-	next := container.Create(t, ctx, client)
+	prev := container.Create(ctx, t, client)
+	top := container.Create(ctx, t, client)
+	next := container.Create(ctx, t, client)
 
 
 	containerIDs := func(containers []types.Container) []string {
 	containerIDs := func(containers []types.Container) []string {
 		var entries []string
 		var entries []string

+ 4 - 4
integration/container/remove_test.go

@@ -36,7 +36,7 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
 	tempDir := fs.NewDir(t, "test-rm-container-with-removed-volume", fs.WithMode(0755))
 	tempDir := fs.NewDir(t, "test-rm-container-with-removed-volume", fs.WithMode(0755))
 	defer tempDir.Remove()
 	defer tempDir.Remove()
 
 
-	cID := container.Run(t, ctx, client, container.WithCmd("true"), container.WithBind(tempDir.Path(), prefix+slash+"test"))
+	cID := container.Run(ctx, t, client, container.WithCmd("true"), container.WithBind(tempDir.Path(), prefix+slash+"test"))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
 
 
 	err := os.RemoveAll(tempDir.Path())
 	err := os.RemoveAll(tempDir.Path())
@@ -59,7 +59,7 @@ func TestRemoveContainerWithVolume(t *testing.T) {
 
 
 	prefix, slash := getPrefixAndSlashFromDaemonPlatform()
 	prefix, slash := getPrefixAndSlashFromDaemonPlatform()
 
 
-	cID := container.Run(t, ctx, client, container.WithCmd("true"), container.WithVolume(prefix+slash+"srv"))
+	cID := container.Run(ctx, t, client, container.WithCmd("true"), container.WithVolume(prefix+slash+"srv"))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
 
 
 	insp, _, err := client.ContainerInspectWithRaw(ctx, cID, true)
 	insp, _, err := client.ContainerInspectWithRaw(ctx, cID, true)
@@ -82,7 +82,7 @@ func TestRemoveContainerRunning(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
-	cID := container.Run(t, ctx, client)
+	cID := container.Run(ctx, t, client)
 
 
 	err := client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{})
 	err := client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{})
 	assert.Check(t, is.ErrorContains(err, "cannot remove a running container"))
 	assert.Check(t, is.ErrorContains(err, "cannot remove a running container"))
@@ -93,7 +93,7 @@ func TestRemoveContainerForceRemoveRunning(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
-	cID := container.Run(t, ctx, client)
+	cID := container.Run(ctx, t, client)
 
 
 	err := client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
 	err := client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
 		Force: true,
 		Force: true,

+ 13 - 13
integration/container/rename_test.go

@@ -30,18 +30,18 @@ func TestRenameLinkedContainer(t *testing.T) {
 
 
 	aName := "a0" + t.Name()
 	aName := "a0" + t.Name()
 	bName := "b0" + t.Name()
 	bName := "b0" + t.Name()
-	aID := container.Run(t, ctx, client, container.WithName(aName))
-	bID := container.Run(t, ctx, client, container.WithName(bName), container.WithLinks(aName))
+	aID := container.Run(ctx, t, client, container.WithName(aName))
+	bID := container.Run(ctx, t, client, container.WithName(bName), container.WithLinks(aName))
 
 
 	err := client.ContainerRename(ctx, aID, "a1"+t.Name())
 	err := client.ContainerRename(ctx, aID, "a1"+t.Name())
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
-	container.Run(t, ctx, client, container.WithName(aName))
+	container.Run(ctx, t, client, container.WithName(aName))
 
 
 	err = client.ContainerRemove(ctx, bID, types.ContainerRemoveOptions{Force: true})
 	err = client.ContainerRemove(ctx, bID, types.ContainerRemoveOptions{Force: true})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
-	bID = container.Run(t, ctx, client, container.WithName(bName), container.WithLinks(aName))
+	bID = container.Run(ctx, t, client, container.WithName(bName), container.WithLinks(aName))
 
 
 	inspect, err := client.ContainerInspect(ctx, bID)
 	inspect, err := client.ContainerInspect(ctx, bID)
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -54,7 +54,7 @@ func TestRenameStoppedContainer(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
 	oldName := "first_name" + t.Name()
 	oldName := "first_name" + t.Name()
-	cID := container.Run(t, ctx, client, container.WithName(oldName), container.WithCmd("sh"))
+	cID := container.Run(ctx, t, client, container.WithName(oldName), container.WithCmd("sh"))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
 
 
 	inspect, err := client.ContainerInspect(ctx, cID)
 	inspect, err := client.ContainerInspect(ctx, cID)
@@ -76,7 +76,7 @@ func TestRenameRunningContainerAndReuse(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
 	oldName := "first_name" + t.Name()
 	oldName := "first_name" + t.Name()
-	cID := container.Run(t, ctx, client, container.WithName(oldName))
+	cID := container.Run(ctx, t, client, container.WithName(oldName))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 
 
 	newName := "new_name" + stringid.GenerateRandomID()
 	newName := "new_name" + stringid.GenerateRandomID()
@@ -90,7 +90,7 @@ func TestRenameRunningContainerAndReuse(t *testing.T) {
 	_, err = client.ContainerInspect(ctx, oldName)
 	_, err = client.ContainerInspect(ctx, oldName)
 	assert.Check(t, is.ErrorContains(err, "No such container: "+oldName))
 	assert.Check(t, is.ErrorContains(err, "No such container: "+oldName))
 
 
-	cID = container.Run(t, ctx, client, container.WithName(oldName))
+	cID = container.Run(ctx, t, client, container.WithName(oldName))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 
 
 	inspect, err = client.ContainerInspect(ctx, cID)
 	inspect, err = client.ContainerInspect(ctx, cID)
@@ -104,7 +104,7 @@ func TestRenameInvalidName(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
 	oldName := "first_name" + t.Name()
 	oldName := "first_name" + t.Name()
-	cID := container.Run(t, ctx, client, container.WithName(oldName))
+	cID := container.Run(ctx, t, client, container.WithName(oldName))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 
 
 	err := client.ContainerRename(ctx, oldName, "new:invalid")
 	err := client.ContainerRename(ctx, oldName, "new:invalid")
@@ -132,7 +132,7 @@ func TestRenameAnonymousContainer(t *testing.T) {
 	_, err := client.NetworkCreate(ctx, networkName, types.NetworkCreate{})
 	_, err := client.NetworkCreate(ctx, networkName, types.NetworkCreate{})
 
 
 	assert.NilError(t, err)
 	assert.NilError(t, err)
-	cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
+	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
 		c.NetworkingConfig.EndpointsConfig = map[string]*network.EndpointSettings{
 		c.NetworkingConfig.EndpointsConfig = map[string]*network.EndpointSettings{
 			networkName: {},
 			networkName: {},
 		}
 		}
@@ -155,7 +155,7 @@ func TestRenameAnonymousContainer(t *testing.T) {
 	if testEnv.OSType == "windows" {
 	if testEnv.OSType == "windows" {
 		count = "-n"
 		count = "-n"
 	}
 	}
-	cID = container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
+	cID = container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
 		c.NetworkingConfig.EndpointsConfig = map[string]*network.EndpointSettings{
 		c.NetworkingConfig.EndpointsConfig = map[string]*network.EndpointSettings{
 			networkName: {},
 			networkName: {},
 		}
 		}
@@ -175,7 +175,7 @@ func TestRenameContainerWithSameName(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
 	oldName := "old" + t.Name()
 	oldName := "old" + t.Name()
-	cID := container.Run(t, ctx, client, container.WithName(oldName))
+	cID := container.Run(ctx, t, client, container.WithName(oldName))
 
 
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 	err := client.ContainerRename(ctx, oldName, oldName)
 	err := client.ContainerRename(ctx, oldName, oldName)
@@ -198,12 +198,12 @@ func TestRenameContainerWithLinkedContainer(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
 	db1Name := "db1" + t.Name()
 	db1Name := "db1" + t.Name()
-	db1ID := container.Run(t, ctx, client, container.WithName(db1Name))
+	db1ID := container.Run(ctx, t, client, container.WithName(db1Name))
 	poll.WaitOn(t, container.IsInState(ctx, client, db1ID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, db1ID, "running"), poll.WithDelay(100*time.Millisecond))
 
 
 	app1Name := "app1" + t.Name()
 	app1Name := "app1" + t.Name()
 	app2Name := "app2" + t.Name()
 	app2Name := "app2" + t.Name()
-	app1ID := container.Run(t, ctx, client, container.WithName(app1Name), container.WithLinks(db1Name+":/mysql"))
+	app1ID := container.Run(ctx, t, client, container.WithName(app1Name), container.WithLinks(db1Name+":/mysql"))
 	poll.WaitOn(t, container.IsInState(ctx, client, app1ID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, app1ID, "running"), poll.WithDelay(100*time.Millisecond))
 
 
 	err := client.ContainerRename(ctx, app1Name, app2Name)
 	err := client.ContainerRename(ctx, app1Name, app2Name)

+ 3 - 3
integration/container/resize_test.go

@@ -22,7 +22,7 @@ func TestResize(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client)
+	cID := container.Run(ctx, t, client)
 
 
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 
 
@@ -40,7 +40,7 @@ func TestResizeWithInvalidSize(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client)
+	cID := container.Run(ctx, t, client)
 
 
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 
 
@@ -55,7 +55,7 @@ func TestResizeWhenContainerNotStarted(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client, container.WithCmd("echo"))
+	cID := container.Run(ctx, t, client, container.WithCmd("echo"))
 
 
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
 
 

+ 2 - 2
integration/container/run_linux_test.go

@@ -29,7 +29,7 @@ func TestKernelTCPMemory(t *testing.T) {
 		kernelMemoryTCP int64 = 200 * 1024 * 1024
 		kernelMemoryTCP int64 = 200 * 1024 * 1024
 	)
 	)
 
 
-	cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
+	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
 		c.HostConfig.Resources = containertypes.Resources{
 		c.HostConfig.Resources = containertypes.Resources{
 			KernelMemoryTCP: kernelMemoryTCP,
 			KernelMemoryTCP: kernelMemoryTCP,
 		}
 		}
@@ -65,7 +65,7 @@ func TestNISDomainname(t *testing.T) {
 		domainname = "baz.cyphar.com"
 		domainname = "baz.cyphar.com"
 	)
 	)
 
 
-	cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
+	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
 		c.Config.Hostname = hostname
 		c.Config.Hostname = hostname
 		c.Config.Domainname = domainname
 		c.Config.Domainname = domainname
 	})
 	})

+ 1 - 1
integration/container/stats_test.go

@@ -25,7 +25,7 @@ func TestStats(t *testing.T) {
 	info, err := client.Info(ctx)
 	info, err := client.Info(ctx)
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
-	cID := container.Run(t, ctx, client)
+	cID := container.Run(ctx, t, client)
 
 
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 
 

+ 2 - 2
integration/container/stop_linux_test.go

@@ -54,7 +54,7 @@ func TestStopContainerWithTimeout(t *testing.T) {
 		d := d
 		d := d
 		t.Run(strconv.Itoa(d.timeout), func(t *testing.T) {
 		t.Run(strconv.Itoa(d.timeout), func(t *testing.T) {
 			t.Parallel()
 			t.Parallel()
-			id := container.Run(t, ctx, client, testCmd)
+			id := container.Run(ctx, t, client, testCmd)
 
 
 			timeout := time.Duration(d.timeout) * time.Second
 			timeout := time.Duration(d.timeout) * time.Second
 			err := client.ContainerStop(ctx, id, &timeout)
 			err := client.ContainerStop(ctx, id, &timeout)
@@ -78,7 +78,7 @@ func TestDeleteDevicemapper(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	id := container.Run(t, ctx, client, container.WithName("foo-"+t.Name()), container.WithCmd("echo"))
+	id := container.Run(ctx, t, client, container.WithName("foo-"+t.Name()), container.WithCmd("echo"))
 
 
 	poll.WaitOn(t, container.IsStopped(ctx, client, id), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsStopped(ctx, client, id), poll.WithDelay(100*time.Millisecond))
 
 

+ 1 - 1
integration/container/stop_test.go

@@ -17,7 +17,7 @@ func TestStopContainerWithRestartPolicyAlways(t *testing.T) {
 
 
 	names := []string{"verifyRestart1-" + t.Name(), "verifyRestart2-" + t.Name()}
 	names := []string{"verifyRestart1-" + t.Name(), "verifyRestart2-" + t.Name()}
 	for _, name := range names {
 	for _, name := range names {
-		container.Run(t, ctx, client,
+		container.Run(ctx, t, client,
 			container.WithName(name),
 			container.WithName(name),
 			container.WithCmd("false"),
 			container.WithCmd("false"),
 			container.WithRestartPolicy("always"),
 			container.WithRestartPolicy("always"),

+ 1 - 1
integration/container/stop_windows_test.go

@@ -51,7 +51,7 @@ func TestStopContainerWithTimeout(t *testing.T) {
 		d := d
 		d := d
 		t.Run(strconv.Itoa(d.timeout), func(t *testing.T) {
 		t.Run(strconv.Itoa(d.timeout), func(t *testing.T) {
 			t.Parallel()
 			t.Parallel()
-			id := container.Run(t, ctx, client, testCmd)
+			id := container.Run(ctx, t, client, testCmd)
 
 
 			timeout := time.Duration(d.timeout) * time.Second
 			timeout := time.Duration(d.timeout) * time.Second
 			err := client.ContainerStop(ctx, id, &timeout)
 			err := client.ContainerStop(ctx, id, &timeout)

+ 3 - 3
integration/container/update_linux_test.go

@@ -26,7 +26,7 @@ func TestUpdateMemory(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
+	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
 		c.HostConfig.Resources = containertypes.Resources{
 		c.HostConfig.Resources = containertypes.Resources{
 			Memory: 200 * 1024 * 1024,
 			Memory: 200 * 1024 * 1024,
 		}
 		}
@@ -72,7 +72,7 @@ func TestUpdateCPUQuota(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client)
+	cID := container.Run(ctx, t, client)
 
 
 	for _, test := range []struct {
 	for _, test := range []struct {
 		desc   string
 		desc   string
@@ -140,7 +140,7 @@ func TestUpdatePidsLimit(t *testing.T) {
 
 
 		t.Run(test.desc, func(t *testing.T) {
 		t.Run(test.desc, func(t *testing.T) {
 			// Using "network=host" to speed up creation (13.96s vs 6.54s)
 			// Using "network=host" to speed up creation (13.96s vs 6.54s)
-			cID := container.Run(t, ctx, apiClient, container.WithPidsLimit(test.initial), container.WithNetworkMode("host"))
+			cID := container.Run(ctx, t, apiClient, container.WithPidsLimit(test.initial), container.WithNetworkMode("host"))
 
 
 			_, err := c.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
 			_, err := c.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
 				Resources: containertypes.Resources{
 				Resources: containertypes.Resources{

+ 2 - 2
integration/container/update_test.go

@@ -17,7 +17,7 @@ func TestUpdateRestartPolicy(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "sleep 1 && false"), func(c *container.TestContainerConfig) {
+	cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", "sleep 1 && false"), func(c *container.TestContainerConfig) {
 		c.HostConfig.RestartPolicy = containertypes.RestartPolicy{
 		c.HostConfig.RestartPolicy = containertypes.RestartPolicy{
 			Name:              "on-failure",
 			Name:              "on-failure",
 			MaximumRetryCount: 3,
 			MaximumRetryCount: 3,
@@ -50,7 +50,7 @@ func TestUpdateRestartWithAutoRemove(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, client, container.WithAutoRemove)
+	cID := container.Run(ctx, t, client, container.WithAutoRemove)
 
 
 	_, err := client.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
 	_, err := client.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
 		RestartPolicy: containertypes.RestartPolicy{
 		RestartPolicy: containertypes.RestartPolicy{

+ 2 - 2
integration/container/wait_test.go

@@ -39,7 +39,7 @@ func TestWaitNonBlocked(t *testing.T) {
 		t.Run(tc.doc, func(t *testing.T) {
 		t.Run(tc.doc, func(t *testing.T) {
 			t.Parallel()
 			t.Parallel()
 			ctx := context.Background()
 			ctx := context.Background()
-			containerID := container.Run(t, ctx, cli, container.WithCmd("sh", "-c", tc.cmd))
+			containerID := container.Run(ctx, t, cli, container.WithCmd("sh", "-c", tc.cmd))
 			poll.WaitOn(t, container.IsInState(ctx, cli, containerID, "exited"), poll.WithTimeout(30*time.Second), poll.WithDelay(100*time.Millisecond))
 			poll.WaitOn(t, container.IsInState(ctx, cli, containerID, "exited"), poll.WithTimeout(30*time.Second), poll.WithDelay(100*time.Millisecond))
 
 
 			waitresC, errC := cli.ContainerWait(ctx, containerID, "")
 			waitresC, errC := cli.ContainerWait(ctx, containerID, "")
@@ -81,7 +81,7 @@ func TestWaitBlocked(t *testing.T) {
 		t.Run(tc.doc, func(t *testing.T) {
 		t.Run(tc.doc, func(t *testing.T) {
 			t.Parallel()
 			t.Parallel()
 			ctx := context.Background()
 			ctx := context.Background()
-			containerID := container.Run(t, ctx, cli, container.WithCmd("sh", "-c", tc.cmd))
+			containerID := container.Run(ctx, t, cli, container.WithCmd("sh", "-c", tc.cmd))
 			poll.WaitOn(t, container.IsInState(ctx, cli, containerID, "running"), poll.WithTimeout(30*time.Second), poll.WithDelay(100*time.Millisecond))
 			poll.WaitOn(t, container.IsInState(ctx, cli, containerID, "running"), poll.WithTimeout(30*time.Second), poll.WithDelay(100*time.Millisecond))
 
 
 			waitresC, errC := cli.ContainerWait(ctx, containerID, "")
 			waitresC, errC := cli.ContainerWait(ctx, containerID, "")

+ 2 - 2
integration/image/commit_test.go

@@ -19,7 +19,7 @@ func TestCommitInheritsEnv(t *testing.T) {
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID1 := container.Create(t, ctx, client)
+	cID1 := container.Create(ctx, t, client)
 
 
 	commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
 	commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
 		Changes:   []string{"ENV PATH=/bin"},
 		Changes:   []string{"ENV PATH=/bin"},
@@ -33,7 +33,7 @@ func TestCommitInheritsEnv(t *testing.T) {
 	expectedEnv1 := []string{"PATH=/bin"}
 	expectedEnv1 := []string{"PATH=/bin"}
 	assert.Check(t, is.DeepEqual(expectedEnv1, image1.Config.Env))
 	assert.Check(t, is.DeepEqual(expectedEnv1, image1.Config.Env))
 
 
-	cID2 := container.Create(t, ctx, client, container.WithImage(image1.ID))
+	cID2 := container.Create(ctx, t, client, container.WithImage(image1.ID))
 
 
 	commitResp2, err := client.ContainerCommit(ctx, cID2, types.ContainerCommitOptions{
 	commitResp2, err := client.ContainerCommit(ctx, cID2, types.ContainerCommitOptions{
 		Changes:   []string{"ENV PATH=/usr/bin:$PATH"},
 		Changes:   []string{"ENV PATH=/usr/bin:$PATH"},

+ 2 - 2
integration/image/remove_test.go

@@ -20,7 +20,7 @@ func TestRemoveImageOrphaning(t *testing.T) {
 	img := "test-container-orphaning"
 	img := "test-container-orphaning"
 
 
 	// Create a container from busybox, and commit a small change so we have a new image
 	// Create a container from busybox, and commit a small change so we have a new image
-	cID1 := container.Create(t, ctx, client, container.WithCmd(""))
+	cID1 := container.Create(ctx, t, client, container.WithCmd(""))
 	commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
 	commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
 		Changes:   []string{`ENTRYPOINT ["true"]`},
 		Changes:   []string{`ENTRYPOINT ["true"]`},
 		Reference: img,
 		Reference: img,
@@ -33,7 +33,7 @@ func TestRemoveImageOrphaning(t *testing.T) {
 	assert.Check(t, is.Equal(resp.ID, commitResp1.ID))
 	assert.Check(t, is.Equal(resp.ID, commitResp1.ID))
 
 
 	// Create a container from created image, and commit a small change with same reference name
 	// Create a container from created image, and commit a small change with same reference name
-	cID2 := container.Create(t, ctx, client, container.WithImage(img), container.WithCmd(""))
+	cID2 := container.Create(ctx, t, client, container.WithImage(img), container.WithCmd(""))
 	commitResp2, err := client.ContainerCommit(ctx, cID2, types.ContainerCommitOptions{
 	commitResp2, err := client.ContainerCommit(ctx, cID2, types.ContainerCommitOptions{
 		Changes:   []string{`LABEL Maintainer="Integration Tests"`},
 		Changes:   []string{`LABEL Maintainer="Integration Tests"`},
 		Reference: img,
 		Reference: img,

+ 3 - 5
integration/internal/container/container.go

@@ -22,8 +22,7 @@ type TestContainerConfig struct {
 }
 }
 
 
 // Create creates a container with the specified options
 // Create creates a container with the specified options
-// nolint: golint
-func Create(t *testing.T, ctx context.Context, client client.APIClient, ops ...func(*TestContainerConfig)) string { // nolint: golint
+func Create(ctx context.Context, t *testing.T, client client.APIClient, ops ...func(*TestContainerConfig)) string {
 	t.Helper()
 	t.Helper()
 	cmd := []string{"top"}
 	cmd := []string{"top"}
 	if runtime.GOOS == "windows" {
 	if runtime.GOOS == "windows" {
@@ -49,10 +48,9 @@ func Create(t *testing.T, ctx context.Context, client client.APIClient, ops ...f
 }
 }
 
 
 // Run creates and start a container with the specified options
 // Run creates and start a container with the specified options
-// nolint: golint
-func Run(t *testing.T, ctx context.Context, client client.APIClient, ops ...func(*TestContainerConfig)) string { // nolint: golint
+func Run(ctx context.Context, t *testing.T, client client.APIClient, ops ...func(*TestContainerConfig)) string {
 	t.Helper()
 	t.Helper()
-	id := Create(t, ctx, client, ops...)
+	id := Create(ctx, t, client, ops...)
 
 
 	err := client.ContainerStart(ctx, id, types.ContainerStartOptions{})
 	err := client.ContainerStart(ctx, id, types.ContainerStartOptions{})
 	assert.NilError(t, err)
 	assert.NilError(t, err)

+ 1 - 2
integration/internal/network/network.go

@@ -26,8 +26,7 @@ func Create(ctx context.Context, client client.APIClient, name string, ops ...fu
 }
 }
 
 
 // CreateNoError creates a network with the specified options and verifies there were no errors
 // CreateNoError creates a network with the specified options and verifies there were no errors
-// nolint: golint
-func CreateNoError(t *testing.T, ctx context.Context, client client.APIClient, name string, ops ...func(*types.NetworkCreate)) string { // nolint: golint
+func CreateNoError(ctx context.Context, t *testing.T, client client.APIClient, name string, ops ...func(*types.NetworkCreate)) string { // nolint: golint
 	t.Helper()
 	t.Helper()
 
 
 	name, err := createNetwork(ctx, client, name, ops...)
 	name, err := createNetwork(ctx, client, name, ops...)

+ 6 - 6
integration/network/delete_test.go

@@ -27,10 +27,10 @@ func containsNetwork(nws []types.NetworkResource, networkID string) bool {
 // first network's ID as name.
 // first network's ID as name.
 //
 //
 // After successful creation, properties of all three networks is returned
 // After successful creation, properties of all three networks is returned
-func createAmbiguousNetworks(t *testing.T, ctx context.Context, client dclient.APIClient) (string, string, string) { // nolint: golint
-	testNet := network.CreateNoError(t, ctx, client, "testNet")
-	idPrefixNet := network.CreateNoError(t, ctx, client, testNet[:12])
-	fullIDNet := network.CreateNoError(t, ctx, client, testNet)
+func createAmbiguousNetworks(ctx context.Context, t *testing.T, client dclient.APIClient) (string, string, string) {
+	testNet := network.CreateNoError(ctx, t, client, "testNet")
+	idPrefixNet := network.CreateNoError(ctx, t, client, testNet[:12])
+	fullIDNet := network.CreateNoError(ctx, t, client, testNet)
 
 
 	nws, err := client.NetworkList(ctx, types.NetworkListOptions{})
 	nws, err := client.NetworkList(ctx, types.NetworkListOptions{})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -49,7 +49,7 @@ func TestNetworkCreateDelete(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 
 
 	netName := "testnetwork_" + t.Name()
 	netName := "testnetwork_" + t.Name()
-	network.CreateNoError(t, ctx, client, netName,
+	network.CreateNoError(ctx, t, client, netName,
 		network.WithCheckDuplicate(),
 		network.WithCheckDuplicate(),
 	)
 	)
 	assert.Check(t, IsNetworkAvailable(client, netName))
 	assert.Check(t, IsNetworkAvailable(client, netName))
@@ -70,7 +70,7 @@ func TestDockerNetworkDeletePreferID(t *testing.T) {
 	defer setupTest(t)()
 	defer setupTest(t)()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 	ctx := context.Background()
 	ctx := context.Background()
-	testNet, idPrefixNet, fullIDNet := createAmbiguousNetworks(t, ctx, client)
+	testNet, idPrefixNet, fullIDNet := createAmbiguousNetworks(ctx, t, client)
 
 
 	// Delete the network using a prefix of the first network's ID as name.
 	// Delete the network using a prefix of the first network's ID as name.
 	// This should the network name with the id-prefix, not the original network.
 	// This should the network name with the id-prefix, not the original network.

+ 1 - 1
integration/network/inspect_test.go

@@ -21,7 +21,7 @@ func TestInspectNetwork(t *testing.T) {
 	defer c.Close()
 	defer c.Close()
 
 
 	networkName := "Overlay" + t.Name()
 	networkName := "Overlay" + t.Name()
-	overlayID := network.CreateNoError(t, context.Background(), c, networkName,
+	overlayID := network.CreateNoError(context.Background(), t, c, networkName,
 		network.WithDriver("overlay"),
 		network.WithDriver("overlay"),
 		network.WithCheckDuplicate(),
 		network.WithCheckDuplicate(),
 	)
 	)

+ 29 - 29
integration/network/ipvlan/ipvlan_test.go

@@ -39,7 +39,7 @@ func TestDockerNetworkIpvlanPersistance(t *testing.T) {
 
 
 	// create a network specifying the desired sub-interface name
 	// create a network specifying the desired sub-interface name
 	netName := "di-persist"
 	netName := "di-persist"
-	net.CreateNoError(t, context.Background(), c, netName,
+	net.CreateNoError(context.Background(), t, c, netName,
 		net.WithIPvlan("di-dummy0.70", ""),
 		net.WithIPvlan("di-dummy0.70", ""),
 	)
 	)
 
 
@@ -105,7 +105,7 @@ func testIpvlanSubinterface(client dclient.APIClient) func(*testing.T) {
 		defer n.DeleteInterface(t, master)
 		defer n.DeleteInterface(t, master)
 
 
 		netName := "di-subinterface"
 		netName := "di-subinterface"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithIPvlan("di-dummy0.60", ""),
 			net.WithIPvlan("di-dummy0.60", ""),
 		)
 		)
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
@@ -130,7 +130,7 @@ func testIpvlanOverlapParent(client dclient.APIClient) func(*testing.T) {
 		n.CreateVlanInterface(t, master, parent, "30")
 		n.CreateVlanInterface(t, master, parent, "30")
 
 
 		netName := "di-subinterface"
 		netName := "di-subinterface"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithIPvlan(parent, ""),
 			net.WithIPvlan(parent, ""),
 		)
 		)
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
@@ -147,14 +147,14 @@ func testIpvlanL2NilParent(client dclient.APIClient) func(*testing.T) {
 	return func(t *testing.T) {
 	return func(t *testing.T) {
 		// ipvlan l2 mode - dummy parent interface is provisioned dynamically
 		// ipvlan l2 mode - dummy parent interface is provisioned dynamically
 		netName := "di-nil-parent"
 		netName := "di-nil-parent"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithIPvlan("", ""),
 			net.WithIPvlan("", ""),
 		)
 		)
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 
 
 		ctx := context.Background()
 		ctx := context.Background()
-		id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
-		id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
+		id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
+		id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
 
 
 		_, err := container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
 		_, err := container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
 		assert.NilError(t, err)
 		assert.NilError(t, err)
@@ -164,15 +164,15 @@ func testIpvlanL2NilParent(client dclient.APIClient) func(*testing.T) {
 func testIpvlanL2InternalMode(client dclient.APIClient) func(*testing.T) {
 func testIpvlanL2InternalMode(client dclient.APIClient) func(*testing.T) {
 	return func(t *testing.T) {
 	return func(t *testing.T) {
 		netName := "di-internal"
 		netName := "di-internal"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithIPvlan("", ""),
 			net.WithIPvlan("", ""),
 			net.WithInternal(),
 			net.WithInternal(),
 		)
 		)
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 
 
 		ctx := context.Background()
 		ctx := context.Background()
-		id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
-		id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
+		id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
+		id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
 
 
 		timeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
 		timeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
 		defer cancel()
 		defer cancel()
@@ -189,7 +189,7 @@ func testIpvlanL2InternalMode(client dclient.APIClient) func(*testing.T) {
 func testIpvlanL3NilParent(client dclient.APIClient) func(*testing.T) {
 func testIpvlanL3NilParent(client dclient.APIClient) func(*testing.T) {
 	return func(t *testing.T) {
 	return func(t *testing.T) {
 		netName := "di-nil-parent-l3"
 		netName := "di-nil-parent-l3"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithIPvlan("", "l3"),
 			net.WithIPvlan("", "l3"),
 			net.WithIPAM("172.28.230.0/24", ""),
 			net.WithIPAM("172.28.230.0/24", ""),
 			net.WithIPAM("172.28.220.0/24", ""),
 			net.WithIPAM("172.28.220.0/24", ""),
@@ -197,11 +197,11 @@ func testIpvlanL3NilParent(client dclient.APIClient) func(*testing.T) {
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 
 
 		ctx := context.Background()
 		ctx := context.Background()
-		id1 := container.Run(t, ctx, client,
+		id1 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netName),
 			container.WithNetworkMode(netName),
 			container.WithIPv4(netName, "172.28.220.10"),
 			container.WithIPv4(netName, "172.28.220.10"),
 		)
 		)
-		id2 := container.Run(t, ctx, client,
+		id2 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netName),
 			container.WithNetworkMode(netName),
 			container.WithIPv4(netName, "172.28.230.10"),
 			container.WithIPv4(netName, "172.28.230.10"),
 		)
 		)
@@ -214,7 +214,7 @@ func testIpvlanL3NilParent(client dclient.APIClient) func(*testing.T) {
 func testIpvlanL3InternalMode(client dclient.APIClient) func(*testing.T) {
 func testIpvlanL3InternalMode(client dclient.APIClient) func(*testing.T) {
 	return func(t *testing.T) {
 	return func(t *testing.T) {
 		netName := "di-internal-l3"
 		netName := "di-internal-l3"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithIPvlan("", "l3"),
 			net.WithIPvlan("", "l3"),
 			net.WithInternal(),
 			net.WithInternal(),
 			net.WithIPAM("172.28.230.0/24", ""),
 			net.WithIPAM("172.28.230.0/24", ""),
@@ -223,11 +223,11 @@ func testIpvlanL3InternalMode(client dclient.APIClient) func(*testing.T) {
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 
 
 		ctx := context.Background()
 		ctx := context.Background()
-		id1 := container.Run(t, ctx, client,
+		id1 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netName),
 			container.WithNetworkMode(netName),
 			container.WithIPv4(netName, "172.28.220.10"),
 			container.WithIPv4(netName, "172.28.220.10"),
 		)
 		)
-		id2 := container.Run(t, ctx, client,
+		id2 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netName),
 			container.WithNetworkMode(netName),
 			container.WithIPv4(netName, "172.28.230.10"),
 			container.WithIPv4(netName, "172.28.230.10"),
 		)
 		)
@@ -247,7 +247,7 @@ func testIpvlanL3InternalMode(client dclient.APIClient) func(*testing.T) {
 func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
 func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
 	return func(t *testing.T) {
 	return func(t *testing.T) {
 		netName := "dualstackl2"
 		netName := "dualstackl2"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithIPvlan("", ""),
 			net.WithIPvlan("", ""),
 			net.WithIPv6(),
 			net.WithIPv6(),
 			net.WithIPAM("172.28.200.0/24", ""),
 			net.WithIPAM("172.28.200.0/24", ""),
@@ -259,12 +259,12 @@ func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
 
 
 		// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64
 		// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64
 		ctx := context.Background()
 		ctx := context.Background()
-		id1 := container.Run(t, ctx, client,
+		id1 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netName),
 			container.WithNetworkMode(netName),
 			container.WithIPv4(netName, "172.28.200.20"),
 			container.WithIPv4(netName, "172.28.200.20"),
 			container.WithIPv6(netName, "2001:db8:abc8::20"),
 			container.WithIPv6(netName, "2001:db8:abc8::20"),
 		)
 		)
-		id2 := container.Run(t, ctx, client,
+		id2 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netName),
 			container.WithNetworkMode(netName),
 			container.WithIPv4(netName, "172.28.200.21"),
 			container.WithIPv4(netName, "172.28.200.21"),
 			container.WithIPv6(netName, "2001:db8:abc8::21"),
 			container.WithIPv6(netName, "2001:db8:abc8::21"),
@@ -280,12 +280,12 @@ func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 
 
 		// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64
 		// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64
-		id3 := container.Run(t, ctx, client,
+		id3 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netName),
 			container.WithNetworkMode(netName),
 			container.WithIPv4(netName, "172.28.202.20"),
 			container.WithIPv4(netName, "172.28.202.20"),
 			container.WithIPv6(netName, "2001:db8:abc6::20"),
 			container.WithIPv6(netName, "2001:db8:abc6::20"),
 		)
 		)
-		id4 := container.Run(t, ctx, client,
+		id4 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netName),
 			container.WithNetworkMode(netName),
 			container.WithIPv4(netName, "172.28.202.21"),
 			container.WithIPv4(netName, "172.28.202.21"),
 			container.WithIPv6(netName, "2001:db8:abc6::21"),
 			container.WithIPv6(netName, "2001:db8:abc6::21"),
@@ -314,7 +314,7 @@ func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
 func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
 func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
 	return func(t *testing.T) {
 	return func(t *testing.T) {
 		netName := "dualstackl3"
 		netName := "dualstackl3"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithIPvlan("", "l3"),
 			net.WithIPvlan("", "l3"),
 			net.WithIPv6(),
 			net.WithIPv6(),
 			net.WithIPAM("172.28.10.0/24", ""),
 			net.WithIPAM("172.28.10.0/24", ""),
@@ -326,12 +326,12 @@ func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
 
 
 		// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64
 		// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64
 		ctx := context.Background()
 		ctx := context.Background()
-		id1 := container.Run(t, ctx, client,
+		id1 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netName),
 			container.WithNetworkMode(netName),
 			container.WithIPv4(netName, "172.28.10.20"),
 			container.WithIPv4(netName, "172.28.10.20"),
 			container.WithIPv6(netName, "2001:db8:abc9::20"),
 			container.WithIPv6(netName, "2001:db8:abc9::20"),
 		)
 		)
-		id2 := container.Run(t, ctx, client,
+		id2 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netName),
 			container.WithNetworkMode(netName),
 			container.WithIPv4(netName, "172.28.10.21"),
 			container.WithIPv4(netName, "172.28.10.21"),
 			container.WithIPv6(netName, "2001:db8:abc9::21"),
 			container.WithIPv6(netName, "2001:db8:abc9::21"),
@@ -347,12 +347,12 @@ func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 
 
 		// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64
 		// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64
-		id3 := container.Run(t, ctx, client,
+		id3 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netName),
 			container.WithNetworkMode(netName),
 			container.WithIPv4(netName, "172.28.12.20"),
 			container.WithIPv4(netName, "172.28.12.20"),
 			container.WithIPv6(netName, "2001:db8:abc7::20"),
 			container.WithIPv6(netName, "2001:db8:abc7::20"),
 		)
 		)
-		id4 := container.Run(t, ctx, client,
+		id4 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netName),
 			container.WithNetworkMode(netName),
 			container.WithIPv4(netName, "172.28.12.21"),
 			container.WithIPv4(netName, "172.28.12.21"),
 			container.WithIPv6(netName, "2001:db8:abc7::21"),
 			container.WithIPv6(netName, "2001:db8:abc7::21"),
@@ -383,7 +383,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
 		// Verify ipvlan l2 mode sets the proper default gateway routes via netlink
 		// Verify ipvlan l2 mode sets the proper default gateway routes via netlink
 		// for either an explicitly set route by the user or inferred via default IPAM
 		// for either an explicitly set route by the user or inferred via default IPAM
 		netNameL2 := "dualstackl2"
 		netNameL2 := "dualstackl2"
-		net.CreateNoError(t, context.Background(), client, netNameL2,
+		net.CreateNoError(context.Background(), t, client, netNameL2,
 			net.WithIPvlan("", "l2"),
 			net.WithIPvlan("", "l2"),
 			net.WithIPv6(),
 			net.WithIPv6(),
 			net.WithIPAM("172.28.140.0/24", "172.28.140.254"),
 			net.WithIPAM("172.28.140.0/24", "172.28.140.254"),
@@ -392,7 +392,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
 		assert.Check(t, n.IsNetworkAvailable(client, netNameL2))
 		assert.Check(t, n.IsNetworkAvailable(client, netNameL2))
 
 
 		ctx := context.Background()
 		ctx := context.Background()
-		id1 := container.Run(t, ctx, client,
+		id1 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netNameL2),
 			container.WithNetworkMode(netNameL2),
 		)
 		)
 		// Validate ipvlan l2 mode defaults gateway sets the default IPAM next-hop inferred from the subnet
 		// Validate ipvlan l2 mode defaults gateway sets the default IPAM next-hop inferred from the subnet
@@ -406,7 +406,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
 
 
 		// Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops
 		// Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops
 		netNameL3 := "dualstackl3"
 		netNameL3 := "dualstackl3"
-		net.CreateNoError(t, context.Background(), client, netNameL3,
+		net.CreateNoError(context.Background(), t, client, netNameL3,
 			net.WithIPvlan("", "l3"),
 			net.WithIPvlan("", "l3"),
 			net.WithIPv6(),
 			net.WithIPv6(),
 			net.WithIPAM("172.28.160.0/24", "172.28.160.254"),
 			net.WithIPAM("172.28.160.0/24", "172.28.160.254"),
@@ -414,7 +414,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
 		)
 		)
 		assert.Check(t, n.IsNetworkAvailable(client, netNameL3))
 		assert.Check(t, n.IsNetworkAvailable(client, netNameL3))
 
 
-		id2 := container.Run(t, ctx, client,
+		id2 := container.Run(ctx, t, client,
 			container.WithNetworkMode(netNameL3),
 			container.WithNetworkMode(netNameL3),
 		)
 		)
 		// Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops
 		// Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops

+ 16 - 16
integration/network/macvlan/macvlan_test.go

@@ -33,7 +33,7 @@ func TestDockerNetworkMacvlanPersistance(t *testing.T) {
 	c := d.NewClientT(t)
 	c := d.NewClientT(t)
 
 
 	netName := "dm-persist"
 	netName := "dm-persist"
-	net.CreateNoError(t, context.Background(), c, netName,
+	net.CreateNoError(context.Background(), t, c, netName,
 		net.WithMacvlan("dm-dummy0.60"),
 		net.WithMacvlan("dm-dummy0.60"),
 	)
 	)
 	assert.Check(t, n.IsNetworkAvailable(c, netName))
 	assert.Check(t, n.IsNetworkAvailable(c, netName))
@@ -86,7 +86,7 @@ func testMacvlanOverlapParent(client client.APIClient) func(*testing.T) {
 
 
 		netName := "dm-subinterface"
 		netName := "dm-subinterface"
 		parentName := "dm-dummy0.40"
 		parentName := "dm-dummy0.40"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithMacvlan(parentName),
 			net.WithMacvlan(parentName),
 		)
 		)
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
@@ -116,7 +116,7 @@ func testMacvlanSubinterface(client client.APIClient) func(*testing.T) {
 		n.CreateVlanInterface(t, master, parentName, "20")
 		n.CreateVlanInterface(t, master, parentName, "20")
 
 
 		netName := "dm-subinterface"
 		netName := "dm-subinterface"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithMacvlan(parentName),
 			net.WithMacvlan(parentName),
 		)
 		)
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
@@ -135,14 +135,14 @@ func testMacvlanNilParent(client client.APIClient) func(*testing.T) {
 	return func(t *testing.T) {
 	return func(t *testing.T) {
 		// macvlan bridge mode - dummy parent interface is provisioned dynamically
 		// macvlan bridge mode - dummy parent interface is provisioned dynamically
 		netName := "dm-nil-parent"
 		netName := "dm-nil-parent"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithMacvlan(""),
 			net.WithMacvlan(""),
 		)
 		)
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 
 
 		ctx := context.Background()
 		ctx := context.Background()
-		id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
-		id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
+		id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
+		id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
 
 
 		_, err := container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
 		_, err := container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
 		assert.Check(t, err == nil)
 		assert.Check(t, err == nil)
@@ -153,15 +153,15 @@ func testMacvlanInternalMode(client client.APIClient) func(*testing.T) {
 	return func(t *testing.T) {
 	return func(t *testing.T) {
 		// macvlan bridge mode - dummy parent interface is provisioned dynamically
 		// macvlan bridge mode - dummy parent interface is provisioned dynamically
 		netName := "dm-internal"
 		netName := "dm-internal"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithMacvlan(""),
 			net.WithMacvlan(""),
 			net.WithInternal(),
 			net.WithInternal(),
 		)
 		)
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 
 
 		ctx := context.Background()
 		ctx := context.Background()
-		id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
-		id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
+		id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
+		id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
 
 
 		timeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
 		timeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
 		defer cancel()
 		defer cancel()
@@ -178,7 +178,7 @@ func testMacvlanInternalMode(client client.APIClient) func(*testing.T) {
 func testMacvlanMultiSubnet(client client.APIClient) func(*testing.T) {
 func testMacvlanMultiSubnet(client client.APIClient) func(*testing.T) {
 	return func(t *testing.T) {
 	return func(t *testing.T) {
 		netName := "dualstackbridge"
 		netName := "dualstackbridge"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithMacvlan(""),
 			net.WithMacvlan(""),
 			net.WithIPv6(),
 			net.WithIPv6(),
 			net.WithIPAM("172.28.100.0/24", ""),
 			net.WithIPAM("172.28.100.0/24", ""),
@@ -191,12 +191,12 @@ func testMacvlanMultiSubnet(client client.APIClient) func(*testing.T) {
 
 
 		// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64
 		// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64
 		ctx := context.Background()
 		ctx := context.Background()
-		id1 := container.Run(t, ctx, client,
+		id1 := container.Run(ctx, t, client,
 			container.WithNetworkMode("dualstackbridge"),
 			container.WithNetworkMode("dualstackbridge"),
 			container.WithIPv4("dualstackbridge", "172.28.100.20"),
 			container.WithIPv4("dualstackbridge", "172.28.100.20"),
 			container.WithIPv6("dualstackbridge", "2001:db8:abc2::20"),
 			container.WithIPv6("dualstackbridge", "2001:db8:abc2::20"),
 		)
 		)
-		id2 := container.Run(t, ctx, client,
+		id2 := container.Run(ctx, t, client,
 			container.WithNetworkMode("dualstackbridge"),
 			container.WithNetworkMode("dualstackbridge"),
 			container.WithIPv4("dualstackbridge", "172.28.100.21"),
 			container.WithIPv4("dualstackbridge", "172.28.100.21"),
 			container.WithIPv6("dualstackbridge", "2001:db8:abc2::21"),
 			container.WithIPv6("dualstackbridge", "2001:db8:abc2::21"),
@@ -212,12 +212,12 @@ func testMacvlanMultiSubnet(client client.APIClient) func(*testing.T) {
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 
 
 		// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64
 		// start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64
-		id3 := container.Run(t, ctx, client,
+		id3 := container.Run(ctx, t, client,
 			container.WithNetworkMode("dualstackbridge"),
 			container.WithNetworkMode("dualstackbridge"),
 			container.WithIPv4("dualstackbridge", "172.28.102.20"),
 			container.WithIPv4("dualstackbridge", "172.28.102.20"),
 			container.WithIPv6("dualstackbridge", "2001:db8:abc4::20"),
 			container.WithIPv6("dualstackbridge", "2001:db8:abc4::20"),
 		)
 		)
-		id4 := container.Run(t, ctx, client,
+		id4 := container.Run(ctx, t, client,
 			container.WithNetworkMode("dualstackbridge"),
 			container.WithNetworkMode("dualstackbridge"),
 			container.WithIPv4("dualstackbridge", "172.28.102.21"),
 			container.WithIPv4("dualstackbridge", "172.28.102.21"),
 			container.WithIPv6("dualstackbridge", "2001:db8:abc4::21"),
 			container.WithIPv6("dualstackbridge", "2001:db8:abc4::21"),
@@ -247,7 +247,7 @@ func testMacvlanAddressing(client client.APIClient) func(*testing.T) {
 	return func(t *testing.T) {
 	return func(t *testing.T) {
 		// Ensure the default gateways, next-hops and default dev devices are properly set
 		// Ensure the default gateways, next-hops and default dev devices are properly set
 		netName := "dualstackbridge"
 		netName := "dualstackbridge"
-		net.CreateNoError(t, context.Background(), client, netName,
+		net.CreateNoError(context.Background(), t, client, netName,
 			net.WithMacvlan(""),
 			net.WithMacvlan(""),
 			net.WithIPv6(),
 			net.WithIPv6(),
 			net.WithOption("macvlan_mode", "bridge"),
 			net.WithOption("macvlan_mode", "bridge"),
@@ -257,7 +257,7 @@ func testMacvlanAddressing(client client.APIClient) func(*testing.T) {
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
 
 
 		ctx := context.Background()
 		ctx := context.Background()
-		id1 := container.Run(t, ctx, client,
+		id1 := container.Run(ctx, t, client,
 			container.WithNetworkMode("dualstackbridge"),
 			container.WithNetworkMode("dualstackbridge"),
 		)
 		)
 
 

+ 3 - 3
integration/network/network_test.go

@@ -29,14 +29,14 @@ func TestRunContainerWithBridgeNone(t *testing.T) {
 	c := d.NewClientT(t)
 	c := d.NewClientT(t)
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	id1 := container.Run(t, ctx, c)
+	id1 := container.Run(ctx, t, c)
 	defer c.ContainerRemove(ctx, id1, types.ContainerRemoveOptions{Force: true})
 	defer c.ContainerRemove(ctx, id1, types.ContainerRemoveOptions{Force: true})
 
 
 	result, err := container.Exec(ctx, c, id1, []string{"ip", "l"})
 	result, err := container.Exec(ctx, c, id1, []string{"ip", "l"})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Check(t, is.Equal(false, strings.Contains(result.Combined(), "eth0")), "There shouldn't be eth0 in container in default(bridge) mode when bridge network is disabled")
 	assert.Check(t, is.Equal(false, strings.Contains(result.Combined(), "eth0")), "There shouldn't be eth0 in container in default(bridge) mode when bridge network is disabled")
 
 
-	id2 := container.Run(t, ctx, c, container.WithNetworkMode("bridge"))
+	id2 := container.Run(ctx, t, c, container.WithNetworkMode("bridge"))
 	defer c.ContainerRemove(ctx, id2, types.ContainerRemoveOptions{Force: true})
 	defer c.ContainerRemove(ctx, id2, types.ContainerRemoveOptions{Force: true})
 
 
 	result, err = container.Exec(ctx, c, id2, []string{"ip", "l"})
 	result, err = container.Exec(ctx, c, id2, []string{"ip", "l"})
@@ -50,7 +50,7 @@ func TestRunContainerWithBridgeNone(t *testing.T) {
 	err = cmd.Run()
 	err = cmd.Run()
 	assert.NilError(t, err, "Failed to get current process network namespace: %+v", err)
 	assert.NilError(t, err, "Failed to get current process network namespace: %+v", err)
 
 
-	id3 := container.Run(t, ctx, c, container.WithNetworkMode("host"))
+	id3 := container.Run(ctx, t, c, container.WithNetworkMode("host"))
 	defer c.ContainerRemove(ctx, id3, types.ContainerRemoveOptions{Force: true})
 	defer c.ContainerRemove(ctx, id3, types.ContainerRemoveOptions{Force: true})
 
 
 	result, err = container.Exec(ctx, c, id3, []string{"sh", "-c", nsCommand})
 	result, err = container.Exec(ctx, c, id3, []string{"sh", "-c", nsCommand})

+ 9 - 9
integration/network/service_test.go

@@ -71,7 +71,7 @@ func TestDaemonDefaultNetworkPools(t *testing.T) {
 
 
 	// Create a bridge network and verify its subnet is the second default pool
 	// Create a bridge network and verify its subnet is the second default pool
 	name := "elango" + t.Name()
 	name := "elango" + t.Name()
-	network.CreateNoError(t, context.Background(), c, name,
+	network.CreateNoError(context.Background(), t, c, name,
 		network.WithDriver("bridge"),
 		network.WithDriver("bridge"),
 	)
 	)
 	out, err = c.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
 	out, err = c.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
@@ -80,7 +80,7 @@ func TestDaemonDefaultNetworkPools(t *testing.T) {
 
 
 	// Create a bridge network and verify its subnet is the third default pool
 	// Create a bridge network and verify its subnet is the third default pool
 	name = "saanvi" + t.Name()
 	name = "saanvi" + t.Name()
-	network.CreateNoError(t, context.Background(), c, name,
+	network.CreateNoError(context.Background(), t, c, name,
 		network.WithDriver("bridge"),
 		network.WithDriver("bridge"),
 	)
 	)
 	out, err = c.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
 	out, err = c.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
@@ -103,7 +103,7 @@ func TestDaemonRestartWithExistingNetwork(t *testing.T) {
 
 
 	// Create a bridge network
 	// Create a bridge network
 	name := "elango" + t.Name()
 	name := "elango" + t.Name()
-	network.CreateNoError(t, context.Background(), c, name,
+	network.CreateNoError(context.Background(), t, c, name,
 		network.WithDriver("bridge"),
 		network.WithDriver("bridge"),
 	)
 	)
 
 
@@ -136,7 +136,7 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
 
 
 	// Create a bridge network
 	// Create a bridge network
 	name := "elango" + t.Name()
 	name := "elango" + t.Name()
-	network.CreateNoError(t, context.Background(), c, name,
+	network.CreateNoError(context.Background(), t, c, name,
 		network.WithDriver("bridge"),
 		network.WithDriver("bridge"),
 	)
 	)
 
 
@@ -147,7 +147,7 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
 
 
 	// Create a bridge network
 	// Create a bridge network
 	name = "sthira" + t.Name()
 	name = "sthira" + t.Name()
-	network.CreateNoError(t, context.Background(), c, name,
+	network.CreateNoError(context.Background(), t, c, name,
 		network.WithDriver("bridge"),
 		network.WithDriver("bridge"),
 	)
 	)
 	out, err = c.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
 	out, err = c.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
@@ -162,7 +162,7 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
 
 
 	// Create a bridge network
 	// Create a bridge network
 	name = "saanvi" + t.Name()
 	name = "saanvi" + t.Name()
-	network.CreateNoError(t, context.Background(), c, name,
+	network.CreateNoError(context.Background(), t, c, name,
 		network.WithDriver("bridge"),
 		network.WithDriver("bridge"),
 	)
 	)
 	out1, err := c.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
 	out1, err := c.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{})
@@ -343,7 +343,7 @@ func TestServiceWithDataPathPortInit(t *testing.T) {
 
 
 	// Create a overlay network
 	// Create a overlay network
 	name := "saanvisthira" + t.Name()
 	name := "saanvisthira" + t.Name()
-	network.CreateNoError(t, context.Background(), c, name,
+	network.CreateNoError(context.Background(), t, c, name,
 		network.WithDriver("overlay"))
 		network.WithDriver("overlay"))
 
 
 	var instances uint64 = 1
 	var instances uint64 = 1
@@ -369,7 +369,7 @@ func TestServiceWithDataPathPortInit(t *testing.T) {
 
 
 	// Create a overlay network
 	// Create a overlay network
 	name = "saanvisthira" + t.Name()
 	name = "saanvisthira" + t.Name()
-	network.CreateNoError(t, context.Background(), c, name,
+	network.CreateNoError(context.Background(), t, c, name,
 		network.WithDriver("overlay"))
 		network.WithDriver("overlay"))
 
 
 	serviceID = swarm.CreateService(t, d,
 	serviceID = swarm.CreateService(t, d,
@@ -402,7 +402,7 @@ func TestServiceWithDefaultAddressPoolInit(t *testing.T) {
 
 
 	// Create a overlay network
 	// Create a overlay network
 	name := "saanvisthira" + t.Name()
 	name := "saanvisthira" + t.Name()
-	network.CreateNoError(t, context.Background(), cli, name,
+	network.CreateNoError(context.Background(), t, cli, name,
 		network.WithDriver("overlay"))
 		network.WithDriver("overlay"))
 
 
 	var instances uint64 = 1
 	var instances uint64 = 1

+ 4 - 4
integration/plugin/authz/authz_plugin_test.go

@@ -92,7 +92,7 @@ func TestAuthZPluginAllowRequest(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 
 
 	// Ensure command successful
 	// Ensure command successful
-	cID := container.Run(t, ctx, c)
+	cID := container.Run(ctx, t, c)
 
 
 	assertURIRecorded(t, ctrl.requestsURIs, "/containers/create")
 	assertURIRecorded(t, ctrl.requestsURIs, "/containers/create")
 	assertURIRecorded(t, ctrl.requestsURIs, fmt.Sprintf("/containers/%s/start", cID))
 	assertURIRecorded(t, ctrl.requestsURIs, fmt.Sprintf("/containers/%s/start", cID))
@@ -224,7 +224,7 @@ func TestAuthZPluginAllowEventStream(t *testing.T) {
 	defer cancel()
 	defer cancel()
 
 
 	// Create a container and wait for the creation events
 	// Create a container and wait for the creation events
-	cID := container.Run(t, ctx, c)
+	cID := container.Run(ctx, t, c)
 	poll.WaitOn(t, container.IsInState(ctx, c, cID, "running"))
 	poll.WaitOn(t, container.IsInState(ctx, c, cID, "running"))
 
 
 	created := false
 	created := false
@@ -348,7 +348,7 @@ func TestAuthZPluginEnsureLoadImportWorking(t *testing.T) {
 
 
 	exportedImagePath := filepath.Join(tmp, "export.tar")
 	exportedImagePath := filepath.Join(tmp, "export.tar")
 
 
-	cID := container.Run(t, ctx, c)
+	cID := container.Run(ctx, t, c)
 
 
 	responseReader, err := c.ContainerExport(context.Background(), cID)
 	responseReader, err := c.ContainerExport(context.Background(), cID)
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -388,7 +388,7 @@ func TestAuthzPluginEnsureContainerCopyToFrom(t *testing.T) {
 	c := d.NewClientT(t)
 	c := d.NewClientT(t)
 	ctx := context.Background()
 	ctx := context.Background()
 
 
-	cID := container.Run(t, ctx, c)
+	cID := container.Run(ctx, t, c)
 	defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
 	defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
 
 
 	_, err = f.Seek(0, io.SeekStart)
 	_, err = f.Seek(0, io.SeekStart)

+ 1 - 1
integration/plugin/authz/authz_plugin_v2_test.go

@@ -55,7 +55,7 @@ func TestAuthZPluginV2AllowNonVolumeRequest(t *testing.T) {
 	d.LoadBusybox(t)
 	d.LoadBusybox(t)
 
 
 	// Ensure docker run command and accompanying docker ps are successful
 	// Ensure docker run command and accompanying docker ps are successful
-	cID := container.Run(t, ctx, c)
+	cID := container.Run(ctx, t, c)
 
 
 	_, err = c.ContainerInspect(ctx, cID)
 	_, err = c.ContainerInspect(ctx, cID)
 	assert.NilError(t, err)
 	assert.NilError(t, err)

+ 5 - 6
integration/plugin/graphdriver/external_test.go

@@ -360,7 +360,7 @@ func testExternalGraphDriver(ext string, ec map[string]*graphEventsCounter) func
 
 
 			ctx := context.Background()
 			ctx := context.Background()
 
 
-			testGraphDriver(t, c, ctx, driverName, func(t *testing.T) {
+			testGraphDriver(ctx, t, c, driverName, func(t *testing.T) {
 				d.Restart(t, "-s", driverName)
 				d.Restart(t, "-s", driverName)
 			})
 			})
 
 
@@ -399,7 +399,7 @@ func testGraphDriverPull(c client.APIClient, d *daemon.Daemon) func(*testing.T)
 		_, err = io.Copy(ioutil.Discard, r)
 		_, err = io.Copy(ioutil.Discard, r)
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 
 
-		container.Run(t, ctx, c, container.WithImage("busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0"))
+		container.Run(ctx, t, c, container.WithImage("busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0"))
 	}
 	}
 }
 }
 
 
@@ -434,12 +434,11 @@ func TestGraphdriverPluginV2(t *testing.T) {
 	d.Stop(t)
 	d.Stop(t)
 	d.StartWithBusybox(t, "-s", plugin, "--storage-opt", "overlay2.override_kernel_check=1")
 	d.StartWithBusybox(t, "-s", plugin, "--storage-opt", "overlay2.override_kernel_check=1")
 
 
-	testGraphDriver(t, client, ctx, plugin, nil)
+	testGraphDriver(ctx, t, client, plugin, nil)
 }
 }
 
 
-// nolint: golint
-func testGraphDriver(t *testing.T, c client.APIClient, ctx context.Context, driverName string, afterContainerRunFn func(*testing.T)) { //nolint: golint
-	id := container.Run(t, ctx, c, container.WithCmd("sh", "-c", "echo hello > /hello"))
+func testGraphDriver(ctx context.Context, t *testing.T, c client.APIClient, driverName string, afterContainerRunFn func(*testing.T)) {
+	id := container.Run(ctx, t, c, container.WithCmd("sh", "-c", "echo hello > /hello"))
 
 
 	if afterContainerRunFn != nil {
 	if afterContainerRunFn != nil {
 		afterContainerRunFn(t)
 		afterContainerRunFn(t)

+ 1 - 1
integration/plugin/logging/logging_linux_test.go

@@ -33,7 +33,7 @@ func TestContinueAfterPluginCrash(t *testing.T) {
 
 
 	ctx, cancel = context.WithTimeout(context.Background(), 60*time.Second)
 	ctx, cancel = context.WithTimeout(context.Background(), 60*time.Second)
 
 
-	id := container.Run(t, ctx, client,
+	id := container.Run(ctx, t, client,
 		container.WithAutoRemove,
 		container.WithAutoRemove,
 		container.WithLogDriver("test"),
 		container.WithLogDriver("test"),
 		container.WithCmd(
 		container.WithCmd(

+ 4 - 4
integration/service/create_test.go

@@ -84,7 +84,7 @@ func TestCreateServiceMultipleTimes(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 
 
 	overlayName := "overlay1_" + t.Name()
 	overlayName := "overlay1_" + t.Name()
-	overlayID := network.CreateNoError(t, ctx, client, overlayName,
+	overlayID := network.CreateNoError(ctx, t, client, overlayName,
 		network.WithCheckDuplicate(),
 		network.WithCheckDuplicate(),
 		network.WithDriver("overlay"),
 		network.WithDriver("overlay"),
 	)
 	)
@@ -175,11 +175,11 @@ func TestCreateWithDuplicateNetworkNames(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 
 
 	name := "foo_" + t.Name()
 	name := "foo_" + t.Name()
-	n1 := network.CreateNoError(t, ctx, client, name, network.WithDriver("bridge"))
-	n2 := network.CreateNoError(t, ctx, client, name, network.WithDriver("bridge"))
+	n1 := network.CreateNoError(ctx, t, client, name, network.WithDriver("bridge"))
+	n2 := network.CreateNoError(ctx, t, client, name, network.WithDriver("bridge"))
 
 
 	// Duplicates with name but with different driver
 	// Duplicates with name but with different driver
-	n3 := network.CreateNoError(t, ctx, client, name, network.WithDriver("overlay"))
+	n3 := network.CreateNoError(ctx, t, client, name, network.WithDriver("overlay"))
 
 
 	// Create Service with the same name
 	// Create Service with the same name
 	var instances uint64 = 1
 	var instances uint64 = 1

+ 5 - 5
integration/service/network_test.go

@@ -24,12 +24,12 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 
 
 	name := t.Name() + "test-alias"
 	name := t.Name() + "test-alias"
-	net.CreateNoError(t, ctx, client, name,
+	net.CreateNoError(ctx, t, client, name,
 		net.WithDriver("overlay"),
 		net.WithDriver("overlay"),
 		net.WithAttachable(),
 		net.WithAttachable(),
 	)
 	)
 
 
-	cID1 := container.Create(t, ctx, client, func(c *container.TestContainerConfig) {
+	cID1 := container.Create(ctx, t, client, func(c *container.TestContainerConfig) {
 		c.NetworkingConfig = &network.NetworkingConfig{
 		c.NetworkingConfig = &network.NetworkingConfig{
 			EndpointsConfig: map[string]*network.EndpointSettings{
 			EndpointsConfig: map[string]*network.EndpointSettings{
 				name: {},
 				name: {},
@@ -52,7 +52,7 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
 	assert.Check(t, is.Equal(len(ng1.NetworkSettings.Networks[name].Aliases), 2))
 	assert.Check(t, is.Equal(len(ng1.NetworkSettings.Networks[name].Aliases), 2))
 	assert.Check(t, is.Equal(ng1.NetworkSettings.Networks[name].Aliases[0], "aaa"))
 	assert.Check(t, is.Equal(ng1.NetworkSettings.Networks[name].Aliases[0], "aaa"))
 
 
-	cID2 := container.Create(t, ctx, client, func(c *container.TestContainerConfig) {
+	cID2 := container.Create(ctx, t, client, func(c *container.TestContainerConfig) {
 		c.NetworkingConfig = &network.NetworkingConfig{
 		c.NetworkingConfig = &network.NetworkingConfig{
 			EndpointsConfig: map[string]*network.EndpointSettings{
 			EndpointsConfig: map[string]*network.EndpointSettings{
 				name: {},
 				name: {},
@@ -86,12 +86,12 @@ func TestDockerNetworkReConnect(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 
 
 	name := t.Name() + "dummyNet"
 	name := t.Name() + "dummyNet"
-	net.CreateNoError(t, ctx, client, name,
+	net.CreateNoError(ctx, t, client, name,
 		net.WithDriver("overlay"),
 		net.WithDriver("overlay"),
 		net.WithAttachable(),
 		net.WithAttachable(),
 	)
 	)
 
 
-	c1 := container.Create(t, ctx, client, func(c *container.TestContainerConfig) {
+	c1 := container.Create(ctx, t, client, func(c *container.TestContainerConfig) {
 		c.NetworkingConfig = &network.NetworkingConfig{
 		c.NetworkingConfig = &network.NetworkingConfig{
 			EndpointsConfig: map[string]*network.EndpointSettings{
 			EndpointsConfig: map[string]*network.EndpointSettings{
 				name: {},
 				name: {},

+ 1 - 1
integration/service/update_test.go

@@ -207,7 +207,7 @@ func TestServiceUpdateNetwork(t *testing.T) {
 
 
 	// Create a overlay network
 	// Create a overlay network
 	testNet := "testNet" + t.Name()
 	testNet := "testNet" + t.Name()
-	overlayID := network.CreateNoError(t, ctx, cli, testNet,
+	overlayID := network.CreateNoError(ctx, t, cli, testNet,
 		network.WithDriver("overlay"))
 		network.WithDriver("overlay"))
 
 
 	var instances uint64 = 1
 	var instances uint64 = 1

+ 1 - 1
integration/system/cgroupdriver_systemd_test.go

@@ -41,7 +41,7 @@ func TestCgroupDriverSystemdMemoryLimit(t *testing.T) {
 	const mem = 64 * 1024 * 1024 // 64 MB
 	const mem = 64 * 1024 * 1024 // 64 MB
 
 
 	ctx := context.Background()
 	ctx := context.Background()
-	ctrID := container.Create(t, ctx, c, func(ctr *container.TestContainerConfig) {
+	ctrID := container.Create(ctx, t, c, func(ctr *container.TestContainerConfig) {
 		ctr.HostConfig.Resources.Memory = mem
 		ctr.HostConfig.Resources.Memory = mem
 	})
 	})
 	defer c.ContainerRemove(ctx, ctrID, types.ContainerRemoveOptions{Force: true})
 	defer c.ContainerRemove(ctx, ctrID, types.ContainerRemoveOptions{Force: true})

+ 2 - 2
integration/system/event_test.go

@@ -30,7 +30,7 @@ func TestEventsExecDie(t *testing.T) {
 	ctx := context.Background()
 	ctx := context.Background()
 	client := testEnv.APIClient()
 	client := testEnv.APIClient()
 
 
-	cID := container.Run(t, ctx, client)
+	cID := container.Run(ctx, t, client)
 
 
 	id, err := client.ContainerExecCreate(ctx, cID,
 	id, err := client.ContainerExecCreate(ctx, cID,
 		types.ExecConfig{
 		types.ExecConfig{
@@ -83,7 +83,7 @@ func TestEventsBackwardsCompatible(t *testing.T) {
 	since := request.DaemonTime(ctx, t, client, testEnv)
 	since := request.DaemonTime(ctx, t, client, testEnv)
 	ts := strconv.FormatInt(since.Unix(), 10)
 	ts := strconv.FormatInt(since.Unix(), 10)
 
 
-	cID := container.Create(t, ctx, client)
+	cID := container.Create(ctx, t, client)
 
 
 	// In case there is no events, the API should have responded immediately (not blocking),
 	// In case there is no events, the API should have responded immediately (not blocking),
 	// The test here makes sure the response time is less than 3 sec.
 	// The test here makes sure the response time is less than 3 sec.

+ 1 - 1
integration/volume/volume_test.go

@@ -68,7 +68,7 @@ func TestVolumesRemove(t *testing.T) {
 
 
 	prefix, slash := getPrefixAndSlashFromDaemonPlatform()
 	prefix, slash := getPrefixAndSlashFromDaemonPlatform()
 
 
-	id := container.Create(t, ctx, client, container.WithVolume(prefix+slash+"foo"))
+	id := container.Create(ctx, t, client, container.WithVolume(prefix+slash+"foo"))
 
 
 	c, err := client.ContainerInspect(ctx, id)
 	c, err := client.ContainerInspect(ctx, id)
 	assert.NilError(t, err)
 	assert.NilError(t, err)