diff --git a/docker_test.go b/docker_test.go index b298f9e2afc..afdde1eeb5f 100644 --- a/docker_test.go +++ b/docker_test.go @@ -4,12 +4,13 @@ import ( "context" "errors" "fmt" - "github.com/docker/docker/errdefs" "net/http" "path/filepath" "testing" "time" + "github.com/docker/docker/errdefs" + "github.com/docker/docker/api/types/volume" "database/sql" @@ -38,7 +39,7 @@ func TestContainerAttachedToNewNetwork(t *testing.T) { networkName, }, NetworkAliases: map[string][]string{ - networkName: []string{ + networkName: { "alias1", "alias2", "alias3", }, }, @@ -1187,7 +1188,8 @@ func TestContainerNonExistentImage(t *testing.T) { t.Run("if the image not found don't propagate the error", func(t *testing.T) { _, err := GenericContainer(context.Background(), GenericContainerRequest{ ContainerRequest: ContainerRequest{ - Image: "postgres:nonexistent-version", + Image: "postgres:nonexistent-version", + SkipReaper: true, }, Started: true, }) @@ -1199,11 +1201,13 @@ func TestContainerNonExistentImage(t *testing.T) { }) t.Run("the context cancellation is propagated to container creation", func(t *testing.T) { - ctx, _ := context.WithTimeout(context.Background(), time.Millisecond*100) + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() _, err := GenericContainer(ctx, GenericContainerRequest{ ContainerRequest: ContainerRequest{ Image: "postgres:latest", WaitingFor: wait.ForLog("log"), + SkipReaper: true, }, Started: true, })