integration: change container.Create signature to fix linting
```
Line 25: warning: context.Context should be the first parameter of a function (golint)
Line 44: warning: context.Context should be the first parameter of a function (golint)
Line 52: 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 b4c46b0dac
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
91757722a9
commit
9c49308cce
13 changed files with 24 additions and 25 deletions
|
@ -26,7 +26,7 @@ func TestCopyFromContainerPathDoesNotExist(t *testing.T) {
|
|||
|
||||
ctx := context.Background()
|
||||
apiclient := testEnv.APIClient()
|
||||
cid := container.Create(t, ctx, apiclient)
|
||||
cid := container.Create(ctx, t, apiclient)
|
||||
|
||||
_, _, err := apiclient.CopyFromContainer(ctx, cid, "/dne")
|
||||
assert.Check(t, client.IsErrNotFound(err))
|
||||
|
@ -40,7 +40,7 @@ func TestCopyFromContainerPathIsNotDir(t *testing.T) {
|
|||
|
||||
ctx := context.Background()
|
||||
apiclient := testEnv.APIClient()
|
||||
cid := container.Create(t, ctx, apiclient)
|
||||
cid := container.Create(ctx, t, apiclient)
|
||||
|
||||
_, _, err := apiclient.CopyFromContainer(ctx, cid, "/etc/passwd/")
|
||||
assert.Assert(t, is.ErrorContains(err, "not a directory"))
|
||||
|
@ -52,7 +52,7 @@ func TestCopyToContainerPathDoesNotExist(t *testing.T) {
|
|||
|
||||
ctx := context.Background()
|
||||
apiclient := testEnv.APIClient()
|
||||
cid := container.Create(t, ctx, apiclient)
|
||||
cid := container.Create(ctx, t, apiclient)
|
||||
|
||||
err := apiclient.CopyToContainer(ctx, cid, "/dne", nil, types.CopyToContainerOptions{})
|
||||
assert.Check(t, client.IsErrNotFound(err))
|
||||
|
@ -66,7 +66,7 @@ func TestCopyToContainerPathIsNotDir(t *testing.T) {
|
|||
|
||||
ctx := context.Background()
|
||||
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{})
|
||||
assert.Assert(t, is.ErrorContains(err, "not a directory"))
|
||||
|
|
|
@ -40,7 +40,7 @@ func TestContainerStartOnDaemonRestart(t *testing.T) {
|
|||
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Create(t, ctx, c)
|
||||
cID := container.Create(ctx, t, c)
|
||||
defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
|
||||
|
||||
err := c.ContainerStart(ctx, cID, types.ContainerStartOptions{})
|
||||
|
|
|
@ -67,7 +67,7 @@ func TestExportContainerAfterDaemonRestart(t *testing.T) {
|
|||
defer d.Stop(t)
|
||||
|
||||
ctx := context.Background()
|
||||
ctrID := container.Create(t, ctx, c)
|
||||
ctrID := container.Create(ctx, t, c)
|
||||
|
||||
d.Restart(t)
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ func TestIpcModeOlderClient(t *testing.T) {
|
|||
ctx := context.Background()
|
||||
|
||||
// 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)
|
||||
assert.NilError(t, err)
|
||||
|
@ -316,7 +316,7 @@ func TestIpcModeOlderClient(t *testing.T) {
|
|||
|
||||
// main check: using older client creates "shareable" container
|
||||
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)
|
||||
assert.NilError(t, err)
|
||||
|
|
|
@ -113,7 +113,7 @@ func TestKillStoppedContainer(t *testing.T) {
|
|||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := testEnv.APIClient()
|
||||
id := container.Create(t, ctx, client)
|
||||
id := container.Create(ctx, t, client)
|
||||
err := client.ContainerKill(ctx, id, "SIGKILL")
|
||||
assert.Assert(t, is.ErrorContains(err, ""))
|
||||
assert.Assert(t, is.Contains(err.Error(), "is not running"))
|
||||
|
@ -124,7 +124,7 @@ func TestKillStoppedContainerAPIPre120(t *testing.T) {
|
|||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
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")
|
||||
assert.NilError(t, err)
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ func TestPsFilter(t *testing.T) {
|
|||
client := testEnv.APIClient()
|
||||
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 {
|
||||
var entries []string
|
||||
|
|
|
@ -19,7 +19,7 @@ func TestCommitInheritsEnv(t *testing.T) {
|
|||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID1 := container.Create(t, ctx, client)
|
||||
cID1 := container.Create(ctx, t, client)
|
||||
|
||||
commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
|
||||
Changes: []string{"ENV PATH=/bin"},
|
||||
|
@ -33,7 +33,7 @@ func TestCommitInheritsEnv(t *testing.T) {
|
|||
expectedEnv1 := []string{"PATH=/bin"}
|
||||
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{
|
||||
Changes: []string{"ENV PATH=/usr/bin:$PATH"},
|
||||
|
|
|
@ -20,7 +20,7 @@ func TestRemoveImageOrphaning(t *testing.T) {
|
|||
img := "test-container-orphaning"
|
||||
|
||||
// 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{
|
||||
Changes: []string{`ENTRYPOINT ["true"]`},
|
||||
Reference: img,
|
||||
|
@ -33,7 +33,7 @@ func TestRemoveImageOrphaning(t *testing.T) {
|
|||
assert.Check(t, is.Equal(resp.ID, commitResp1.ID))
|
||||
|
||||
// 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{
|
||||
Changes: []string{`LABEL Maintainer="Integration Tests"`},
|
||||
Reference: img,
|
||||
|
|
|
@ -22,8 +22,7 @@ type TestContainerConfig struct {
|
|||
}
|
||||
|
||||
// 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()
|
||||
cmd := []string{"top"}
|
||||
if runtime.GOOS == "windows" {
|
||||
|
@ -52,7 +51,7 @@ func Create(t *testing.T, ctx context.Context, client client.APIClient, ops ...f
|
|||
// nolint: golint
|
||||
func Run(t *testing.T, ctx context.Context, client client.APIClient, ops ...func(*TestContainerConfig)) string { // nolint: golint
|
||||
t.Helper()
|
||||
id := Create(t, ctx, client, ops...)
|
||||
id := Create(ctx, t, client, ops...)
|
||||
|
||||
err := client.ContainerStart(ctx, id, types.ContainerStartOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
|
|
@ -29,7 +29,7 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
|
|||
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{
|
||||
EndpointsConfig: map[string]*network.EndpointSettings{
|
||||
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(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{
|
||||
EndpointsConfig: map[string]*network.EndpointSettings{
|
||||
name: {},
|
||||
|
|
|
@ -41,7 +41,7 @@ func TestCgroupDriverSystemdMemoryLimit(t *testing.T) {
|
|||
const mem = 64 * 1024 * 1024 // 64 MB
|
||||
|
||||
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
|
||||
})
|
||||
defer c.ContainerRemove(ctx, ctrID, types.ContainerRemoveOptions{Force: true})
|
||||
|
|
|
@ -83,7 +83,7 @@ func TestEventsBackwardsCompatible(t *testing.T) {
|
|||
since := request.DaemonTime(ctx, t, client, testEnv)
|
||||
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),
|
||||
// The test here makes sure the response time is less than 3 sec.
|
||||
|
|
|
@ -68,7 +68,7 @@ func TestVolumesRemove(t *testing.T) {
|
|||
|
||||
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)
|
||||
assert.NilError(t, err)
|
||||
|
|
Loading…
Reference in a new issue