Skip to content

Commit 9f9b429

Browse files
committed
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 <[email protected]>
1 parent b4c46b0 commit 9f9b429

35 files changed

+108
-109
lines changed

integration/build/build_squash_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func TestBuildSquashParent(t *testing.T) {
7979
resp.Body.Close()
8080
assert.NilError(t, err)
8181

82-
cid := container.Run(t, ctx, client,
82+
cid := container.Run(ctx, t, client,
8383
container.WithImage(name),
8484
container.WithCmd("/bin/sh", "-c", "cat /hello"),
8585
)
@@ -94,11 +94,11 @@ func TestBuildSquashParent(t *testing.T) {
9494
assert.NilError(t, err)
9595
assert.Check(t, is.Equal(strings.TrimSpace(actualStdout.String()), "hello\nworld"))
9696

97-
container.Run(t, ctx, client,
97+
container.Run(ctx, t, client,
9898
container.WithImage(name),
9999
container.WithCmd("/bin/sh", "-c", "[ ! -f /remove_me ]"),
100100
)
101-
container.Run(t, ctx, client,
101+
container.Run(ctx, t, client,
102102
container.WithImage(name),
103103
container.WithCmd("/bin/sh", "-c", `[ "$(echo $HELLO)" == "world" ]`),
104104
)

integration/container/checkpoint_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func TestCheckpoint(t *testing.T) {
5050
}
5151

5252
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))
5454
poll.WaitOn(t,
5555
container.IsInState(ctx, client, cID, "running"),
5656
poll.WithDelay(100*time.Millisecond),

integration/container/daemon_linux_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func TestDaemonRestartIpcMode(t *testing.T) {
9494
ctx := context.Background()
9595

9696
// 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,
9898
container.WithCmd("top"),
9999
container.WithRestartPolicy("always"),
100100
)
@@ -113,7 +113,7 @@ func TestDaemonRestartIpcMode(t *testing.T) {
113113
assert.Check(t, is.Equal(string(inspect.HostConfig.IpcMode), "private"))
114114

115115
// 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)
117117
defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
118118

119119
inspect, err = c.ContainerInspect(ctx, cID)

integration/container/diff_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestDiff(t *testing.T) {
1919
client := testEnv.APIClient()
2020
ctx := context.Background()
2121

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`))
2323

2424
// Wait for it to exit as cannot diff a running container on Windows, and
2525
// it will take a few seconds to exit. Also there's no way in Windows to

integration/container/exec_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestExecWithCloseStdin(t *testing.T) {
2424
client := testEnv.APIClient()
2525

2626
// run top with detached mode
27-
cID := container.Run(t, ctx, client)
27+
cID := container.Run(ctx, t, client)
2828

2929
expected := "closeIO"
3030
execResp, err := client.ContainerExecCreate(ctx, cID,
@@ -90,7 +90,7 @@ func TestExec(t *testing.T) {
9090
ctx := context.Background()
9191
client := testEnv.APIClient()
9292

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"))
9494

9595
id, err := client.ContainerExecCreate(ctx, cID,
9696
types.ExecConfig{
@@ -125,7 +125,7 @@ func TestExecUser(t *testing.T) {
125125
ctx := context.Background()
126126
client := testEnv.APIClient()
127127

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"))
129129

130130
result, err := container.Exec(ctx, client, cID, []string{"id"})
131131
assert.NilError(t, err)

integration/container/export_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestExportContainerAndImportImage(t *testing.T) {
2525
client := testEnv.APIClient()
2626
ctx := context.Background()
2727

28-
cID := container.Run(t, ctx, client, container.WithCmd("true"))
28+
cID := container.Run(ctx, t, client, container.WithCmd("true"))
2929
poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
3030

3131
reference := "repo/testexp:v1"

integration/container/health_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestHealthCheckWorkdir(t *testing.T) {
2121
ctx := context.Background()
2222
client := testEnv.APIClient()
2323

24-
cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
24+
cID := container.Run(ctx, t, client, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
2525
c.Config.Healthcheck = &containertypes.HealthConfig{
2626
Test: []string{"CMD-SHELL", "if [ \"$PWD\" = \"/foo\" ]; then exit 0; else exit 1; fi;"},
2727
Interval: 50 * time.Millisecond,

integration/container/inspect_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestInspectCpusetInConfigPre120(t *testing.T) {
2424

2525
name := "cpusetinconfig-pre120-" + t.Name()
2626
// 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),
2828
container.WithCmd("true"),
2929
func(c *container.TestContainerConfig) {
3030
c.HostConfig.Resources.CpusetCpus = "0"

integration/container/kill_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestKillContainerInvalidSignal(t *testing.T) {
1818
defer setupTest(t)()
1919
client := testEnv.APIClient()
2020
ctx := context.Background()
21-
id := container.Run(t, ctx, client)
21+
id := container.Run(ctx, t, client)
2222

2323
err := client.ContainerKill(ctx, id, "0")
2424
assert.Error(t, err, "Error response from daemon: Invalid signal: 0")
@@ -60,7 +60,7 @@ func TestKillContainer(t *testing.T) {
6060
tc := tc
6161
t.Run(tc.doc, func(t *testing.T) {
6262
ctx := context.Background()
63-
id := container.Run(t, ctx, client)
63+
id := container.Run(ctx, t, client)
6464
err := client.ContainerKill(ctx, id, tc.signal)
6565
assert.NilError(t, err)
6666

@@ -95,7 +95,7 @@ func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
9595
tc := tc
9696
t.Run(tc.doc, func(t *testing.T) {
9797
ctx := context.Background()
98-
id := container.Run(t, ctx, client,
98+
id := container.Run(ctx, t, client,
9999
container.WithRestartPolicy("always"),
100100
func(c *container.TestContainerConfig) {
101101
c.Config.StopSignal = tc.stopsignal
@@ -137,7 +137,7 @@ func TestKillDifferentUserContainer(t *testing.T) {
137137
ctx := context.Background()
138138
client := request.NewAPIClient(t, client.WithVersion("1.19"))
139139

140-
id := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
140+
id := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
141141
c.Config.User = "daemon"
142142
})
143143
poll.WaitOn(t, container.IsInState(ctx, client, id, "running"), poll.WithDelay(100*time.Millisecond))
@@ -154,7 +154,7 @@ func TestInspectOomKilledTrue(t *testing.T) {
154154
ctx := context.Background()
155155
client := testEnv.APIClient()
156156

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) {
158158
c.HostConfig.Resources.Memory = 32 * 1024 * 1024
159159
})
160160

@@ -172,7 +172,7 @@ func TestInspectOomKilledFalse(t *testing.T) {
172172
ctx := context.Background()
173173
client := testEnv.APIClient()
174174

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"))
176176

177177
poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
178178

integration/container/links_linux_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestLinksEtcHostsContentMatch(t *testing.T) {
2424
client := testEnv.APIClient()
2525
ctx := context.Background()
2626

27-
cID := container.Run(t, ctx, client, container.WithNetworkMode("host"))
27+
cID := container.Run(ctx, t, client, container.WithNetworkMode("host"))
2828
res, err := container.Exec(ctx, client, cID, []string{"cat", "/etc/hosts"})
2929
assert.NilError(t, err)
3030
assert.Assert(t, is.Len(res.Stderr(), 0))
@@ -42,8 +42,8 @@ func TestLinksContainerNames(t *testing.T) {
4242

4343
containerA := "first_" + t.Name()
4444
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))
4747

4848
f := filters.NewArgs(filters.Arg("name", containerA))
4949

0 commit comments

Comments
 (0)