Browse code

integration: change container.Run signature to fix linting

Line 59: warning: context.Context should be the first parameter of a function (golint)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9f9b4290b92bab7d0adca1f3a2bf404f013d7ef5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/06/06 20:15:31
Showing 34 changed files
... ...
@@ -79,7 +79,7 @@ func TestBuildSquashParent(t *testing.T) {
79 79
 	resp.Body.Close()
80 80
 	assert.NilError(t, err)
81 81
 
82
-	cid := container.Run(t, ctx, client,
82
+	cid := container.Run(ctx, t, client,
83 83
 		container.WithImage(name),
84 84
 		container.WithCmd("/bin/sh", "-c", "cat /hello"),
85 85
 	)
... ...
@@ -94,11 +94,11 @@ func TestBuildSquashParent(t *testing.T) {
94 94
 	assert.NilError(t, err)
95 95
 	assert.Check(t, is.Equal(strings.TrimSpace(actualStdout.String()), "hello\nworld"))
96 96
 
97
-	container.Run(t, ctx, client,
97
+	container.Run(ctx, t, client,
98 98
 		container.WithImage(name),
99 99
 		container.WithCmd("/bin/sh", "-c", "[ ! -f /remove_me ]"),
100 100
 	)
101
-	container.Run(t, ctx, client,
101
+	container.Run(ctx, t, client,
102 102
 		container.WithImage(name),
103 103
 		container.WithCmd("/bin/sh", "-c", `[ "$(echo $HELLO)" == "world" ]`),
104 104
 	)
... ...
@@ -50,7 +50,7 @@ func TestCheckpoint(t *testing.T) {
50 50
 	}
51 51
 
52 52
 	t.Log("Start a container")
53
-	cID := container.Run(t, ctx, client, container.WithMount(mnt))
53
+	cID := container.Run(ctx, t, client, container.WithMount(mnt))
54 54
 	poll.WaitOn(t,
55 55
 		container.IsInState(ctx, client, cID, "running"),
56 56
 		poll.WithDelay(100*time.Millisecond),
... ...
@@ -94,7 +94,7 @@ func TestDaemonRestartIpcMode(t *testing.T) {
94 94
 	ctx := context.Background()
95 95
 
96 96
 	// check the container is created with private ipc mode as per daemon default
97
-	cID := container.Run(t, ctx, c,
97
+	cID := container.Run(ctx, t, c,
98 98
 		container.WithCmd("top"),
99 99
 		container.WithRestartPolicy("always"),
100 100
 	)
... ...
@@ -113,7 +113,7 @@ func TestDaemonRestartIpcMode(t *testing.T) {
113 113
 	assert.Check(t, is.Equal(string(inspect.HostConfig.IpcMode), "private"))
114 114
 
115 115
 	// check a new container is created with shareable ipc mode as per new daemon default
116
-	cID = container.Run(t, ctx, c)
116
+	cID = container.Run(ctx, t, c)
117 117
 	defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
118 118
 
119 119
 	inspect, err = c.ContainerInspect(ctx, cID)
... ...
@@ -19,7 +19,7 @@ func TestDiff(t *testing.T) {
19 19
 	client := testEnv.APIClient()
20 20
 	ctx := context.Background()
21 21
 
22
-	cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", `mkdir /foo; echo xyzzy > /foo/bar`))
22
+	cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", `mkdir /foo; echo xyzzy > /foo/bar`))
23 23
 
24 24
 	// Wait for it to exit as cannot diff a running container on Windows, and
25 25
 	// it will take a few seconds to exit. Also there's no way in Windows to
... ...
@@ -24,7 +24,7 @@ func TestExecWithCloseStdin(t *testing.T) {
24 24
 	client := testEnv.APIClient()
25 25
 
26 26
 	// run top with detached mode
27
-	cID := container.Run(t, ctx, client)
27
+	cID := container.Run(ctx, t, client)
28 28
 
29 29
 	expected := "closeIO"
30 30
 	execResp, err := client.ContainerExecCreate(ctx, cID,
... ...
@@ -90,7 +90,7 @@ func TestExec(t *testing.T) {
90 90
 	ctx := context.Background()
91 91
 	client := testEnv.APIClient()
92 92
 
93
-	cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/root"))
93
+	cID := container.Run(ctx, t, client, container.WithTty(true), container.WithWorkingDir("/root"))
94 94
 
95 95
 	id, err := client.ContainerExecCreate(ctx, cID,
96 96
 		types.ExecConfig{
... ...
@@ -125,7 +125,7 @@ func TestExecUser(t *testing.T) {
125 125
 	ctx := context.Background()
126 126
 	client := testEnv.APIClient()
127 127
 
128
-	cID := container.Run(t, ctx, client, container.WithTty(true), container.WithUser("1:1"))
128
+	cID := container.Run(ctx, t, client, container.WithTty(true), container.WithUser("1:1"))
129 129
 
130 130
 	result, err := container.Exec(ctx, client, cID, []string{"id"})
131 131
 	assert.NilError(t, err)
... ...
@@ -25,7 +25,7 @@ func TestExportContainerAndImportImage(t *testing.T) {
25 25
 	client := testEnv.APIClient()
26 26
 	ctx := context.Background()
27 27
 
28
-	cID := container.Run(t, ctx, client, container.WithCmd("true"))
28
+	cID := container.Run(ctx, t, client, container.WithCmd("true"))
29 29
 	poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
30 30
 
31 31
 	reference := "repo/testexp:v1"
... ...
@@ -22,7 +22,7 @@ func TestHealthCheckWorkdir(t *testing.T) {
22 22
 	ctx := context.Background()
23 23
 	client := testEnv.APIClient()
24 24
 
25
-	cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
25
+	cID := container.Run(ctx, t, client, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
26 26
 		c.Config.Healthcheck = &containertypes.HealthConfig{
27 27
 			Test:     []string{"CMD-SHELL", "if [ \"$PWD\" = \"/foo\" ]; then exit 0; else exit 1; fi;"},
28 28
 			Interval: 50 * time.Millisecond,
... ...
@@ -24,7 +24,7 @@ func TestInspectCpusetInConfigPre120(t *testing.T) {
24 24
 
25 25
 	name := "cpusetinconfig-pre120-" + t.Name()
26 26
 	// Create container with up to-date-API
27
-	container.Run(t, ctx, request.NewAPIClient(t), container.WithName(name),
27
+	container.Run(ctx, t, request.NewAPIClient(t), container.WithName(name),
28 28
 		container.WithCmd("true"),
29 29
 		func(c *container.TestContainerConfig) {
30 30
 			c.HostConfig.Resources.CpusetCpus = "0"
... ...
@@ -18,7 +18,7 @@ func TestKillContainerInvalidSignal(t *testing.T) {
18 18
 	defer setupTest(t)()
19 19
 	client := testEnv.APIClient()
20 20
 	ctx := context.Background()
21
-	id := container.Run(t, ctx, client)
21
+	id := container.Run(ctx, t, client)
22 22
 
23 23
 	err := client.ContainerKill(ctx, id, "0")
24 24
 	assert.Error(t, err, "Error response from daemon: Invalid signal: 0")
... ...
@@ -60,7 +60,7 @@ func TestKillContainer(t *testing.T) {
60 60
 		tc := tc
61 61
 		t.Run(tc.doc, func(t *testing.T) {
62 62
 			ctx := context.Background()
63
-			id := container.Run(t, ctx, client)
63
+			id := container.Run(ctx, t, client)
64 64
 			err := client.ContainerKill(ctx, id, tc.signal)
65 65
 			assert.NilError(t, err)
66 66
 
... ...
@@ -95,7 +95,7 @@ func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
95 95
 		tc := tc
96 96
 		t.Run(tc.doc, func(t *testing.T) {
97 97
 			ctx := context.Background()
98
-			id := container.Run(t, ctx, client,
98
+			id := container.Run(ctx, t, client,
99 99
 				container.WithRestartPolicy("always"),
100 100
 				func(c *container.TestContainerConfig) {
101 101
 					c.Config.StopSignal = tc.stopsignal
... ...
@@ -137,7 +137,7 @@ func TestKillDifferentUserContainer(t *testing.T) {
137 137
 	ctx := context.Background()
138 138
 	client := request.NewAPIClient(t, client.WithVersion("1.19"))
139 139
 
140
-	id := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
140
+	id := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
141 141
 		c.Config.User = "daemon"
142 142
 	})
143 143
 	poll.WaitOn(t, container.IsInState(ctx, client, id, "running"), poll.WithDelay(100*time.Millisecond))
... ...
@@ -154,7 +154,7 @@ func TestInspectOomKilledTrue(t *testing.T) {
154 154
 	ctx := context.Background()
155 155
 	client := testEnv.APIClient()
156 156
 
157
-	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) {
157
+	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) {
158 158
 		c.HostConfig.Resources.Memory = 32 * 1024 * 1024
159 159
 	})
160 160
 
... ...
@@ -172,7 +172,7 @@ func TestInspectOomKilledFalse(t *testing.T) {
172 172
 	ctx := context.Background()
173 173
 	client := testEnv.APIClient()
174 174
 
175
-	cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "echo hello world"))
175
+	cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", "echo hello world"))
176 176
 
177 177
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
178 178
 
... ...
@@ -24,7 +24,7 @@ func TestLinksEtcHostsContentMatch(t *testing.T) {
24 24
 	client := testEnv.APIClient()
25 25
 	ctx := context.Background()
26 26
 
27
-	cID := container.Run(t, ctx, client, container.WithNetworkMode("host"))
27
+	cID := container.Run(ctx, t, client, container.WithNetworkMode("host"))
28 28
 	res, err := container.Exec(ctx, client, cID, []string{"cat", "/etc/hosts"})
29 29
 	assert.NilError(t, err)
30 30
 	assert.Assert(t, is.Len(res.Stderr(), 0))
... ...
@@ -42,8 +42,8 @@ func TestLinksContainerNames(t *testing.T) {
42 42
 
43 43
 	containerA := "first_" + t.Name()
44 44
 	containerB := "second_" + t.Name()
45
-	container.Run(t, ctx, client, container.WithName(containerA))
46
-	container.Run(t, ctx, client, container.WithName(containerB), container.WithLinks(containerA+":"+containerA))
45
+	container.Run(ctx, t, client, container.WithName(containerA))
46
+	container.Run(ctx, t, client, container.WithName(containerB), container.WithLinks(containerA+":"+containerA))
47 47
 
48 48
 	f := filters.NewArgs(filters.Arg("name", containerA))
49 49
 
... ...
@@ -21,7 +21,7 @@ func TestLogsFollowTailEmpty(t *testing.T) {
21 21
 	client := testEnv.APIClient()
22 22
 	ctx := context.Background()
23 23
 
24
-	id := container.Run(t, ctx, client, container.WithCmd("sleep", "100000"))
24
+	id := container.Run(ctx, t, client, container.WithCmd("sleep", "100000"))
25 25
 
26 26
 	logs, err := client.ContainerLogs(ctx, id, types.ContainerLogsOptions{ShowStdout: true, Tail: "2"})
27 27
 	if logs != nil {
... ...
@@ -256,9 +256,9 @@ func TestContainerBindMountNonRecursive(t *testing.T) {
256 256
 	ctx := context.Background()
257 257
 	client := testEnv.APIClient()
258 258
 	containers := []string{
259
-		container.Run(t, ctx, client, container.WithMount(implicit), container.WithCmd(recursiveVerifier...)),
260
-		container.Run(t, ctx, client, container.WithMount(recursive), container.WithCmd(recursiveVerifier...)),
261
-		container.Run(t, ctx, client, container.WithMount(nonRecursive), container.WithCmd(nonRecursiveVerifier...)),
259
+		container.Run(ctx, t, client, container.WithMount(implicit), container.WithCmd(recursiveVerifier...)),
260
+		container.Run(ctx, t, client, container.WithMount(recursive), container.WithCmd(recursiveVerifier...)),
261
+		container.Run(ctx, t, client, container.WithMount(nonRecursive), container.WithCmd(nonRecursiveVerifier...)),
262 262
 	}
263 263
 
264 264
 	for _, c := range containers {
... ...
@@ -71,7 +71,7 @@ func TestNetworkLoopbackNat(t *testing.T) {
71 71
 	client := testEnv.APIClient()
72 72
 	ctx := context.Background()
73 73
 
74
-	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))
74
+	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))
75 75
 
76 76
 	poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
77 77
 
... ...
@@ -93,7 +93,7 @@ func startServerContainer(t *testing.T, msg string, port int) string {
93 93
 	client := testEnv.APIClient()
94 94
 	ctx := context.Background()
95 95
 
96
-	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) {
96
+	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) {
97 97
 		c.HostConfig.PortBindings = nat.PortMap{
98 98
 			nat.Port(fmt.Sprintf("%d/tcp", port)): []nat.PortBinding{
99 99
 				{
... ...
@@ -25,7 +25,7 @@ func TestPause(t *testing.T) {
25 25
 	client := testEnv.APIClient()
26 26
 	ctx := context.Background()
27 27
 
28
-	cID := container.Run(t, ctx, client)
28
+	cID := container.Run(ctx, t, client)
29 29
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
30 30
 
31 31
 	since := request.DaemonUnixTime(ctx, t, client, testEnv)
... ...
@@ -57,7 +57,7 @@ func TestPauseFailsOnWindowsServerContainers(t *testing.T) {
57 57
 	client := testEnv.APIClient()
58 58
 	ctx := context.Background()
59 59
 
60
-	cID := container.Run(t, ctx, client)
60
+	cID := container.Run(ctx, t, client)
61 61
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
62 62
 
63 63
 	err := client.ContainerPause(ctx, cID)
... ...
@@ -71,7 +71,7 @@ func TestPauseStopPausedContainer(t *testing.T) {
71 71
 	client := testEnv.APIClient()
72 72
 	ctx := context.Background()
73 73
 
74
-	cID := container.Run(t, ctx, client)
74
+	cID := container.Run(ctx, t, client)
75 75
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
76 76
 
77 77
 	err := client.ContainerPause(ctx, cID)
... ...
@@ -36,7 +36,7 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
36 36
 	tempDir := fs.NewDir(t, "test-rm-container-with-removed-volume", fs.WithMode(0755))
37 37
 	defer tempDir.Remove()
38 38
 
39
-	cID := container.Run(t, ctx, client, container.WithCmd("true"), container.WithBind(tempDir.Path(), prefix+slash+"test"))
39
+	cID := container.Run(ctx, t, client, container.WithCmd("true"), container.WithBind(tempDir.Path(), prefix+slash+"test"))
40 40
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
41 41
 
42 42
 	err := os.RemoveAll(tempDir.Path())
... ...
@@ -59,7 +59,7 @@ func TestRemoveContainerWithVolume(t *testing.T) {
59 59
 
60 60
 	prefix, slash := getPrefixAndSlashFromDaemonPlatform()
61 61
 
62
-	cID := container.Run(t, ctx, client, container.WithCmd("true"), container.WithVolume(prefix+slash+"srv"))
62
+	cID := container.Run(ctx, t, client, container.WithCmd("true"), container.WithVolume(prefix+slash+"srv"))
63 63
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
64 64
 
65 65
 	insp, _, err := client.ContainerInspectWithRaw(ctx, cID, true)
... ...
@@ -82,7 +82,7 @@ func TestRemoveContainerRunning(t *testing.T) {
82 82
 	ctx := context.Background()
83 83
 	client := testEnv.APIClient()
84 84
 
85
-	cID := container.Run(t, ctx, client)
85
+	cID := container.Run(ctx, t, client)
86 86
 
87 87
 	err := client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{})
88 88
 	assert.Check(t, is.ErrorContains(err, "cannot remove a running container"))
... ...
@@ -93,7 +93,7 @@ func TestRemoveContainerForceRemoveRunning(t *testing.T) {
93 93
 	ctx := context.Background()
94 94
 	client := testEnv.APIClient()
95 95
 
96
-	cID := container.Run(t, ctx, client)
96
+	cID := container.Run(ctx, t, client)
97 97
 
98 98
 	err := client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
99 99
 		Force: true,
... ...
@@ -30,18 +30,18 @@ func TestRenameLinkedContainer(t *testing.T) {
30 30
 
31 31
 	aName := "a0" + t.Name()
32 32
 	bName := "b0" + t.Name()
33
-	aID := container.Run(t, ctx, client, container.WithName(aName))
34
-	bID := container.Run(t, ctx, client, container.WithName(bName), container.WithLinks(aName))
33
+	aID := container.Run(ctx, t, client, container.WithName(aName))
34
+	bID := container.Run(ctx, t, client, container.WithName(bName), container.WithLinks(aName))
35 35
 
36 36
 	err := client.ContainerRename(ctx, aID, "a1"+t.Name())
37 37
 	assert.NilError(t, err)
38 38
 
39
-	container.Run(t, ctx, client, container.WithName(aName))
39
+	container.Run(ctx, t, client, container.WithName(aName))
40 40
 
41 41
 	err = client.ContainerRemove(ctx, bID, types.ContainerRemoveOptions{Force: true})
42 42
 	assert.NilError(t, err)
43 43
 
44
-	bID = container.Run(t, ctx, client, container.WithName(bName), container.WithLinks(aName))
44
+	bID = container.Run(ctx, t, client, container.WithName(bName), container.WithLinks(aName))
45 45
 
46 46
 	inspect, err := client.ContainerInspect(ctx, bID)
47 47
 	assert.NilError(t, err)
... ...
@@ -54,7 +54,7 @@ func TestRenameStoppedContainer(t *testing.T) {
54 54
 	client := testEnv.APIClient()
55 55
 
56 56
 	oldName := "first_name" + t.Name()
57
-	cID := container.Run(t, ctx, client, container.WithName(oldName), container.WithCmd("sh"))
57
+	cID := container.Run(ctx, t, client, container.WithName(oldName), container.WithCmd("sh"))
58 58
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
59 59
 
60 60
 	inspect, err := client.ContainerInspect(ctx, cID)
... ...
@@ -76,7 +76,7 @@ func TestRenameRunningContainerAndReuse(t *testing.T) {
76 76
 	client := testEnv.APIClient()
77 77
 
78 78
 	oldName := "first_name" + t.Name()
79
-	cID := container.Run(t, ctx, client, container.WithName(oldName))
79
+	cID := container.Run(ctx, t, client, container.WithName(oldName))
80 80
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
81 81
 
82 82
 	newName := "new_name" + stringid.GenerateRandomID()
... ...
@@ -90,7 +90,7 @@ func TestRenameRunningContainerAndReuse(t *testing.T) {
90 90
 	_, err = client.ContainerInspect(ctx, oldName)
91 91
 	assert.Check(t, is.ErrorContains(err, "No such container: "+oldName))
92 92
 
93
-	cID = container.Run(t, ctx, client, container.WithName(oldName))
93
+	cID = container.Run(ctx, t, client, container.WithName(oldName))
94 94
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
95 95
 
96 96
 	inspect, err = client.ContainerInspect(ctx, cID)
... ...
@@ -104,7 +104,7 @@ func TestRenameInvalidName(t *testing.T) {
104 104
 	client := testEnv.APIClient()
105 105
 
106 106
 	oldName := "first_name" + t.Name()
107
-	cID := container.Run(t, ctx, client, container.WithName(oldName))
107
+	cID := container.Run(ctx, t, client, container.WithName(oldName))
108 108
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
109 109
 
110 110
 	err := client.ContainerRename(ctx, oldName, "new:invalid")
... ...
@@ -132,7 +132,7 @@ func TestRenameAnonymousContainer(t *testing.T) {
132 132
 	_, err := client.NetworkCreate(ctx, networkName, types.NetworkCreate{})
133 133
 
134 134
 	assert.NilError(t, err)
135
-	cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
135
+	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
136 136
 		c.NetworkingConfig.EndpointsConfig = map[string]*network.EndpointSettings{
137 137
 			networkName: {},
138 138
 		}
... ...
@@ -155,7 +155,7 @@ func TestRenameAnonymousContainer(t *testing.T) {
155 155
 	if testEnv.OSType == "windows" {
156 156
 		count = "-n"
157 157
 	}
158
-	cID = container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
158
+	cID = container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
159 159
 		c.NetworkingConfig.EndpointsConfig = map[string]*network.EndpointSettings{
160 160
 			networkName: {},
161 161
 		}
... ...
@@ -175,7 +175,7 @@ func TestRenameContainerWithSameName(t *testing.T) {
175 175
 	client := testEnv.APIClient()
176 176
 
177 177
 	oldName := "old" + t.Name()
178
-	cID := container.Run(t, ctx, client, container.WithName(oldName))
178
+	cID := container.Run(ctx, t, client, container.WithName(oldName))
179 179
 
180 180
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
181 181
 	err := client.ContainerRename(ctx, oldName, oldName)
... ...
@@ -198,12 +198,12 @@ func TestRenameContainerWithLinkedContainer(t *testing.T) {
198 198
 	client := testEnv.APIClient()
199 199
 
200 200
 	db1Name := "db1" + t.Name()
201
-	db1ID := container.Run(t, ctx, client, container.WithName(db1Name))
201
+	db1ID := container.Run(ctx, t, client, container.WithName(db1Name))
202 202
 	poll.WaitOn(t, container.IsInState(ctx, client, db1ID, "running"), poll.WithDelay(100*time.Millisecond))
203 203
 
204 204
 	app1Name := "app1" + t.Name()
205 205
 	app2Name := "app2" + t.Name()
206
-	app1ID := container.Run(t, ctx, client, container.WithName(app1Name), container.WithLinks(db1Name+":/mysql"))
206
+	app1ID := container.Run(ctx, t, client, container.WithName(app1Name), container.WithLinks(db1Name+":/mysql"))
207 207
 	poll.WaitOn(t, container.IsInState(ctx, client, app1ID, "running"), poll.WithDelay(100*time.Millisecond))
208 208
 
209 209
 	err := client.ContainerRename(ctx, app1Name, app2Name)
... ...
@@ -22,7 +22,7 @@ func TestResize(t *testing.T) {
22 22
 	client := testEnv.APIClient()
23 23
 	ctx := context.Background()
24 24
 
25
-	cID := container.Run(t, ctx, client)
25
+	cID := container.Run(ctx, t, client)
26 26
 
27 27
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
28 28
 
... ...
@@ -40,7 +40,7 @@ func TestResizeWithInvalidSize(t *testing.T) {
40 40
 	client := testEnv.APIClient()
41 41
 	ctx := context.Background()
42 42
 
43
-	cID := container.Run(t, ctx, client)
43
+	cID := container.Run(ctx, t, client)
44 44
 
45 45
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
46 46
 
... ...
@@ -55,7 +55,7 @@ func TestResizeWhenContainerNotStarted(t *testing.T) {
55 55
 	client := testEnv.APIClient()
56 56
 	ctx := context.Background()
57 57
 
58
-	cID := container.Run(t, ctx, client, container.WithCmd("echo"))
58
+	cID := container.Run(ctx, t, client, container.WithCmd("echo"))
59 59
 
60 60
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
61 61
 
... ...
@@ -29,7 +29,7 @@ func TestKernelTCPMemory(t *testing.T) {
29 29
 		kernelMemoryTCP int64 = 200 * 1024 * 1024
30 30
 	)
31 31
 
32
-	cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
32
+	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
33 33
 		c.HostConfig.Resources = containertypes.Resources{
34 34
 			KernelMemoryTCP: kernelMemoryTCP,
35 35
 		}
... ...
@@ -65,7 +65,7 @@ func TestNISDomainname(t *testing.T) {
65 65
 		domainname = "baz.cyphar.com"
66 66
 	)
67 67
 
68
-	cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
68
+	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
69 69
 		c.Config.Hostname = hostname
70 70
 		c.Config.Domainname = domainname
71 71
 	})
... ...
@@ -25,7 +25,7 @@ func TestStats(t *testing.T) {
25 25
 	info, err := client.Info(ctx)
26 26
 	assert.NilError(t, err)
27 27
 
28
-	cID := container.Run(t, ctx, client)
28
+	cID := container.Run(ctx, t, client)
29 29
 
30 30
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
31 31
 
... ...
@@ -54,7 +54,7 @@ func TestStopContainerWithTimeout(t *testing.T) {
54 54
 		d := d
55 55
 		t.Run(strconv.Itoa(d.timeout), func(t *testing.T) {
56 56
 			t.Parallel()
57
-			id := container.Run(t, ctx, client, testCmd)
57
+			id := container.Run(ctx, t, client, testCmd)
58 58
 
59 59
 			timeout := time.Duration(d.timeout) * time.Second
60 60
 			err := client.ContainerStop(ctx, id, &timeout)
... ...
@@ -78,7 +78,7 @@ func TestDeleteDevicemapper(t *testing.T) {
78 78
 	client := testEnv.APIClient()
79 79
 	ctx := context.Background()
80 80
 
81
-	id := container.Run(t, ctx, client, container.WithName("foo-"+t.Name()), container.WithCmd("echo"))
81
+	id := container.Run(ctx, t, client, container.WithName("foo-"+t.Name()), container.WithCmd("echo"))
82 82
 
83 83
 	poll.WaitOn(t, container.IsStopped(ctx, client, id), poll.WithDelay(100*time.Millisecond))
84 84
 
... ...
@@ -17,7 +17,7 @@ func TestStopContainerWithRestartPolicyAlways(t *testing.T) {
17 17
 
18 18
 	names := []string{"verifyRestart1-" + t.Name(), "verifyRestart2-" + t.Name()}
19 19
 	for _, name := range names {
20
-		container.Run(t, ctx, client,
20
+		container.Run(ctx, t, client,
21 21
 			container.WithName(name),
22 22
 			container.WithCmd("false"),
23 23
 			container.WithRestartPolicy("always"),
... ...
@@ -51,7 +51,7 @@ func TestStopContainerWithTimeout(t *testing.T) {
51 51
 		d := d
52 52
 		t.Run(strconv.Itoa(d.timeout), func(t *testing.T) {
53 53
 			t.Parallel()
54
-			id := container.Run(t, ctx, client, testCmd)
54
+			id := container.Run(ctx, t, client, testCmd)
55 55
 
56 56
 			timeout := time.Duration(d.timeout) * time.Second
57 57
 			err := client.ContainerStop(ctx, id, &timeout)
... ...
@@ -26,7 +26,7 @@ func TestUpdateMemory(t *testing.T) {
26 26
 	client := testEnv.APIClient()
27 27
 	ctx := context.Background()
28 28
 
29
-	cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
29
+	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
30 30
 		c.HostConfig.Resources = containertypes.Resources{
31 31
 			Memory: 200 * 1024 * 1024,
32 32
 		}
... ...
@@ -72,7 +72,7 @@ func TestUpdateCPUQuota(t *testing.T) {
72 72
 	client := testEnv.APIClient()
73 73
 	ctx := context.Background()
74 74
 
75
-	cID := container.Run(t, ctx, client)
75
+	cID := container.Run(ctx, t, client)
76 76
 
77 77
 	for _, test := range []struct {
78 78
 		desc   string
... ...
@@ -140,7 +140,7 @@ func TestUpdatePidsLimit(t *testing.T) {
140 140
 
141 141
 		t.Run(test.desc, func(t *testing.T) {
142 142
 			// Using "network=host" to speed up creation (13.96s vs 6.54s)
143
-			cID := container.Run(t, ctx, apiClient, container.WithPidsLimit(test.initial), container.WithNetworkMode("host"))
143
+			cID := container.Run(ctx, t, apiClient, container.WithPidsLimit(test.initial), container.WithNetworkMode("host"))
144 144
 
145 145
 			_, err := c.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
146 146
 				Resources: containertypes.Resources{
... ...
@@ -17,7 +17,7 @@ func TestUpdateRestartPolicy(t *testing.T) {
17 17
 	client := testEnv.APIClient()
18 18
 	ctx := context.Background()
19 19
 
20
-	cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "sleep 1 && false"), func(c *container.TestContainerConfig) {
20
+	cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", "sleep 1 && false"), func(c *container.TestContainerConfig) {
21 21
 		c.HostConfig.RestartPolicy = containertypes.RestartPolicy{
22 22
 			Name:              "on-failure",
23 23
 			MaximumRetryCount: 3,
... ...
@@ -50,7 +50,7 @@ func TestUpdateRestartWithAutoRemove(t *testing.T) {
50 50
 	client := testEnv.APIClient()
51 51
 	ctx := context.Background()
52 52
 
53
-	cID := container.Run(t, ctx, client, container.WithAutoRemove)
53
+	cID := container.Run(ctx, t, client, container.WithAutoRemove)
54 54
 
55 55
 	_, err := client.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
56 56
 		RestartPolicy: containertypes.RestartPolicy{
... ...
@@ -39,7 +39,7 @@ func TestWaitNonBlocked(t *testing.T) {
39 39
 		t.Run(tc.doc, func(t *testing.T) {
40 40
 			t.Parallel()
41 41
 			ctx := context.Background()
42
-			containerID := container.Run(t, ctx, cli, container.WithCmd("sh", "-c", tc.cmd))
42
+			containerID := container.Run(ctx, t, cli, container.WithCmd("sh", "-c", tc.cmd))
43 43
 			poll.WaitOn(t, container.IsInState(ctx, cli, containerID, "exited"), poll.WithTimeout(30*time.Second), poll.WithDelay(100*time.Millisecond))
44 44
 
45 45
 			waitresC, errC := cli.ContainerWait(ctx, containerID, "")
... ...
@@ -81,7 +81,7 @@ func TestWaitBlocked(t *testing.T) {
81 81
 		t.Run(tc.doc, func(t *testing.T) {
82 82
 			t.Parallel()
83 83
 			ctx := context.Background()
84
-			containerID := container.Run(t, ctx, cli, container.WithCmd("sh", "-c", tc.cmd))
84
+			containerID := container.Run(ctx, t, cli, container.WithCmd("sh", "-c", tc.cmd))
85 85
 			poll.WaitOn(t, container.IsInState(ctx, cli, containerID, "running"), poll.WithTimeout(30*time.Second), poll.WithDelay(100*time.Millisecond))
86 86
 
87 87
 			waitresC, errC := cli.ContainerWait(ctx, containerID, "")
... ...
@@ -48,8 +48,7 @@ func Create(ctx context.Context, t *testing.T, client client.APIClient, ops ...f
48 48
 }
49 49
 
50 50
 // Run creates and start a container with the specified options
51
-// nolint: golint
52
-func Run(t *testing.T, ctx context.Context, client client.APIClient, ops ...func(*TestContainerConfig)) string { // nolint: golint
51
+func Run(ctx context.Context, t *testing.T, client client.APIClient, ops ...func(*TestContainerConfig)) string {
53 52
 	t.Helper()
54 53
 	id := Create(ctx, t, client, ops...)
55 54
 
... ...
@@ -153,8 +153,8 @@ func testIpvlanL2NilParent(client dclient.APIClient) func(*testing.T) {
153 153
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
154 154
 
155 155
 		ctx := context.Background()
156
-		id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
157
-		id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
156
+		id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
157
+		id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
158 158
 
159 159
 		_, err := container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
160 160
 		assert.NilError(t, err)
... ...
@@ -171,8 +171,8 @@ func testIpvlanL2InternalMode(client dclient.APIClient) func(*testing.T) {
171 171
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
172 172
 
173 173
 		ctx := context.Background()
174
-		id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
175
-		id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
174
+		id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
175
+		id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
176 176
 
177 177
 		timeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
178 178
 		defer cancel()
... ...
@@ -197,11 +197,11 @@ func testIpvlanL3NilParent(client dclient.APIClient) func(*testing.T) {
197 197
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
198 198
 
199 199
 		ctx := context.Background()
200
-		id1 := container.Run(t, ctx, client,
200
+		id1 := container.Run(ctx, t, client,
201 201
 			container.WithNetworkMode(netName),
202 202
 			container.WithIPv4(netName, "172.28.220.10"),
203 203
 		)
204
-		id2 := container.Run(t, ctx, client,
204
+		id2 := container.Run(ctx, t, client,
205 205
 			container.WithNetworkMode(netName),
206 206
 			container.WithIPv4(netName, "172.28.230.10"),
207 207
 		)
... ...
@@ -223,11 +223,11 @@ func testIpvlanL3InternalMode(client dclient.APIClient) func(*testing.T) {
223 223
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
224 224
 
225 225
 		ctx := context.Background()
226
-		id1 := container.Run(t, ctx, client,
226
+		id1 := container.Run(ctx, t, client,
227 227
 			container.WithNetworkMode(netName),
228 228
 			container.WithIPv4(netName, "172.28.220.10"),
229 229
 		)
230
-		id2 := container.Run(t, ctx, client,
230
+		id2 := container.Run(ctx, t, client,
231 231
 			container.WithNetworkMode(netName),
232 232
 			container.WithIPv4(netName, "172.28.230.10"),
233 233
 		)
... ...
@@ -259,12 +259,12 @@ func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
259 259
 
260 260
 		// 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
261 261
 		ctx := context.Background()
262
-		id1 := container.Run(t, ctx, client,
262
+		id1 := container.Run(ctx, t, client,
263 263
 			container.WithNetworkMode(netName),
264 264
 			container.WithIPv4(netName, "172.28.200.20"),
265 265
 			container.WithIPv6(netName, "2001:db8:abc8::20"),
266 266
 		)
267
-		id2 := container.Run(t, ctx, client,
267
+		id2 := container.Run(ctx, t, client,
268 268
 			container.WithNetworkMode(netName),
269 269
 			container.WithIPv4(netName, "172.28.200.21"),
270 270
 			container.WithIPv6(netName, "2001:db8:abc8::21"),
... ...
@@ -280,12 +280,12 @@ func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
280 280
 		assert.NilError(t, err)
281 281
 
282 282
 		// 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
283
-		id3 := container.Run(t, ctx, client,
283
+		id3 := container.Run(ctx, t, client,
284 284
 			container.WithNetworkMode(netName),
285 285
 			container.WithIPv4(netName, "172.28.202.20"),
286 286
 			container.WithIPv6(netName, "2001:db8:abc6::20"),
287 287
 		)
288
-		id4 := container.Run(t, ctx, client,
288
+		id4 := container.Run(ctx, t, client,
289 289
 			container.WithNetworkMode(netName),
290 290
 			container.WithIPv4(netName, "172.28.202.21"),
291 291
 			container.WithIPv6(netName, "2001:db8:abc6::21"),
... ...
@@ -326,12 +326,12 @@ func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
326 326
 
327 327
 		// 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
328 328
 		ctx := context.Background()
329
-		id1 := container.Run(t, ctx, client,
329
+		id1 := container.Run(ctx, t, client,
330 330
 			container.WithNetworkMode(netName),
331 331
 			container.WithIPv4(netName, "172.28.10.20"),
332 332
 			container.WithIPv6(netName, "2001:db8:abc9::20"),
333 333
 		)
334
-		id2 := container.Run(t, ctx, client,
334
+		id2 := container.Run(ctx, t, client,
335 335
 			container.WithNetworkMode(netName),
336 336
 			container.WithIPv4(netName, "172.28.10.21"),
337 337
 			container.WithIPv6(netName, "2001:db8:abc9::21"),
... ...
@@ -347,12 +347,12 @@ func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
347 347
 		assert.NilError(t, err)
348 348
 
349 349
 		// 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
350
-		id3 := container.Run(t, ctx, client,
350
+		id3 := container.Run(ctx, t, client,
351 351
 			container.WithNetworkMode(netName),
352 352
 			container.WithIPv4(netName, "172.28.12.20"),
353 353
 			container.WithIPv6(netName, "2001:db8:abc7::20"),
354 354
 		)
355
-		id4 := container.Run(t, ctx, client,
355
+		id4 := container.Run(ctx, t, client,
356 356
 			container.WithNetworkMode(netName),
357 357
 			container.WithIPv4(netName, "172.28.12.21"),
358 358
 			container.WithIPv6(netName, "2001:db8:abc7::21"),
... ...
@@ -392,7 +392,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
392 392
 		assert.Check(t, n.IsNetworkAvailable(client, netNameL2))
393 393
 
394 394
 		ctx := context.Background()
395
-		id1 := container.Run(t, ctx, client,
395
+		id1 := container.Run(ctx, t, client,
396 396
 			container.WithNetworkMode(netNameL2),
397 397
 		)
398 398
 		// Validate ipvlan l2 mode defaults gateway sets the default IPAM next-hop inferred from the subnet
... ...
@@ -414,7 +414,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
414 414
 		)
415 415
 		assert.Check(t, n.IsNetworkAvailable(client, netNameL3))
416 416
 
417
-		id2 := container.Run(t, ctx, client,
417
+		id2 := container.Run(ctx, t, client,
418 418
 			container.WithNetworkMode(netNameL3),
419 419
 		)
420 420
 		// Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops
... ...
@@ -141,8 +141,8 @@ func testMacvlanNilParent(client client.APIClient) func(*testing.T) {
141 141
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
142 142
 
143 143
 		ctx := context.Background()
144
-		id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
145
-		id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
144
+		id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
145
+		id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
146 146
 
147 147
 		_, err := container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
148 148
 		assert.Check(t, err == nil)
... ...
@@ -160,8 +160,8 @@ func testMacvlanInternalMode(client client.APIClient) func(*testing.T) {
160 160
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
161 161
 
162 162
 		ctx := context.Background()
163
-		id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
164
-		id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
163
+		id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
164
+		id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
165 165
 
166 166
 		timeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
167 167
 		defer cancel()
... ...
@@ -191,12 +191,12 @@ func testMacvlanMultiSubnet(client client.APIClient) func(*testing.T) {
191 191
 
192 192
 		// 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
193 193
 		ctx := context.Background()
194
-		id1 := container.Run(t, ctx, client,
194
+		id1 := container.Run(ctx, t, client,
195 195
 			container.WithNetworkMode("dualstackbridge"),
196 196
 			container.WithIPv4("dualstackbridge", "172.28.100.20"),
197 197
 			container.WithIPv6("dualstackbridge", "2001:db8:abc2::20"),
198 198
 		)
199
-		id2 := container.Run(t, ctx, client,
199
+		id2 := container.Run(ctx, t, client,
200 200
 			container.WithNetworkMode("dualstackbridge"),
201 201
 			container.WithIPv4("dualstackbridge", "172.28.100.21"),
202 202
 			container.WithIPv6("dualstackbridge", "2001:db8:abc2::21"),
... ...
@@ -212,12 +212,12 @@ func testMacvlanMultiSubnet(client client.APIClient) func(*testing.T) {
212 212
 		assert.NilError(t, err)
213 213
 
214 214
 		// 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
215
-		id3 := container.Run(t, ctx, client,
215
+		id3 := container.Run(ctx, t, client,
216 216
 			container.WithNetworkMode("dualstackbridge"),
217 217
 			container.WithIPv4("dualstackbridge", "172.28.102.20"),
218 218
 			container.WithIPv6("dualstackbridge", "2001:db8:abc4::20"),
219 219
 		)
220
-		id4 := container.Run(t, ctx, client,
220
+		id4 := container.Run(ctx, t, client,
221 221
 			container.WithNetworkMode("dualstackbridge"),
222 222
 			container.WithIPv4("dualstackbridge", "172.28.102.21"),
223 223
 			container.WithIPv6("dualstackbridge", "2001:db8:abc4::21"),
... ...
@@ -257,7 +257,7 @@ func testMacvlanAddressing(client client.APIClient) func(*testing.T) {
257 257
 		assert.Check(t, n.IsNetworkAvailable(client, netName))
258 258
 
259 259
 		ctx := context.Background()
260
-		id1 := container.Run(t, ctx, client,
260
+		id1 := container.Run(ctx, t, client,
261 261
 			container.WithNetworkMode("dualstackbridge"),
262 262
 		)
263 263
 
... ...
@@ -29,14 +29,14 @@ func TestRunContainerWithBridgeNone(t *testing.T) {
29 29
 	c := d.NewClientT(t)
30 30
 	ctx := context.Background()
31 31
 
32
-	id1 := container.Run(t, ctx, c)
32
+	id1 := container.Run(ctx, t, c)
33 33
 	defer c.ContainerRemove(ctx, id1, types.ContainerRemoveOptions{Force: true})
34 34
 
35 35
 	result, err := container.Exec(ctx, c, id1, []string{"ip", "l"})
36 36
 	assert.NilError(t, err)
37 37
 	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")
38 38
 
39
-	id2 := container.Run(t, ctx, c, container.WithNetworkMode("bridge"))
39
+	id2 := container.Run(ctx, t, c, container.WithNetworkMode("bridge"))
40 40
 	defer c.ContainerRemove(ctx, id2, types.ContainerRemoveOptions{Force: true})
41 41
 
42 42
 	result, err = container.Exec(ctx, c, id2, []string{"ip", "l"})
... ...
@@ -50,7 +50,7 @@ func TestRunContainerWithBridgeNone(t *testing.T) {
50 50
 	err = cmd.Run()
51 51
 	assert.NilError(t, err, "Failed to get current process network namespace: %+v", err)
52 52
 
53
-	id3 := container.Run(t, ctx, c, container.WithNetworkMode("host"))
53
+	id3 := container.Run(ctx, t, c, container.WithNetworkMode("host"))
54 54
 	defer c.ContainerRemove(ctx, id3, types.ContainerRemoveOptions{Force: true})
55 55
 
56 56
 	result, err = container.Exec(ctx, c, id3, []string{"sh", "-c", nsCommand})
... ...
@@ -92,7 +92,7 @@ func TestAuthZPluginAllowRequest(t *testing.T) {
92 92
 	ctx := context.Background()
93 93
 
94 94
 	// Ensure command successful
95
-	cID := container.Run(t, ctx, c)
95
+	cID := container.Run(ctx, t, c)
96 96
 
97 97
 	assertURIRecorded(t, ctrl.requestsURIs, "/containers/create")
98 98
 	assertURIRecorded(t, ctrl.requestsURIs, fmt.Sprintf("/containers/%s/start", cID))
... ...
@@ -224,7 +224,7 @@ func TestAuthZPluginAllowEventStream(t *testing.T) {
224 224
 	defer cancel()
225 225
 
226 226
 	// Create a container and wait for the creation events
227
-	cID := container.Run(t, ctx, c)
227
+	cID := container.Run(ctx, t, c)
228 228
 	poll.WaitOn(t, container.IsInState(ctx, c, cID, "running"))
229 229
 
230 230
 	created := false
... ...
@@ -348,7 +348,7 @@ func TestAuthZPluginEnsureLoadImportWorking(t *testing.T) {
348 348
 
349 349
 	exportedImagePath := filepath.Join(tmp, "export.tar")
350 350
 
351
-	cID := container.Run(t, ctx, c)
351
+	cID := container.Run(ctx, t, c)
352 352
 
353 353
 	responseReader, err := c.ContainerExport(context.Background(), cID)
354 354
 	assert.NilError(t, err)
... ...
@@ -388,7 +388,7 @@ func TestAuthzPluginEnsureContainerCopyToFrom(t *testing.T) {
388 388
 	c := d.NewClientT(t)
389 389
 	ctx := context.Background()
390 390
 
391
-	cID := container.Run(t, ctx, c)
391
+	cID := container.Run(ctx, t, c)
392 392
 	defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
393 393
 
394 394
 	_, err = f.Seek(0, io.SeekStart)
... ...
@@ -55,7 +55,7 @@ func TestAuthZPluginV2AllowNonVolumeRequest(t *testing.T) {
55 55
 	d.LoadBusybox(t)
56 56
 
57 57
 	// Ensure docker run command and accompanying docker ps are successful
58
-	cID := container.Run(t, ctx, c)
58
+	cID := container.Run(ctx, t, c)
59 59
 
60 60
 	_, err = c.ContainerInspect(ctx, cID)
61 61
 	assert.NilError(t, err)
... ...
@@ -399,7 +399,7 @@ func testGraphDriverPull(c client.APIClient, d *daemon.Daemon) func(*testing.T)
399 399
 		_, err = io.Copy(ioutil.Discard, r)
400 400
 		assert.NilError(t, err)
401 401
 
402
-		container.Run(t, ctx, c, container.WithImage("busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0"))
402
+		container.Run(ctx, t, c, container.WithImage("busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0"))
403 403
 	}
404 404
 }
405 405
 
... ...
@@ -439,7 +439,7 @@ func TestGraphdriverPluginV2(t *testing.T) {
439 439
 
440 440
 // nolint: golint
441 441
 func testGraphDriver(t *testing.T, c client.APIClient, ctx context.Context, driverName string, afterContainerRunFn func(*testing.T)) { //nolint: golint
442
-	id := container.Run(t, ctx, c, container.WithCmd("sh", "-c", "echo hello > /hello"))
442
+	id := container.Run(ctx, t, c, container.WithCmd("sh", "-c", "echo hello > /hello"))
443 443
 
444 444
 	if afterContainerRunFn != nil {
445 445
 		afterContainerRunFn(t)
... ...
@@ -33,7 +33,7 @@ func TestContinueAfterPluginCrash(t *testing.T) {
33 33
 
34 34
 	ctx, cancel = context.WithTimeout(context.Background(), 60*time.Second)
35 35
 
36
-	id := container.Run(t, ctx, client,
36
+	id := container.Run(ctx, t, client,
37 37
 		container.WithAutoRemove,
38 38
 		container.WithLogDriver("test"),
39 39
 		container.WithCmd(
... ...
@@ -30,7 +30,7 @@ func TestEventsExecDie(t *testing.T) {
30 30
 	ctx := context.Background()
31 31
 	client := testEnv.APIClient()
32 32
 
33
-	cID := container.Run(t, ctx, client)
33
+	cID := container.Run(ctx, t, client)
34 34
 
35 35
 	id, err := client.ContainerExecCreate(ctx, cID,
36 36
 		types.ExecConfig{