diff --git a/TESTING.md b/TESTING.md index 1231e1c5f4..34ad843638 100644 --- a/TESTING.md +++ b/TESTING.md @@ -8,11 +8,11 @@ questions you may have as an aspiring Moby contributor. Moby has two test suites (and one legacy test suite): * Unit tests - use standard `go test` and - [gotestyourself/assert](https://godoc.org/github.com/gotestyourself/gotestyourself/assert) assertions. They are located in + [gotest.tools/assert](https://godoc.org/gotest.tools/assert) assertions. They are located in the package they test. Unit tests should be fast and test only their own package. * API integration tests - use standard `go test` and - [gotestyourself/assert](https://godoc.org/github.com/gotestyourself/gotestyourself/assert) assertions. They are located in + [gotest.tools/assert](https://godoc.org/gotest.tools/assert) assertions. They are located in `./integration/` directories, where `component` is: container, image, volume, etc. These tests perform HTTP requests to an API endpoint and check the HTTP response and daemon state after the call. diff --git a/api/server/middleware/debug_test.go b/api/server/middleware/debug_test.go index cc227b3248..a64b73e0d7 100644 --- a/api/server/middleware/debug_test.go +++ b/api/server/middleware/debug_test.go @@ -3,8 +3,8 @@ package middleware // import "github.com/docker/docker/api/server/middleware" import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestMaskSecretKeys(t *testing.T) { diff --git a/api/server/middleware/version_test.go b/api/server/middleware/version_test.go index c439c8abfc..edbc0bcaa5 100644 --- a/api/server/middleware/version_test.go +++ b/api/server/middleware/version_test.go @@ -8,8 +8,8 @@ import ( "testing" "github.com/docker/docker/api/server/httputils" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestVersionMiddlewareVersion(t *testing.T) { diff --git a/api/types/filters/parse_test.go b/api/types/filters/parse_test.go index fbd9ae4fb1..e8345a1d5d 100644 --- a/api/types/filters/parse_test.go +++ b/api/types/filters/parse_test.go @@ -4,8 +4,8 @@ import ( "errors" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestParseArgs(t *testing.T) { diff --git a/builder/dockerfile/buildargs_test.go b/builder/dockerfile/buildargs_test.go index c3f6104862..c3b82c83f4 100644 --- a/builder/dockerfile/buildargs_test.go +++ b/builder/dockerfile/buildargs_test.go @@ -5,8 +5,8 @@ import ( "strings" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func strPtr(source string) *string { diff --git a/builder/dockerfile/copy_test.go b/builder/dockerfile/copy_test.go index f2f895387c..f559ff4fd8 100644 --- a/builder/dockerfile/copy_test.go +++ b/builder/dockerfile/copy_test.go @@ -5,9 +5,9 @@ import ( "testing" "github.com/docker/docker/pkg/containerfs" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" ) func TestIsExistingDirectory(t *testing.T) { diff --git a/builder/dockerfile/dispatchers_test.go b/builder/dockerfile/dispatchers_test.go index a5474d6db8..36d20a1a82 100644 --- a/builder/dockerfile/dispatchers_test.go +++ b/builder/dockerfile/dispatchers_test.go @@ -14,10 +14,10 @@ import ( "github.com/docker/docker/image" "github.com/docker/docker/pkg/system" "github.com/docker/go-connections/nat" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/moby/buildkit/frontend/dockerfile/instructions" "github.com/moby/buildkit/frontend/dockerfile/shell" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func newBuilderWithMockBackend() *Builder { diff --git a/builder/dockerfile/evaluator_test.go b/builder/dockerfile/evaluator_test.go index 4657b1c580..fb79b238e8 100644 --- a/builder/dockerfile/evaluator_test.go +++ b/builder/dockerfile/evaluator_test.go @@ -7,10 +7,10 @@ import ( "github.com/docker/docker/builder/remotecontext" "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/reexec" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" "github.com/moby/buildkit/frontend/dockerfile/instructions" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) type dispatchTestCase struct { @@ -97,7 +97,7 @@ func initDispatchTestCases() []dispatchTestCase { } func TestDispatch(t *testing.T) { - skip.IfCondition(t, os.Getuid() != 0, "skipping test that requires root") + skip.If(t, os.Getuid() != 0, "skipping test that requires root") testCases := initDispatchTestCases() for _, testCase := range testCases { diff --git a/builder/dockerfile/internals_linux_test.go b/builder/dockerfile/internals_linux_test.go index c244ddfe3f..1b3a99893a 100644 --- a/builder/dockerfile/internals_linux_test.go +++ b/builder/dockerfile/internals_linux_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/docker/docker/pkg/idtools" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestChownFlagParsing(t *testing.T) { diff --git a/builder/dockerfile/internals_test.go b/builder/dockerfile/internals_test.go index afd4a45f88..1c34fd3871 100644 --- a/builder/dockerfile/internals_test.go +++ b/builder/dockerfile/internals_test.go @@ -13,9 +13,9 @@ import ( "github.com/docker/docker/builder/remotecontext" "github.com/docker/docker/pkg/archive" "github.com/docker/go-connections/nat" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestEmptyDockerfile(t *testing.T) { @@ -61,7 +61,7 @@ func TestNonExistingDockerfile(t *testing.T) { } func readAndCheckDockerfile(t *testing.T, testName, contextDir, dockerfilePath, expectedError string) { - skip.IfCondition(t, os.Getuid() != 0, "skipping test that requires root") + skip.If(t, os.Getuid() != 0, "skipping test that requires root") tarStream, err := archive.Tar(contextDir, archive.Uncompressed) assert.NilError(t, err) diff --git a/builder/dockerfile/internals_windows_test.go b/builder/dockerfile/internals_windows_test.go index ffe52fb132..4f00623404 100644 --- a/builder/dockerfile/internals_windows_test.go +++ b/builder/dockerfile/internals_windows_test.go @@ -6,8 +6,8 @@ import ( "fmt" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestNormalizeDest(t *testing.T) { diff --git a/builder/fscache/fscache_test.go b/builder/fscache/fscache_test.go index 16712ff743..5108d65df1 100644 --- a/builder/fscache/fscache_test.go +++ b/builder/fscache/fscache_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/moby/buildkit/session/filesync" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestFSCache(t *testing.T) { diff --git a/builder/remotecontext/git/gitutils_test.go b/builder/remotecontext/git/gitutils_test.go index a46675b22b..8c39679081 100644 --- a/builder/remotecontext/git/gitutils_test.go +++ b/builder/remotecontext/git/gitutils_test.go @@ -14,8 +14,8 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestParseRemoteURL(t *testing.T) { diff --git a/builder/remotecontext/mimetype_test.go b/builder/remotecontext/mimetype_test.go index b13429cfa8..df9c378770 100644 --- a/builder/remotecontext/mimetype_test.go +++ b/builder/remotecontext/mimetype_test.go @@ -3,8 +3,8 @@ package remotecontext // import "github.com/docker/docker/builder/remotecontext" import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestDetectContentType(t *testing.T) { diff --git a/builder/remotecontext/remote_test.go b/builder/remotecontext/remote_test.go index 64442d5107..a0101f7493 100644 --- a/builder/remotecontext/remote_test.go +++ b/builder/remotecontext/remote_test.go @@ -10,9 +10,9 @@ import ( "testing" "github.com/docker/docker/builder" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" ) var binaryContext = []byte{0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00} //xz magic diff --git a/builder/remotecontext/tarsum_test.go b/builder/remotecontext/tarsum_test.go index b05e4449ff..46f128d9f0 100644 --- a/builder/remotecontext/tarsum_test.go +++ b/builder/remotecontext/tarsum_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/builder" "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/reexec" - "github.com/gotestyourself/gotestyourself/skip" "github.com/pkg/errors" + "gotest.tools/skip" ) const ( @@ -137,7 +137,7 @@ func TestRemoveDirectory(t *testing.T) { } func makeTestArchiveContext(t *testing.T, dir string) builder.Source { - skip.IfCondition(t, os.Getuid() != 0, "skipping test that requires root") + skip.If(t, os.Getuid() != 0, "skipping test that requires root") tarStream, err := archive.Tar(dir, archive.Uncompressed) if err != nil { t.Fatalf("error: %s", err) diff --git a/client/client_test.go b/client/client_test.go index 403aa9f3f0..58bccaa311 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -10,10 +10,10 @@ import ( "github.com/docker/docker/api" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/env" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/env" + "gotest.tools/skip" ) func TestNewEnvClient(t *testing.T) { diff --git a/client/config_create_test.go b/client/config_create_test.go index 8675e7f541..a6408792db 100644 --- a/client/config_create_test.go +++ b/client/config_create_test.go @@ -12,8 +12,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestConfigCreateUnsupported(t *testing.T) { diff --git a/client/config_inspect_test.go b/client/config_inspect_test.go index b0c30fa279..76a5dae9e5 100644 --- a/client/config_inspect_test.go +++ b/client/config_inspect_test.go @@ -11,9 +11,9 @@ import ( "testing" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestConfigInspectNotFound(t *testing.T) { diff --git a/client/config_list_test.go b/client/config_list_test.go index e01d3d4c9d..b35a592953 100644 --- a/client/config_list_test.go +++ b/client/config_list_test.go @@ -13,8 +13,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestConfigListUnsupported(t *testing.T) { diff --git a/client/config_remove_test.go b/client/config_remove_test.go index d574c5be0c..9c0c0f9337 100644 --- a/client/config_remove_test.go +++ b/client/config_remove_test.go @@ -9,8 +9,8 @@ import ( "strings" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestConfigRemoveUnsupported(t *testing.T) { diff --git a/client/config_update_test.go b/client/config_update_test.go index 8b82d42eda..1299f8278c 100644 --- a/client/config_update_test.go +++ b/client/config_update_test.go @@ -10,8 +10,8 @@ import ( "testing" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestConfigUpdateUnsupported(t *testing.T) { diff --git a/client/container_logs_test.go b/client/container_logs_test.go index f4ba0e76b4..6d6e34e101 100644 --- a/client/container_logs_test.go +++ b/client/container_logs_test.go @@ -14,8 +14,8 @@ import ( "time" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestContainerLogsNotFoundError(t *testing.T) { diff --git a/client/container_prune_test.go b/client/container_prune_test.go index 9efb7b5854..6a830d01dc 100644 --- a/client/container_prune_test.go +++ b/client/container_prune_test.go @@ -12,8 +12,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestContainersPruneError(t *testing.T) { diff --git a/client/container_remove_test.go b/client/container_remove_test.go index 8a2d01b188..d94d831304 100644 --- a/client/container_remove_test.go +++ b/client/container_remove_test.go @@ -10,8 +10,8 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestContainerRemoveError(t *testing.T) { diff --git a/client/distribution_inspect_test.go b/client/distribution_inspect_test.go index d3c6828df1..a23d5f55d5 100644 --- a/client/distribution_inspect_test.go +++ b/client/distribution_inspect_test.go @@ -5,9 +5,9 @@ import ( "net/http" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestDistributionInspectUnsupported(t *testing.T) { diff --git a/client/hijack_test.go b/client/hijack_test.go index dea5addb8c..823bf344f5 100644 --- a/client/hijack_test.go +++ b/client/hijack_test.go @@ -11,9 +11,9 @@ import ( "github.com/docker/docker/api/server/httputils" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" "golang.org/x/net/context" + "gotest.tools/assert" ) func TestTLSCloseWriter(t *testing.T) { diff --git a/client/image_prune_test.go b/client/image_prune_test.go index 3de3226f83..9b0839bb6c 100644 --- a/client/image_prune_test.go +++ b/client/image_prune_test.go @@ -12,8 +12,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestImagesPruneError(t *testing.T) { diff --git a/client/image_remove_test.go b/client/image_remove_test.go index 274d450ac4..acc6bc9177 100644 --- a/client/image_remove_test.go +++ b/client/image_remove_test.go @@ -11,8 +11,8 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestImageRemoveError(t *testing.T) { diff --git a/client/network_inspect_test.go b/client/network_inspect_test.go index 4f4919e305..699bccba67 100644 --- a/client/network_inspect_test.go +++ b/client/network_inspect_test.go @@ -12,9 +12,9 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/network" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestNetworkInspectError(t *testing.T) { diff --git a/client/network_prune_test.go b/client/network_prune_test.go index f67b6ab4d3..7a5d340e51 100644 --- a/client/network_prune_test.go +++ b/client/network_prune_test.go @@ -12,8 +12,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestNetworksPruneError(t *testing.T) { diff --git a/client/ping_test.go b/client/ping_test.go index a26a136e3e..10bbbe811d 100644 --- a/client/ping_test.go +++ b/client/ping_test.go @@ -8,8 +8,8 @@ import ( "strings" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) // TestPingFail tests that when a server sends a non-successful response that we diff --git a/client/request_test.go b/client/request_test.go index e45a8651a0..fda4d88aa1 100644 --- a/client/request_test.go +++ b/client/request_test.go @@ -10,7 +10,7 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // TestSetHostHeader should set fake host for local communications, set real host diff --git a/client/secret_create_test.go b/client/secret_create_test.go index 83f99cd09c..419bdbcbc6 100644 --- a/client/secret_create_test.go +++ b/client/secret_create_test.go @@ -12,8 +12,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestSecretCreateUnsupported(t *testing.T) { diff --git a/client/secret_inspect_test.go b/client/secret_inspect_test.go index 75782324a2..6c84799b17 100644 --- a/client/secret_inspect_test.go +++ b/client/secret_inspect_test.go @@ -11,9 +11,9 @@ import ( "testing" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestSecretInspectUnsupported(t *testing.T) { diff --git a/client/secret_list_test.go b/client/secret_list_test.go index 4fc3235f3d..72323b055f 100644 --- a/client/secret_list_test.go +++ b/client/secret_list_test.go @@ -13,8 +13,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestSecretListUnsupported(t *testing.T) { diff --git a/client/secret_remove_test.go b/client/secret_remove_test.go index 03e0316cab..bdfccf6be8 100644 --- a/client/secret_remove_test.go +++ b/client/secret_remove_test.go @@ -9,8 +9,8 @@ import ( "strings" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestSecretRemoveUnsupported(t *testing.T) { diff --git a/client/secret_update_test.go b/client/secret_update_test.go index d0ce89cda2..c7670b440c 100644 --- a/client/secret_update_test.go +++ b/client/secret_update_test.go @@ -10,8 +10,8 @@ import ( "testing" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestSecretUpdateUnsupported(t *testing.T) { diff --git a/client/service_create_test.go b/client/service_create_test.go index 1ef2f422cd..9f51c18223 100644 --- a/client/service_create_test.go +++ b/client/service_create_test.go @@ -13,10 +13,10 @@ import ( "github.com/docker/docker/api/types" registrytypes "github.com/docker/docker/api/types/registry" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/opencontainers/go-digest" "github.com/opencontainers/image-spec/specs-go/v1" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestServiceCreateError(t *testing.T) { diff --git a/client/service_logs_test.go b/client/service_logs_test.go index c3d624e212..28f3ab5c6b 100644 --- a/client/service_logs_test.go +++ b/client/service_logs_test.go @@ -14,8 +14,8 @@ import ( "time" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestServiceLogsError(t *testing.T) { diff --git a/client/service_remove_test.go b/client/service_remove_test.go index 45892ceb2f..d2379a1366 100644 --- a/client/service_remove_test.go +++ b/client/service_remove_test.go @@ -9,8 +9,8 @@ import ( "strings" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestServiceRemoveError(t *testing.T) { diff --git a/client/swarm_get_unlock_key_test.go b/client/swarm_get_unlock_key_test.go index be822cb8aa..a1e460c1dc 100644 --- a/client/swarm_get_unlock_key_test.go +++ b/client/swarm_get_unlock_key_test.go @@ -11,8 +11,8 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestSwarmGetUnlockKeyError(t *testing.T) { diff --git a/client/volume_inspect_test.go b/client/volume_inspect_test.go index d0a3246689..04f00129b7 100644 --- a/client/volume_inspect_test.go +++ b/client/volume_inspect_test.go @@ -11,9 +11,9 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestVolumeInspectError(t *testing.T) { diff --git a/cmd/dockerd/config_unix_test.go b/cmd/dockerd/config_unix_test.go index eaa53d8f6f..d7dbf4b4cc 100644 --- a/cmd/dockerd/config_unix_test.go +++ b/cmd/dockerd/config_unix_test.go @@ -6,9 +6,9 @@ import ( "testing" "github.com/docker/docker/daemon/config" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/spf13/pflag" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestDaemonParseShmSize(t *testing.T) { diff --git a/cmd/dockerd/daemon_test.go b/cmd/dockerd/daemon_test.go index 539b442cbd..ad447e3b90 100644 --- a/cmd/dockerd/daemon_test.go +++ b/cmd/dockerd/daemon_test.go @@ -4,11 +4,11 @@ import ( "testing" "github.com/docker/docker/daemon/config" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" "github.com/sirupsen/logrus" "github.com/spf13/pflag" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" ) func defaultOptions(configFile string) *daemonOptions { diff --git a/cmd/dockerd/daemon_unix_test.go b/cmd/dockerd/daemon_unix_test.go index 39ff1e6822..692d0328c4 100644 --- a/cmd/dockerd/daemon_unix_test.go +++ b/cmd/dockerd/daemon_unix_test.go @@ -6,9 +6,9 @@ import ( "testing" "github.com/docker/docker/daemon/config" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" ) func TestLoadDaemonCliConfigWithDaemonFlags(t *testing.T) { diff --git a/cmd/dockerd/options_test.go b/cmd/dockerd/options_test.go index 2a4e63b6b6..691118f08f 100644 --- a/cmd/dockerd/options_test.go +++ b/cmd/dockerd/options_test.go @@ -6,9 +6,9 @@ import ( cliconfig "github.com/docker/docker/cli/config" "github.com/docker/docker/daemon/config" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/spf13/pflag" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestCommonOptionsInstallFlags(t *testing.T) { diff --git a/container/container_unit_test.go b/container/container_unit_test.go index fbee6e5eb0..82b5864760 100644 --- a/container/container_unit_test.go +++ b/container/container_unit_test.go @@ -11,7 +11,7 @@ import ( swarmtypes "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/daemon/logger/jsonfilelog" "github.com/docker/docker/pkg/signal" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestContainerStopSignal(t *testing.T) { diff --git a/container/view_test.go b/container/view_test.go index a872dffea6..434b7c618d 100644 --- a/container/view_test.go +++ b/container/view_test.go @@ -8,9 +8,9 @@ import ( "github.com/docker/docker/api/types" containertypes "github.com/docker/docker/api/types/container" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pborman/uuid" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) var root string diff --git a/daemon/cluster/convert/service_test.go b/daemon/cluster/convert/service_test.go index 826cf6fbef..ad5f0d4494 100644 --- a/daemon/cluster/convert/service_test.go +++ b/daemon/cluster/convert/service_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/api/types/swarm/runtime" swarmapi "github.com/docker/swarmkit/api" google_protobuf3 "github.com/gogo/protobuf/types" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestServiceConvertFromGRPCRuntimeContainer(t *testing.T) { diff --git a/daemon/cluster/executor/container/container_test.go b/daemon/cluster/executor/container/container_test.go index f9e8c8a92e..1bf6f6cf02 100644 --- a/daemon/cluster/executor/container/container_test.go +++ b/daemon/cluster/executor/container/container_test.go @@ -5,7 +5,7 @@ import ( "github.com/docker/docker/api/types/container" swarmapi "github.com/docker/swarmkit/api" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestIsolationConversion(t *testing.T) { diff --git a/daemon/config/config_test.go b/daemon/config/config_test.go index cb7aa74071..6998ed3312 100644 --- a/daemon/config/config_test.go +++ b/daemon/config/config_test.go @@ -8,11 +8,11 @@ import ( "github.com/docker/docker/daemon/discovery" "github.com/docker/docker/opts" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" - "github.com/gotestyourself/gotestyourself/skip" "github.com/spf13/pflag" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" + "gotest.tools/skip" ) func TestDaemonConfigurationNotFound(t *testing.T) { @@ -461,7 +461,7 @@ func TestReloadSetConfigFileNotExist(t *testing.T) { // TestReloadDefaultConfigNotExist tests that if the default configuration file // doesn't exist the daemon still will be reloaded. func TestReloadDefaultConfigNotExist(t *testing.T) { - skip.IfCondition(t, os.Getuid() != 0, "skipping test that requires root") + skip.If(t, os.Getuid() != 0, "skipping test that requires root") reloaded := false configFile := "/etc/docker/daemon.json" flags := pflag.NewFlagSet("test", pflag.ContinueOnError) diff --git a/daemon/config/config_unix_test.go b/daemon/config/config_unix_test.go index d9bb9476ac..529b677705 100644 --- a/daemon/config/config_unix_test.go +++ b/daemon/config/config_unix_test.go @@ -7,10 +7,10 @@ import ( "github.com/docker/docker/opts" "github.com/docker/go-units" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" "github.com/spf13/pflag" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" ) func TestGetConflictFreeConfiguration(t *testing.T) { diff --git a/daemon/config/config_windows_test.go b/daemon/config/config_windows_test.go index fff98014f9..09417ee388 100644 --- a/daemon/config/config_windows_test.go +++ b/daemon/config/config_windows_test.go @@ -7,9 +7,9 @@ import ( "testing" "github.com/docker/docker/opts" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/spf13/pflag" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestDaemonConfigurationMerge(t *testing.T) { diff --git a/daemon/container_unix_test.go b/daemon/container_unix_test.go index 12075f8b8d..b4c5f84c7e 100644 --- a/daemon/container_unix_test.go +++ b/daemon/container_unix_test.go @@ -9,7 +9,7 @@ import ( containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/daemon/config" "github.com/docker/go-connections/nat" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // TestContainerWarningHostAndPublishPorts that a warning is returned when setting network mode to host and specifying published ports. diff --git a/daemon/create_test.go b/daemon/create_test.go index 7ef49d7623..3dba847d46 100644 --- a/daemon/create_test.go +++ b/daemon/create_test.go @@ -5,7 +5,7 @@ import ( "github.com/docker/docker/api/types/network" "github.com/docker/docker/errdefs" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // Test case for 35752 diff --git a/daemon/daemon_linux_test.go b/daemon/daemon_linux_test.go index 1635b08535..767925e2fb 100644 --- a/daemon/daemon_linux_test.go +++ b/daemon/daemon_linux_test.go @@ -15,8 +15,8 @@ import ( "github.com/docker/docker/oci" "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/mount" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) const mountsFixture = `142 78 0:38 / / rw,relatime - aufs none rw,si=573b861da0b3a05b,dio diff --git a/daemon/daemon_test.go b/daemon/daemon_test.go index 4e068194f0..43f4f504b6 100644 --- a/daemon/daemon_test.go +++ b/daemon/daemon_test.go @@ -16,9 +16,9 @@ import ( volumesservice "github.com/docker/docker/volume/service" "github.com/docker/go-connections/nat" "github.com/docker/libnetwork" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) // diff --git a/daemon/delete_test.go b/daemon/delete_test.go index 4af206d9c6..d600917b0c 100644 --- a/daemon/delete_test.go +++ b/daemon/delete_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/api/types" containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/container" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func newDaemonWithTmpRoot(t *testing.T) (*Daemon, func()) { diff --git a/daemon/discovery/discovery_test.go b/daemon/discovery/discovery_test.go index d00e02e10b..c354a2918d 100644 --- a/daemon/discovery/discovery_test.go +++ b/daemon/discovery/discovery_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestDiscoveryOptsErrors(t *testing.T) { diff --git a/daemon/exec_linux_test.go b/daemon/exec_linux_test.go index 9e5496ae4b..0db7f080db 100644 --- a/daemon/exec_linux_test.go +++ b/daemon/exec_linux_test.go @@ -8,9 +8,9 @@ import ( containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/container" "github.com/docker/docker/daemon/exec" - "github.com/gotestyourself/gotestyourself/assert" "github.com/opencontainers/runc/libcontainer/apparmor" "github.com/opencontainers/runtime-spec/specs-go" + "gotest.tools/assert" ) func TestExecSetPlatformOpt(t *testing.T) { diff --git a/daemon/graphdriver/aufs/aufs_test.go b/daemon/graphdriver/aufs/aufs_test.go index 2338ad320d..fdc502ba65 100644 --- a/daemon/graphdriver/aufs/aufs_test.go +++ b/daemon/graphdriver/aufs/aufs_test.go @@ -17,8 +17,8 @@ import ( "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/reexec" "github.com/docker/docker/pkg/stringid" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) var ( diff --git a/daemon/graphdriver/copy/copy_test.go b/daemon/graphdriver/copy/copy_test.go index b41348827d..0f3b1670f7 100644 --- a/daemon/graphdriver/copy/copy_test.go +++ b/daemon/graphdriver/copy/copy_test.go @@ -13,9 +13,9 @@ import ( "time" "github.com/docker/docker/pkg/system" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "golang.org/x/sys/unix" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestCopy(t *testing.T) { diff --git a/daemon/graphdriver/driver_test.go b/daemon/graphdriver/driver_test.go index 4a29465f15..e6f973c397 100644 --- a/daemon/graphdriver/driver_test.go +++ b/daemon/graphdriver/driver_test.go @@ -6,7 +6,7 @@ import ( "path/filepath" "testing" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestIsEmptyDir(t *testing.T) { diff --git a/daemon/graphdriver/graphtest/graphbench_unix.go b/daemon/graphdriver/graphtest/graphbench_unix.go index 1b221dabef..22de8d1781 100644 --- a/daemon/graphdriver/graphtest/graphbench_unix.go +++ b/daemon/graphdriver/graphtest/graphbench_unix.go @@ -9,7 +9,7 @@ import ( contdriver "github.com/containerd/continuity/driver" "github.com/docker/docker/pkg/stringid" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // DriverBenchExists benchmarks calls to exist diff --git a/daemon/graphdriver/graphtest/graphtest_unix.go b/daemon/graphdriver/graphtest/graphtest_unix.go index 5ac3979752..e83d0bb2ad 100644 --- a/daemon/graphdriver/graphtest/graphtest_unix.go +++ b/daemon/graphdriver/graphtest/graphtest_unix.go @@ -16,9 +16,9 @@ import ( "github.com/docker/docker/daemon/graphdriver/quota" "github.com/docker/docker/pkg/stringid" "github.com/docker/go-units" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "golang.org/x/sys/unix" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) var ( diff --git a/daemon/graphdriver/graphtest/testutil_unix.go b/daemon/graphdriver/graphtest/testutil_unix.go index 3103df150d..6871dca09a 100644 --- a/daemon/graphdriver/graphtest/testutil_unix.go +++ b/daemon/graphdriver/graphtest/testutil_unix.go @@ -9,9 +9,9 @@ import ( contdriver "github.com/containerd/continuity/driver" "github.com/docker/docker/daemon/graphdriver" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "golang.org/x/sys/unix" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func verifyFile(t testing.TB, path string, mode os.FileMode, uid, gid uint32) { diff --git a/daemon/graphdriver/quota/projectquota_test.go b/daemon/graphdriver/quota/projectquota_test.go index 2f1bf593de..aa164cc419 100644 --- a/daemon/graphdriver/quota/projectquota_test.go +++ b/daemon/graphdriver/quota/projectquota_test.go @@ -10,10 +10,10 @@ import ( "path/filepath" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" "golang.org/x/sys/unix" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" ) // 10MB diff --git a/daemon/info_unix_test.go b/daemon/info_unix_test.go index 7ff1009326..a5a4e06f98 100644 --- a/daemon/info_unix_test.go +++ b/daemon/info_unix_test.go @@ -7,8 +7,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/dockerversion" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestParseInitVersion(t *testing.T) { diff --git a/daemon/inspect_test.go b/daemon/inspect_test.go index d1ad5b0e0a..f402a7af99 100644 --- a/daemon/inspect_test.go +++ b/daemon/inspect_test.go @@ -7,8 +7,8 @@ import ( "github.com/docker/docker/container" "github.com/docker/docker/daemon/config" "github.com/docker/docker/daemon/exec" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestGetInspectData(t *testing.T) { diff --git a/daemon/list_test.go b/daemon/list_test.go index d35eac3cd6..3be510d13d 100644 --- a/daemon/list_test.go +++ b/daemon/list_test.go @@ -6,8 +6,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/container" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestListInvalidFilter(t *testing.T) { diff --git a/daemon/logger/adapter_test.go b/daemon/logger/adapter_test.go index e9143928b4..f47e711c89 100644 --- a/daemon/logger/adapter_test.go +++ b/daemon/logger/adapter_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/api/types/plugins/logdriver" protoio "github.com/gogo/protobuf/io" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) // mockLoggingPlugin implements the loggingPlugin interface for testing purposes diff --git a/daemon/logger/awslogs/cloudwatchlogs_test.go b/daemon/logger/awslogs/cloudwatchlogs_test.go index b8e49055e8..6955d910c3 100644 --- a/daemon/logger/awslogs/cloudwatchlogs_test.go +++ b/daemon/logger/awslogs/cloudwatchlogs_test.go @@ -21,8 +21,8 @@ import ( "github.com/docker/docker/daemon/logger" "github.com/docker/docker/daemon/logger/loggerutils" "github.com/docker/docker/dockerversion" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) const ( diff --git a/daemon/logger/jsonfilelog/jsonfilelog_test.go b/daemon/logger/jsonfilelog/jsonfilelog_test.go index 2becd694b0..22bbcf2eb7 100644 --- a/daemon/logger/jsonfilelog/jsonfilelog_test.go +++ b/daemon/logger/jsonfilelog/jsonfilelog_test.go @@ -14,9 +14,9 @@ import ( "github.com/docker/docker/daemon/logger" "github.com/docker/docker/daemon/logger/jsonfilelog/jsonlog" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" ) func TestJSONFileLogger(t *testing.T) { diff --git a/daemon/logger/jsonfilelog/jsonlog/jsonlogbytes_test.go b/daemon/logger/jsonfilelog/jsonlog/jsonlogbytes_test.go index b3bfe6b18c..d268db4df0 100644 --- a/daemon/logger/jsonfilelog/jsonlog/jsonlogbytes_test.go +++ b/daemon/logger/jsonfilelog/jsonlog/jsonlogbytes_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestJSONLogsMarshalJSONBuf(t *testing.T) { diff --git a/daemon/logger/jsonfilelog/jsonlog/time_marshalling_test.go b/daemon/logger/jsonfilelog/jsonlog/time_marshalling_test.go index 3cfdcc33db..b3959b0467 100644 --- a/daemon/logger/jsonfilelog/jsonlog/time_marshalling_test.go +++ b/daemon/logger/jsonfilelog/jsonlog/time_marshalling_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestFastTimeMarshalJSONWithInvalidYear(t *testing.T) { diff --git a/daemon/logger/jsonfilelog/read_test.go b/daemon/logger/jsonfilelog/read_test.go index f89fabfe1c..cad8003e5e 100644 --- a/daemon/logger/jsonfilelog/read_test.go +++ b/daemon/logger/jsonfilelog/read_test.go @@ -6,8 +6,8 @@ import ( "time" "github.com/docker/docker/daemon/logger" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/fs" + "gotest.tools/assert" + "gotest.tools/fs" ) func BenchmarkJSONFileLoggerReadLogs(b *testing.B) { diff --git a/daemon/logger/splunk/splunk_test.go b/daemon/logger/splunk/splunk_test.go index 62895a6dd6..cfb83e80d1 100644 --- a/daemon/logger/splunk/splunk_test.go +++ b/daemon/logger/splunk/splunk_test.go @@ -11,8 +11,8 @@ import ( "time" "github.com/docker/docker/daemon/logger" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/env" + "gotest.tools/assert" + "gotest.tools/env" ) // Validate options diff --git a/daemon/logger/templates/templates_test.go b/daemon/logger/templates/templates_test.go index b767037477..25e7c88750 100644 --- a/daemon/logger/templates/templates_test.go +++ b/daemon/logger/templates/templates_test.go @@ -4,8 +4,8 @@ import ( "bytes" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestNewParse(t *testing.T) { diff --git a/daemon/oci_linux_test.go b/daemon/oci_linux_test.go index e28fac004e..e618951ef9 100644 --- a/daemon/oci_linux_test.go +++ b/daemon/oci_linux_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/daemon/config" "github.com/docker/docker/oci" "github.com/docker/docker/pkg/idtools" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) // TestTmpfsDevShmNoDupMount checks that a user-specified /dev/shm tmpfs diff --git a/daemon/reload_test.go b/daemon/reload_test.go index c4d15d93e5..ffad297f71 100644 --- a/daemon/reload_test.go +++ b/daemon/reload_test.go @@ -13,8 +13,8 @@ import ( _ "github.com/docker/docker/pkg/discovery/memory" "github.com/docker/docker/registry" "github.com/docker/libnetwork" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestDaemonReloadLabels(t *testing.T) { diff --git a/daemon/resize_test.go b/daemon/resize_test.go index dea26c6116..edfe9d3ed1 100644 --- a/daemon/resize_test.go +++ b/daemon/resize_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/container" "github.com/docker/docker/daemon/exec" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // This test simply verify that when a wrong ID used, a specific error should be returned for exec resize. diff --git a/daemon/trustkey_test.go b/daemon/trustkey_test.go index e13129e467..e49e76aa3e 100644 --- a/daemon/trustkey_test.go +++ b/daemon/trustkey_test.go @@ -6,9 +6,9 @@ import ( "path/filepath" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" ) // LoadOrCreateTrustKey diff --git a/distribution/metadata/v1_id_service_test.go b/distribution/metadata/v1_id_service_test.go index 7bac8e8212..5003897cbb 100644 --- a/distribution/metadata/v1_id_service_test.go +++ b/distribution/metadata/v1_id_service_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/docker/docker/layer" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestV1IDService(t *testing.T) { diff --git a/distribution/pull_v2_test.go b/distribution/pull_v2_test.go index 1079b5fe53..ca3470c8cf 100644 --- a/distribution/pull_v2_test.go +++ b/distribution/pull_v2_test.go @@ -10,9 +10,9 @@ import ( "github.com/docker/distribution/manifest/schema1" "github.com/docker/distribution/reference" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/opencontainers/go-digest" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) // TestFixManifestLayers checks that fixManifestLayers removes a duplicate diff --git a/image/fs_test.go b/image/fs_test.go index e8c120a003..6290c2b66e 100644 --- a/image/fs_test.go +++ b/image/fs_test.go @@ -10,9 +10,9 @@ import ( "path/filepath" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/opencontainers/go-digest" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func defaultFSStoreBackend(t *testing.T) (StoreBackend, func()) { diff --git a/image/image_test.go b/image/image_test.go index dfb438b4d3..981be0b68c 100644 --- a/image/image_test.go +++ b/image/image_test.go @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/layer" "github.com/google/go-cmp/cmp" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) const sampleImageJSON = `{ diff --git a/image/store_test.go b/image/store_test.go index d59cde9195..0edf3282af 100644 --- a/image/store_test.go +++ b/image/store_test.go @@ -6,9 +6,9 @@ import ( "testing" "github.com/docker/docker/layer" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/opencontainers/go-digest" + "gotest.tools/assert" + "gotest.tools/assert/cmp" ) func TestRestore(t *testing.T) { diff --git a/integration-cli/cli/build/build.go b/integration-cli/cli/build/build.go index 71048d0d6d..0b10ea79f8 100644 --- a/integration-cli/cli/build/build.go +++ b/integration-cli/cli/build/build.go @@ -5,7 +5,7 @@ import ( "strings" "github.com/docker/docker/internal/test/fakecontext" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) type testingT interface { diff --git a/integration-cli/cli/cli.go b/integration-cli/cli/cli.go index 17f3fd52ca..bc3f3c194e 100644 --- a/integration-cli/cli/cli.go +++ b/integration-cli/cli/cli.go @@ -8,9 +8,9 @@ import ( "github.com/docker/docker/integration-cli/daemon" "github.com/docker/docker/integration-cli/environment" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/icmd" "github.com/pkg/errors" + "gotest.tools/assert" + "gotest.tools/icmd" ) var testEnv *environment.Execution diff --git a/integration-cli/daemon/daemon.go b/integration-cli/daemon/daemon.go index fcbbfdfb0c..3d1fa38d5d 100644 --- a/integration-cli/daemon/daemon.go +++ b/integration-cli/daemon/daemon.go @@ -8,9 +8,9 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/internal/test/daemon" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/icmd" "github.com/pkg/errors" + "gotest.tools/assert" + "gotest.tools/icmd" ) type testingT interface { diff --git a/integration-cli/daemon/daemon_swarm.go b/integration-cli/daemon/daemon_swarm.go index c38f5a69e0..4a6ce8a5c5 100644 --- a/integration-cli/daemon/daemon_swarm.go +++ b/integration-cli/daemon/daemon_swarm.go @@ -11,7 +11,7 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration-cli/checker" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // CheckServiceTasksInState returns the number of tasks with a matching state, diff --git a/integration-cli/docker_api_build_test.go b/integration-cli/docker_api_build_test.go index 581df8d5c7..144acbd046 100644 --- a/integration-cli/docker_api_build_test.go +++ b/integration-cli/docker_api_build_test.go @@ -19,8 +19,8 @@ import ( "github.com/docker/docker/internal/test/fakestorage" "github.com/docker/docker/internal/test/request" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func (s *DockerSuite) TestBuildAPIDockerFileRemote(c *check.C) { diff --git a/integration-cli/docker_api_build_windows_test.go b/integration-cli/docker_api_build_windows_test.go index 92d3f5e134..a605c5be39 100644 --- a/integration-cli/docker_api_build_windows_test.go +++ b/integration-cli/docker_api_build_windows_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/internal/test/request" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func (s *DockerSuite) TestBuildWithRecycleBin(c *check.C) { diff --git a/integration-cli/docker_api_containers_test.go b/integration-cli/docker_api_containers_test.go index 31d6077880..e8e47bd8b1 100644 --- a/integration-cli/docker_api_containers_test.go +++ b/integration-cli/docker_api_containers_test.go @@ -33,9 +33,9 @@ import ( "github.com/docker/docker/volume" "github.com/docker/go-connections/nat" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" ) func (s *DockerSuite) TestContainerAPIGetAll(c *check.C) { diff --git a/integration-cli/docker_api_containers_windows_test.go b/integration-cli/docker_api_containers_windows_test.go index 8b71fc6077..c569574de5 100644 --- a/integration-cli/docker_api_containers_windows_test.go +++ b/integration-cli/docker_api_containers_windows_test.go @@ -14,8 +14,8 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/mount" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func (s *DockerSuite) TestContainersAPICreateMountsBindNamedPipe(c *check.C) { diff --git a/integration-cli/docker_api_inspect_test.go b/integration-cli/docker_api_inspect_test.go index 5d7aa55903..68055b6c14 100644 --- a/integration-cli/docker_api_inspect_test.go +++ b/integration-cli/docker_api_inspect_test.go @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration-cli/checker" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func (s *DockerSuite) TestInspectAPIContainerResponse(c *check.C) { diff --git a/integration-cli/docker_api_swarm_service_test.go b/integration-cli/docker_api_swarm_service_test.go index 2e27c7e93d..1a826c99c6 100644 --- a/integration-cli/docker_api_swarm_service_test.go +++ b/integration-cli/docker_api_swarm_service_test.go @@ -17,8 +17,8 @@ import ( "github.com/docker/docker/integration-cli/daemon" testdaemon "github.com/docker/docker/internal/test/daemon" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" "golang.org/x/sys/unix" + "gotest.tools/icmd" ) func setPortConfig(portConfig []swarm.PortConfig) testdaemon.ServiceConstructor { diff --git a/integration-cli/docker_api_swarm_test.go b/integration-cli/docker_api_swarm_test.go index 11cdd89215..6a31dd209f 100644 --- a/integration-cli/docker_api_swarm_test.go +++ b/integration-cli/docker_api_swarm_test.go @@ -26,8 +26,8 @@ import ( "github.com/docker/docker/internal/test/request" "github.com/docker/swarmkit/ca" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) var defaultReconciliationTimeout = 30 * time.Second diff --git a/integration-cli/docker_cli_attach_test.go b/integration-cli/docker_cli_attach_test.go index 353cb65e5d..ef2c708bbe 100644 --- a/integration-cli/docker_cli_attach_test.go +++ b/integration-cli/docker_cli_attach_test.go @@ -12,7 +12,7 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) const attachWait = 5 * time.Second diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index a0ac9c767f..1e88b1ba39 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -16,7 +16,6 @@ import ( "text/template" "time" - "github.com/moby/buildkit/frontend/dockerfile/command" "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" @@ -26,8 +25,9 @@ import ( "github.com/docker/docker/internal/testutil" "github.com/docker/docker/pkg/archive" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "github.com/moby/buildkit/frontend/dockerfile/command" "github.com/opencontainers/go-digest" + "gotest.tools/icmd" ) func (s *DockerSuite) TestBuildJSONEmptyRun(c *check.C) { diff --git a/integration-cli/docker_cli_build_unix_test.go b/integration-cli/docker_cli_build_unix_test.go index 4b313f95c1..8cad28f457 100644 --- a/integration-cli/docker_cli_build_unix_test.go +++ b/integration-cli/docker_cli_build_unix_test.go @@ -21,7 +21,7 @@ import ( "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/go-units" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) { diff --git a/integration-cli/docker_cli_by_digest_test.go b/integration-cli/docker_cli_by_digest_test.go index ac97e0aecc..006cf11e1a 100644 --- a/integration-cli/docker_cli_by_digest_test.go +++ b/integration-cli/docker_cli_by_digest_test.go @@ -15,9 +15,9 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/opencontainers/go-digest" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) var ( diff --git a/integration-cli/docker_cli_cp_test.go b/integration-cli/docker_cli_cp_test.go index b33be6b209..ec53712fab 100644 --- a/integration-cli/docker_cli_cp_test.go +++ b/integration-cli/docker_cli_cp_test.go @@ -12,7 +12,7 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) const ( diff --git a/integration-cli/docker_cli_daemon_plugins_test.go b/integration-cli/docker_cli_daemon_plugins_test.go index 2f66bc05e2..69e190c30d 100644 --- a/integration-cli/docker_cli_daemon_plugins_test.go +++ b/integration-cli/docker_cli_daemon_plugins_test.go @@ -8,8 +8,8 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/pkg/mount" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" "golang.org/x/sys/unix" + "gotest.tools/icmd" ) // TestDaemonRestartWithPluginEnabled tests state restore for an enabled plugin diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index 347696e8a4..d2ff9606e5 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/integration-cli/docker_cli_daemon_test.go @@ -39,9 +39,9 @@ import ( "github.com/docker/libnetwork/iptables" "github.com/docker/libtrust" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" "github.com/kr/pty" "golang.org/x/sys/unix" + "gotest.tools/icmd" ) // TestLegacyDaemonCommand test starting docker daemon using "deprecated" docker daemon diff --git a/integration-cli/docker_cli_events_test.go b/integration-cli/docker_cli_events_test.go index 28e418ea3b..db1e34020f 100644 --- a/integration-cli/docker_cli_events_test.go +++ b/integration-cli/docker_cli_events_test.go @@ -20,7 +20,7 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) { diff --git a/integration-cli/docker_cli_exec_test.go b/integration-cli/docker_cli_exec_test.go index d0557c56a0..e97fb85140 100644 --- a/integration-cli/docker_cli_exec_test.go +++ b/integration-cli/docker_cli_exec_test.go @@ -20,7 +20,7 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func (s *DockerSuite) TestExec(c *check.C) { diff --git a/integration-cli/docker_cli_export_import_test.go b/integration-cli/docker_cli_export_import_test.go index 6405c1bb5e..d0dac97367 100644 --- a/integration-cli/docker_cli_export_import_test.go +++ b/integration-cli/docker_cli_export_import_test.go @@ -6,7 +6,7 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) // TODO: Move this test to docker/cli, as it is essentially the same test diff --git a/integration-cli/docker_cli_images_test.go b/integration-cli/docker_cli_images_test.go index 2a1152eb50..0dd319fbc9 100644 --- a/integration-cli/docker_cli_images_test.go +++ b/integration-cli/docker_cli_images_test.go @@ -14,7 +14,7 @@ import ( "github.com/docker/docker/integration-cli/cli/build" "github.com/docker/docker/pkg/stringid" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func (s *DockerSuite) TestImagesEnsureImageIsListed(c *check.C) { diff --git a/integration-cli/docker_cli_import_test.go b/integration-cli/docker_cli_import_test.go index eb0fe2cf8c..9f8e915803 100644 --- a/integration-cli/docker_cli_import_test.go +++ b/integration-cli/docker_cli_import_test.go @@ -12,7 +12,7 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/cli" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func (s *DockerSuite) TestImportDisplay(c *check.C) { diff --git a/integration-cli/docker_cli_inspect_test.go b/integration-cli/docker_cli_inspect_test.go index a1130aebf5..d027c44775 100644 --- a/integration-cli/docker_cli_inspect_test.go +++ b/integration-cli/docker_cli_inspect_test.go @@ -12,7 +12,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/integration-cli/checker" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func checkValidGraphDriver(c *check.C, name string) { diff --git a/integration-cli/docker_cli_logs_test.go b/integration-cli/docker_cli_logs_test.go index fb99b2807d..17ee5deaad 100644 --- a/integration-cli/docker_cli_logs_test.go +++ b/integration-cli/docker_cli_logs_test.go @@ -12,7 +12,7 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/pkg/jsonmessage" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) // This used to work, it test a log of PageSize-1 (gh#4851) diff --git a/integration-cli/docker_cli_network_unix_test.go b/integration-cli/docker_cli_network_unix_test.go index 1087d0045d..95f7ccfff0 100644 --- a/integration-cli/docker_cli_network_unix_test.go +++ b/integration-cli/docker_cli_network_unix_test.go @@ -27,9 +27,9 @@ import ( remoteipam "github.com/docker/libnetwork/ipams/remote/api" "github.com/docker/libnetwork/netlabel" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" "github.com/vishvananda/netlink" "golang.org/x/sys/unix" + "gotest.tools/icmd" ) const dummyNetworkDriver = "dummy-network-driver" diff --git a/integration-cli/docker_cli_proxy_test.go b/integration-cli/docker_cli_proxy_test.go index bdb4772592..52159aa9c5 100644 --- a/integration-cli/docker_cli_proxy_test.go +++ b/integration-cli/docker_cli_proxy_test.go @@ -6,7 +6,7 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func (s *DockerSuite) TestCLIProxyDisableProxyUnixSock(c *check.C) { diff --git a/integration-cli/docker_cli_prune_unix_test.go b/integration-cli/docker_cli_prune_unix_test.go index 259b486766..d60420b591 100644 --- a/integration-cli/docker_cli_prune_unix_test.go +++ b/integration-cli/docker_cli_prune_unix_test.go @@ -15,7 +15,7 @@ import ( "github.com/docker/docker/integration-cli/cli/build" "github.com/docker/docker/integration-cli/daemon" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func pruneNetworkAndVerify(c *check.C, d *daemon.Daemon, kept, pruned []string) { diff --git a/integration-cli/docker_cli_ps_test.go b/integration-cli/docker_cli_ps_test.go index 771c9d70d5..a975bc3542 100644 --- a/integration-cli/docker_cli_ps_test.go +++ b/integration-cli/docker_cli_ps_test.go @@ -13,7 +13,7 @@ import ( "github.com/docker/docker/integration-cli/cli/build" "github.com/docker/docker/pkg/stringid" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func (s *DockerSuite) TestPsListContainersBase(c *check.C) { diff --git a/integration-cli/docker_cli_pull_local_test.go b/integration-cli/docker_cli_pull_local_test.go index 31afdfb539..33d4ae5e7c 100644 --- a/integration-cli/docker_cli_pull_local_test.go +++ b/integration-cli/docker_cli_pull_local_test.go @@ -16,8 +16,8 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/cli/build" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" "github.com/opencontainers/go-digest" + "gotest.tools/icmd" ) // testPullImageWithAliases pulls a specific image tag and verifies that any aliases (i.e., other diff --git a/integration-cli/docker_cli_push_test.go b/integration-cli/docker_cli_push_test.go index 382260a5c7..01ad829192 100644 --- a/integration-cli/docker_cli_push_test.go +++ b/integration-cli/docker_cli_push_test.go @@ -14,7 +14,7 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/cli/build" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) // Pushing an image to a private registry. diff --git a/integration-cli/docker_cli_rmi_test.go b/integration-cli/docker_cli_rmi_test.go index aedfa13a81..6622856823 100644 --- a/integration-cli/docker_cli_rmi_test.go +++ b/integration-cli/docker_cli_rmi_test.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/integration-cli/cli/build" "github.com/docker/docker/pkg/stringid" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) { diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go index 7e0efdc08f..aaaa7174d3 100644 --- a/integration-cli/docker_cli_run_test.go +++ b/integration-cli/docker_cli_run_test.go @@ -36,7 +36,7 @@ import ( "github.com/docker/libnetwork/resolvconf" "github.com/docker/libnetwork/types" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) // "test123" should be printed by docker run diff --git a/integration-cli/docker_cli_run_unix_test.go b/integration-cli/docker_cli_run_unix_test.go index 70acbb37f3..3444d22bfd 100644 --- a/integration-cli/docker_cli_run_unix_test.go +++ b/integration-cli/docker_cli_run_unix_test.go @@ -26,8 +26,8 @@ import ( "github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/sysinfo" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" "github.com/kr/pty" + "gotest.tools/icmd" ) // #6509 diff --git a/integration-cli/docker_cli_save_load_test.go b/integration-cli/docker_cli_save_load_test.go index d370b6cc5e..688eac684e 100644 --- a/integration-cli/docker_cli_save_load_test.go +++ b/integration-cli/docker_cli_save_load_test.go @@ -18,8 +18,8 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/cli/build" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" "github.com/opencontainers/go-digest" + "gotest.tools/icmd" ) // save a repo using gz compression and try to load it using stdout diff --git a/integration-cli/docker_cli_save_load_unix_test.go b/integration-cli/docker_cli_save_load_unix_test.go index fcbfd7e627..da520e41c0 100644 --- a/integration-cli/docker_cli_save_load_unix_test.go +++ b/integration-cli/docker_cli_save_load_unix_test.go @@ -14,8 +14,8 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/cli/build" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" "github.com/kr/pty" + "gotest.tools/icmd" ) // save a repo and try to load it using stdout diff --git a/integration-cli/docker_cli_service_health_test.go b/integration-cli/docker_cli_service_health_test.go index ac525d08ea..ae9e7868bb 100644 --- a/integration-cli/docker_cli_service_health_test.go +++ b/integration-cli/docker_cli_service_health_test.go @@ -12,7 +12,7 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) // start a service, and then make its task unhealthy during running diff --git a/integration-cli/docker_cli_service_logs_test.go b/integration-cli/docker_cli_service_logs_test.go index c26a7455a5..ba337491b1 100644 --- a/integration-cli/docker_cli_service_logs_test.go +++ b/integration-cli/docker_cli_service_logs_test.go @@ -13,7 +13,7 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/daemon" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) type logMessage struct { diff --git a/integration-cli/docker_cli_start_test.go b/integration-cli/docker_cli_start_test.go index 98f7beaea9..cbe917bf4f 100644 --- a/integration-cli/docker_cli_start_test.go +++ b/integration-cli/docker_cli_start_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/cli" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) // Regression test for https://github.com/docker/docker/issues/7843 diff --git a/integration-cli/docker_cli_swarm_test.go b/integration-cli/docker_cli_swarm_test.go index 94013d82b3..057c0d94c8 100644 --- a/integration-cli/docker_cli_swarm_test.go +++ b/integration-cli/docker_cli_swarm_test.go @@ -27,9 +27,9 @@ import ( remoteipam "github.com/docker/libnetwork/ipams/remote/api" "github.com/docker/swarmkit/ca/keyutils" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/fs" - "github.com/gotestyourself/gotestyourself/icmd" "github.com/vishvananda/netlink" + "gotest.tools/fs" + "gotest.tools/icmd" ) func (s *DockerSwarmSuite) TestSwarmUpdate(c *check.C) { diff --git a/integration-cli/docker_cli_top_test.go b/integration-cli/docker_cli_top_test.go index b8924d3b50..50744b0111 100644 --- a/integration-cli/docker_cli_top_test.go +++ b/integration-cli/docker_cli_top_test.go @@ -5,7 +5,7 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func (s *DockerSuite) TestTopMultipleArgs(c *check.C) { diff --git a/integration-cli/docker_cli_volume_test.go b/integration-cli/docker_cli_volume_test.go index ad1e96577c..340bdfe254 100644 --- a/integration-cli/docker_cli_volume_test.go +++ b/integration-cli/docker_cli_volume_test.go @@ -16,7 +16,7 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/cli/build" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func (s *DockerSuite) TestVolumeCLICreate(c *check.C) { diff --git a/integration-cli/docker_cli_wait_test.go b/integration-cli/docker_cli_wait_test.go index e8047042d0..669e54f1ae 100644 --- a/integration-cli/docker_cli_wait_test.go +++ b/integration-cli/docker_cli_wait_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/integration-cli/checker" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) // non-blocking wait with 0 exit code diff --git a/integration-cli/docker_utils_test.go b/integration-cli/docker_utils_test.go index 19fdcff19a..1c05bf5d04 100644 --- a/integration-cli/docker_utils_test.go +++ b/integration-cli/docker_utils_test.go @@ -21,7 +21,7 @@ import ( "github.com/docker/docker/integration-cli/daemon" "github.com/docker/docker/internal/test/request" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) // Deprecated diff --git a/integration-cli/requirements_test.go b/integration-cli/requirements_test.go index e6038edb18..28be59cd2c 100644 --- a/integration-cli/requirements_test.go +++ b/integration-cli/requirements_test.go @@ -60,7 +60,7 @@ func OnlyDefaultNetworks() bool { return true } -// Deprecated: use skip.IfCondition(t, !testEnv.DaemonInfo.ExperimentalBuild) +// Deprecated: use skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild) func ExperimentalDaemon() bool { return testEnv.DaemonInfo.ExperimentalBuild } diff --git a/integration-cli/utils_test.go b/integration-cli/utils_test.go index 33913c3922..fd083681f2 100644 --- a/integration-cli/utils_test.go +++ b/integration-cli/utils_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/internal/testutil" "github.com/go-check/check" - "github.com/gotestyourself/gotestyourself/icmd" "github.com/pkg/errors" + "gotest.tools/icmd" ) func getPrefixAndSlashFromDaemonPlatform() (prefix, slash string) { @@ -21,7 +21,7 @@ func getPrefixAndSlashFromDaemonPlatform() (prefix, slash string) { } // TODO: update code to call cmd.RunCmd directly, and remove this function -// Deprecated: use gotestyourself/gotestyourself/icmd +// Deprecated: use gotest.tools/icmd func runCommandWithOutput(execCmd *exec.Cmd) (string, int, error) { result := icmd.RunCmd(transformCmd(execCmd)) return result.Combined(), result.ExitCode, result.Error diff --git a/integration/build/build_session_test.go b/integration/build/build_session_test.go index c2f9362944..dde4b427b4 100644 --- a/integration/build/build_session_test.go +++ b/integration/build/build_session_test.go @@ -10,12 +10,12 @@ import ( dclient "github.com/docker/docker/client" "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/filesync" "golang.org/x/sync/errgroup" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestBuildWithSession(t *testing.T) { diff --git a/integration/build/build_squash_test.go b/integration/build/build_squash_test.go index 9110604e4f..4cd282a976 100644 --- a/integration/build/build_squash_test.go +++ b/integration/build/build_squash_test.go @@ -12,9 +12,9 @@ import ( "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/pkg/stdcopy" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestBuildSquashParent(t *testing.T) { diff --git a/integration/build/build_test.go b/integration/build/build_test.go index ee9631d3ff..25c5e635bd 100644 --- a/integration/build/build_test.go +++ b/integration/build/build_test.go @@ -16,9 +16,9 @@ import ( "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/jsonmessage" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestBuildWithRemoveAndForceRemove(t *testing.T) { @@ -385,7 +385,7 @@ COPY bar /` // docker/for-linux#135 // #35641 func TestBuildMultiStageLayerLeak(t *testing.T) { - skip.IfCondition(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.37"), "broken in earlier versions") + skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.37"), "broken in earlier versions") ctx := context.TODO() defer setupTest(t)() diff --git a/integration/config/config_test.go b/integration/config/config_test.go index 1c002423ea..3cbca23899 100644 --- a/integration/config/config_test.go +++ b/integration/config/config_test.go @@ -14,9 +14,9 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/swarm" "github.com/docker/docker/pkg/stdcopy" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestConfigList(t *testing.T) { diff --git a/integration/container/copy_test.go b/integration/container/copy_test.go index 6794f98555..241b719eb7 100644 --- a/integration/container/copy_test.go +++ b/integration/container/copy_test.go @@ -8,9 +8,9 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestCopyFromContainerPathDoesNotExist(t *testing.T) { diff --git a/integration/container/create_test.go b/integration/container/create_test.go index 9c46644890..f94eb4a3fb 100644 --- a/integration/container/create_test.go +++ b/integration/container/create_test.go @@ -14,10 +14,10 @@ import ( ctr "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" "github.com/docker/docker/oci" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" + "gotest.tools/skip" ) func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) { diff --git a/integration/container/daemon_linux_test.go b/integration/container/daemon_linux_test.go index df6aa683ab..bc5c5076b8 100644 --- a/integration/container/daemon_linux_test.go +++ b/integration/container/daemon_linux_test.go @@ -11,9 +11,9 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/daemon" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" "golang.org/x/sys/unix" + "gotest.tools/assert" + "gotest.tools/skip" ) // This is a regression test for #36145 diff --git a/integration/container/diff_test.go b/integration/container/diff_test.go index fee58391e9..b4219c3627 100644 --- a/integration/container/diff_test.go +++ b/integration/container/diff_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/archive" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/poll" + "gotest.tools/assert" + "gotest.tools/poll" ) func TestDiff(t *testing.T) { diff --git a/integration/container/exec_test.go b/integration/container/exec_test.go index e1750d9414..85f9e05915 100644 --- a/integration/container/exec_test.go +++ b/integration/container/exec_test.go @@ -10,9 +10,9 @@ import ( "github.com/docker/docker/api/types/versions" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestExec(t *testing.T) { diff --git a/integration/container/export_test.go b/integration/container/export_test.go index dbeea341cd..7a9ed0aa99 100644 --- a/integration/container/export_test.go +++ b/integration/container/export_test.go @@ -12,10 +12,10 @@ import ( "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/jsonmessage" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" + "gotest.tools/skip" ) // export an image and try to import it into a new one diff --git a/integration/container/health_test.go b/integration/container/health_test.go index e13885002d..7cc196e46d 100644 --- a/integration/container/health_test.go +++ b/integration/container/health_test.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/poll" + "gotest.tools/poll" ) // TestHealthCheckWorkdir verifies that health-checks inherit the containers' diff --git a/integration/container/inspect_test.go b/integration/container/inspect_test.go index 8ed5904433..d034c53650 100644 --- a/integration/container/inspect_test.go +++ b/integration/container/inspect_test.go @@ -9,10 +9,10 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" + "gotest.tools/skip" ) func TestInspectCpusetInConfigPre120(t *testing.T) { diff --git a/integration/container/kill_test.go b/integration/container/kill_test.go index 8cef5bb897..12a9083cf3 100644 --- a/integration/container/kill_test.go +++ b/integration/container/kill_test.go @@ -9,10 +9,10 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" + "gotest.tools/skip" ) func TestKillContainerInvalidSignal(t *testing.T) { diff --git a/integration/container/links_linux_test.go b/integration/container/links_linux_test.go index 9baa32728d..f9f3cbe5ed 100644 --- a/integration/container/links_linux_test.go +++ b/integration/container/links_linux_test.go @@ -10,9 +10,9 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestLinksEtcHostsContentMatch(t *testing.T) { diff --git a/integration/container/logs_test.go b/integration/container/logs_test.go index 80e3d9a6c6..68fbe13a73 100644 --- a/integration/container/logs_test.go +++ b/integration/container/logs_test.go @@ -9,15 +9,15 @@ import ( "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/stdcopy" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/skip" ) // Regression test for #35370 // Makes sure that when following we don't get an EOF error when there are no logs func TestLogsFollowTailEmpty(t *testing.T) { // FIXME(vdemeester) fails on a e2e run on linux... - skip.IfCondition(t, testEnv.IsRemoteDaemon()) + skip.If(t, testEnv.IsRemoteDaemon()) defer setupTest(t)() client := request.NewAPIClient(t) ctx := context.Background() diff --git a/integration/container/mounts_linux_test.go b/integration/container/mounts_linux_test.go index 884eebb1b4..a0a8836c51 100644 --- a/integration/container/mounts_linux_test.go +++ b/integration/container/mounts_linux_test.go @@ -13,10 +13,10 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/system" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" + "gotest.tools/skip" ) func TestContainerNetworkMountsNoChown(t *testing.T) { diff --git a/integration/container/nat_test.go b/integration/container/nat_test.go index 12541b6a0a..0dbed897db 100644 --- a/integration/container/nat_test.go +++ b/integration/container/nat_test.go @@ -15,10 +15,10 @@ import ( "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" "github.com/docker/go-connections/nat" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" + "gotest.tools/skip" ) func TestNetworkNat(t *testing.T) { diff --git a/integration/container/pause_test.go b/integration/container/pause_test.go index 8f856bcb3c..8dd2d784b7 100644 --- a/integration/container/pause_test.go +++ b/integration/container/pause_test.go @@ -12,10 +12,10 @@ import ( "github.com/docker/docker/api/types/versions" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" + "gotest.tools/skip" ) func TestPause(t *testing.T) { diff --git a/integration/container/ps_test.go b/integration/container/ps_test.go index 1080cd2f57..4ae07043ab 100644 --- a/integration/container/ps_test.go +++ b/integration/container/ps_test.go @@ -8,8 +8,8 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestPsFilter(t *testing.T) { diff --git a/integration/container/remove_test.go b/integration/container/remove_test.go index 185f90cc00..5de13f22ad 100644 --- a/integration/container/remove_test.go +++ b/integration/container/remove_test.go @@ -10,11 +10,11 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" + "gotest.tools/poll" + "gotest.tools/skip" ) func getPrefixAndSlashFromDaemonPlatform() (prefix, slash string) { diff --git a/integration/container/rename_test.go b/integration/container/rename_test.go index fd270052a5..c3f46e10c2 100644 --- a/integration/container/rename_test.go +++ b/integration/container/rename_test.go @@ -12,10 +12,10 @@ import ( "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/stringid" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" + "gotest.tools/skip" ) // This test simulates the scenario mentioned in #31392: diff --git a/integration/container/resize_test.go b/integration/container/resize_test.go index c6c4e81751..5961af0a47 100644 --- a/integration/container/resize_test.go +++ b/integration/container/resize_test.go @@ -11,10 +11,10 @@ import ( "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" req "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" + "gotest.tools/skip" ) func TestResize(t *testing.T) { diff --git a/integration/container/restart_test.go b/integration/container/restart_test.go index c63faba3a7..69007218f1 100644 --- a/integration/container/restart_test.go +++ b/integration/container/restart_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/internal/test/daemon" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/skip" ) func TestDaemonRestartKillContainers(t *testing.T) { diff --git a/integration/container/stats_test.go b/integration/container/stats_test.go index dbececa0e5..6493a30573 100644 --- a/integration/container/stats_test.go +++ b/integration/container/stats_test.go @@ -10,10 +10,10 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" + "gotest.tools/skip" ) func TestStats(t *testing.T) { diff --git a/integration/container/stop_test.go b/integration/container/stop_test.go index 2932ae0bf9..7a2fa20188 100644 --- a/integration/container/stop_test.go +++ b/integration/container/stop_test.go @@ -11,10 +11,10 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/icmd" + "gotest.tools/poll" + "gotest.tools/skip" ) func TestStopContainerWithRestartPolicyAlways(t *testing.T) { diff --git a/integration/container/update_linux_test.go b/integration/container/update_linux_test.go index 6e4fb637ff..0e410a1461 100644 --- a/integration/container/update_linux_test.go +++ b/integration/container/update_linux_test.go @@ -10,10 +10,10 @@ import ( containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" + "gotest.tools/skip" ) func TestUpdateMemory(t *testing.T) { diff --git a/integration/container/update_test.go b/integration/container/update_test.go index 2ac122aea7..0e32184d27 100644 --- a/integration/container/update_test.go +++ b/integration/container/update_test.go @@ -8,9 +8,9 @@ import ( containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" ) func TestUpdateRestartPolicy(t *testing.T) { diff --git a/integration/image/commit_test.go b/integration/image/commit_test.go index eb0b4e6b5d..4555391262 100644 --- a/integration/image/commit_test.go +++ b/integration/image/commit_test.go @@ -8,9 +8,9 @@ import ( "github.com/docker/docker/api/types/versions" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestCommitInheritsEnv(t *testing.T) { diff --git a/integration/image/remove_test.go b/integration/image/remove_test.go index 172c27f54d..4f9122a5e3 100644 --- a/integration/image/remove_test.go +++ b/integration/image/remove_test.go @@ -7,8 +7,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestRemoveImageOrphaning(t *testing.T) { diff --git a/integration/image/tag_test.go b/integration/image/tag_test.go index 06431cd8a2..55c3ff7b2b 100644 --- a/integration/image/tag_test.go +++ b/integration/image/tag_test.go @@ -7,8 +7,8 @@ import ( "github.com/docker/docker/internal/test/request" "github.com/docker/docker/internal/testutil" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) // tagging a named image in a new unprefixed repo should work diff --git a/integration/internal/container/container.go b/integration/internal/container/container.go index 0c76571769..489e07154a 100644 --- a/integration/internal/container/container.go +++ b/integration/internal/container/container.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" "github.com/docker/docker/client" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // TestContainerConfig holds container configuration struct that diff --git a/integration/internal/container/states.go b/integration/internal/container/states.go index 1ee73e01a6..088407deb8 100644 --- a/integration/internal/container/states.go +++ b/integration/internal/container/states.go @@ -5,7 +5,7 @@ import ( "strings" "github.com/docker/docker/client" - "github.com/gotestyourself/gotestyourself/poll" + "gotest.tools/poll" ) // IsStopped verifies the container is in stopped state. diff --git a/integration/internal/network/network.go b/integration/internal/network/network.go index b9550362f0..9c13114f92 100644 --- a/integration/internal/network/network.go +++ b/integration/internal/network/network.go @@ -6,7 +6,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/client" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func createNetwork(ctx context.Context, client client.APIClient, name string, ops ...func(*types.NetworkCreate)) (string, error) { diff --git a/integration/internal/requirement/requirement.go b/integration/internal/requirement/requirement.go index cd498ab87d..004383bd05 100644 --- a/integration/internal/requirement/requirement.go +++ b/integration/internal/requirement/requirement.go @@ -7,7 +7,7 @@ import ( "time" "github.com/docker/docker/pkg/parsers/kernel" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) // HasHubConnectivity checks to see if https://hub.docker.com is diff --git a/integration/internal/swarm/service.go b/integration/internal/swarm/service.go index 5567ad6ede..d8b16224fb 100644 --- a/integration/internal/swarm/service.go +++ b/integration/internal/swarm/service.go @@ -11,9 +11,9 @@ import ( swarmtypes "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/internal/test/environment" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/poll" + "gotest.tools/skip" ) // ServicePoll tweaks the pollSettings for `service` diff --git a/integration/network/delete_test.go b/integration/network/delete_test.go index 83d00bbdf1..c2684ae247 100644 --- a/integration/network/delete_test.go +++ b/integration/network/delete_test.go @@ -8,9 +8,9 @@ import ( "github.com/docker/docker/api/types/versions" "github.com/docker/docker/integration/internal/network" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func containsNetwork(nws []types.NetworkResource, networkID string) bool { diff --git a/integration/network/helpers.go b/integration/network/helpers.go index df609dd410..c0d70a168e 100644 --- a/integration/network/helpers.go +++ b/integration/network/helpers.go @@ -8,8 +8,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/client" "github.com/docker/docker/pkg/parsers/kernel" - "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/assert/cmp" + "gotest.tools/icmd" ) // CreateMasterDummy creates a dummy network interface diff --git a/integration/network/inspect_test.go b/integration/network/inspect_test.go index 052642f980..659ca29735 100644 --- a/integration/network/inspect_test.go +++ b/integration/network/inspect_test.go @@ -10,8 +10,8 @@ import ( swarmtypes "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/swarm" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/poll" + "gotest.tools/assert" + "gotest.tools/poll" ) const defaultSwarmPort = 2477 diff --git a/integration/network/ipvlan/ipvlan_test.go b/integration/network/ipvlan/ipvlan_test.go index 001565eefd..190c695a6b 100644 --- a/integration/network/ipvlan/ipvlan_test.go +++ b/integration/network/ipvlan/ipvlan_test.go @@ -12,8 +12,8 @@ import ( "github.com/docker/docker/integration/internal/container" n "github.com/docker/docker/integration/network" "github.com/docker/docker/internal/test/daemon" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/skip" ) func TestDockerNetworkIpvlanPersistance(t *testing.T) { diff --git a/integration/network/macvlan/macvlan_test.go b/integration/network/macvlan/macvlan_test.go index 7d9acd813e..14dfce92cb 100644 --- a/integration/network/macvlan/macvlan_test.go +++ b/integration/network/macvlan/macvlan_test.go @@ -12,8 +12,8 @@ import ( net "github.com/docker/docker/integration/internal/network" n "github.com/docker/docker/integration/network" "github.com/docker/docker/internal/test/daemon" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/skip" ) func TestDockerNetworkMacvlanPersistance(t *testing.T) { diff --git a/integration/network/service_test.go b/integration/network/service_test.go index 77ef870911..a15b0384c7 100644 --- a/integration/network/service_test.go +++ b/integration/network/service_test.go @@ -11,10 +11,10 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/swarm" "github.com/docker/docker/internal/test/daemon" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/icmd" + "gotest.tools/poll" + "gotest.tools/skip" ) // delInterface removes given network interface diff --git a/integration/plugin/authz/authz_plugin_test.go b/integration/plugin/authz/authz_plugin_test.go index 5585d93024..105affc1af 100644 --- a/integration/plugin/authz/authz_plugin_test.go +++ b/integration/plugin/authz/authz_plugin_test.go @@ -25,8 +25,8 @@ import ( "github.com/docker/docker/internal/test/environment" "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/authorization" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/skip" ) const ( @@ -211,7 +211,7 @@ func TestAuthZPluginDenyResponse(t *testing.T) { // TestAuthZPluginAllowEventStream verifies event stream propagates // correctly after request pass through by the authorization plugin func TestAuthZPluginAllowEventStream(t *testing.T) { - skip.IfCondition(t, testEnv.DaemonInfo.OSType != "linux") + skip.If(t, testEnv.DaemonInfo.OSType != "linux") defer setupTestV1(t)() ctrl.reqRes.Allow = true diff --git a/integration/plugin/authz/authz_plugin_v2_test.go b/integration/plugin/authz/authz_plugin_v2_test.go index 93e36d76b9..5ebaca41c6 100644 --- a/integration/plugin/authz/authz_plugin_v2_test.go +++ b/integration/plugin/authz/authz_plugin_v2_test.go @@ -16,8 +16,8 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/integration/internal/requirement" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/skip" ) var ( @@ -29,8 +29,8 @@ var ( ) func setupTestV2(t *testing.T) func() { - skip.IfCondition(t, testEnv.DaemonInfo.OSType != "linux") - skip.IfCondition(t, !requirement.HasHubConnectivity(t)) + skip.If(t, testEnv.DaemonInfo.OSType != "linux") + skip.If(t, !requirement.HasHubConnectivity(t)) teardown := setupTest(t) @@ -40,7 +40,7 @@ func setupTestV2(t *testing.T) func() { } func TestAuthZPluginV2AllowNonVolumeRequest(t *testing.T) { - skip.IfCondition(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64") + skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64") defer setupTestV2(t)() client, err := d.NewClient() @@ -64,7 +64,7 @@ func TestAuthZPluginV2AllowNonVolumeRequest(t *testing.T) { } func TestAuthZPluginV2Disable(t *testing.T) { - skip.IfCondition(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64") + skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64") defer setupTestV2(t)() client, err := d.NewClient() @@ -91,7 +91,7 @@ func TestAuthZPluginV2Disable(t *testing.T) { } func TestAuthZPluginV2RejectVolumeRequests(t *testing.T) { - skip.IfCondition(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64") + skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64") defer setupTestV2(t)() client, err := d.NewClient() @@ -127,7 +127,7 @@ func TestAuthZPluginV2RejectVolumeRequests(t *testing.T) { } func TestAuthZPluginV2BadManifestFailsDaemonStart(t *testing.T) { - skip.IfCondition(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64") + skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64") defer setupTestV2(t)() client, err := d.NewClient() diff --git a/integration/plugin/authz/main_test.go b/integration/plugin/authz/main_test.go index 54bf259e95..75555dc96f 100644 --- a/integration/plugin/authz/main_test.go +++ b/integration/plugin/authz/main_test.go @@ -16,7 +16,7 @@ import ( "github.com/docker/docker/internal/test/environment" "github.com/docker/docker/pkg/authorization" "github.com/docker/docker/pkg/plugins" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/skip" ) var ( diff --git a/integration/plugin/graphdriver/external_test.go b/integration/plugin/graphdriver/external_test.go index 11e24aec70..3596056a84 100644 --- a/integration/plugin/graphdriver/external_test.go +++ b/integration/plugin/graphdriver/external_test.go @@ -22,9 +22,9 @@ import ( "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/plugins" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) type graphEventsCounter struct { diff --git a/integration/plugin/logging/logging_test.go b/integration/plugin/logging/logging_test.go index 1b6f2962bb..3921fa6e69 100644 --- a/integration/plugin/logging/logging_test.go +++ b/integration/plugin/logging/logging_test.go @@ -11,8 +11,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/daemon" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/skip" ) func TestContinueAfterPluginCrash(t *testing.T) { diff --git a/integration/plugin/logging/validation_test.go b/integration/plugin/logging/validation_test.go index b0398cc6ab..0d9b15efbf 100644 --- a/integration/plugin/logging/validation_test.go +++ b/integration/plugin/logging/validation_test.go @@ -6,8 +6,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/internal/test/daemon" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/skip" ) // Regression test for #35553 diff --git a/integration/plugin/volumes/mounts_test.go b/integration/plugin/volumes/mounts_test.go index 97e8222797..4b422ee5c3 100644 --- a/integration/plugin/volumes/mounts_test.go +++ b/integration/plugin/volumes/mounts_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/internal/test/fixtures/plugin" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/skip" ) // TestPluginWithDevMounts tests very specific regression caused by mounts ordering diff --git a/integration/secret/secret_test.go b/integration/secret/secret_test.go index 939dad60de..ecc3108f65 100644 --- a/integration/secret/secret_test.go +++ b/integration/secret/secret_test.go @@ -13,9 +13,9 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/swarm" "github.com/docker/docker/pkg/stdcopy" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestSecretInspect(t *testing.T) { diff --git a/integration/service/create_test.go b/integration/service/create_test.go index a2225696a2..cc5ef9956f 100644 --- a/integration/service/create_test.go +++ b/integration/service/create_test.go @@ -13,9 +13,9 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/swarm" "github.com/docker/docker/internal/test/daemon" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" ) func TestServiceCreateInit(t *testing.T) { diff --git a/integration/service/inspect_test.go b/integration/service/inspect_test.go index 7492a4fc02..daeabcfe12 100644 --- a/integration/service/inspect_test.go +++ b/integration/service/inspect_test.go @@ -12,10 +12,10 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/swarm" "github.com/google/go-cmp/cmp" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/poll" + "gotest.tools/skip" ) func TestInspect(t *testing.T) { @@ -54,7 +54,7 @@ func TestInspect(t *testing.T) { assert.Check(t, is.DeepEqual(service, expected, cmpServiceOpts())) } -// TODO: use helpers from gotestyourself/assert/opt when available +// TODO: use helpers from gotest.tools/assert/opt when available func cmpServiceOpts() cmp.Option { const threshold = 20 * time.Second diff --git a/integration/service/network_test.go b/integration/service/network_test.go index d69aeb91f6..4ebbd972a8 100644 --- a/integration/service/network_test.go +++ b/integration/service/network_test.go @@ -8,8 +8,8 @@ import ( "github.com/docker/docker/api/types/network" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/integration/internal/swarm" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestDockerNetworkConnectAlias(t *testing.T) { diff --git a/integration/service/plugin_test.go b/integration/service/plugin_test.go index 29a0398323..6c61825220 100644 --- a/integration/service/plugin_test.go +++ b/integration/service/plugin_test.go @@ -15,9 +15,9 @@ import ( "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/internal/test/fixtures/plugin" "github.com/docker/docker/internal/test/registry" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/poll" + "gotest.tools/skip" ) func TestServicePlugin(t *testing.T) { diff --git a/integration/session/session_test.go b/integration/session/session_test.go index 893682faba..67a3773abd 100644 --- a/integration/session/session_test.go +++ b/integration/session/session_test.go @@ -5,9 +5,9 @@ import ( "testing" req "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestSessionCreate(t *testing.T) { diff --git a/integration/system/cgroupdriver_systemd_test.go b/integration/system/cgroupdriver_systemd_test.go index 0b4e7eeeeb..449c83fdab 100644 --- a/integration/system/cgroupdriver_systemd_test.go +++ b/integration/system/cgroupdriver_systemd_test.go @@ -9,7 +9,7 @@ import ( "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/daemon" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // hasSystemd checks whether the host was booted with systemd as its init diff --git a/integration/system/event_test.go b/integration/system/event_test.go index b1966fe6ce..6e86f4ad95 100644 --- a/integration/system/event_test.go +++ b/integration/system/event_test.go @@ -18,9 +18,9 @@ import ( "github.com/docker/docker/internal/test/request" req "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/jsonmessage" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestEventsExecDie(t *testing.T) { diff --git a/integration/system/info_linux_test.go b/integration/system/info_linux_test.go index 15bd69fdf6..50fa9874b4 100644 --- a/integration/system/info_linux_test.go +++ b/integration/system/info_linux_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/internal/test/request" req "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestInfoBinaryCommits(t *testing.T) { diff --git a/integration/system/info_test.go b/integration/system/info_test.go index 0906eea336..2a05dfbb74 100644 --- a/integration/system/info_test.go +++ b/integration/system/info_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestInfoAPI(t *testing.T) { diff --git a/integration/system/login_test.go b/integration/system/login_test.go index 5d512ca343..ad1a8756dc 100644 --- a/integration/system/login_test.go +++ b/integration/system/login_test.go @@ -7,14 +7,14 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration/internal/requirement" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) // Test case for GitHub 22244 func TestLoginFailsWithBadCredentials(t *testing.T) { - skip.IfCondition(t, !requirement.HasHubConnectivity(t)) + skip.If(t, !requirement.HasHubConnectivity(t)) client := request.NewAPIClient(t) diff --git a/integration/system/version_test.go b/integration/system/version_test.go index 2461805360..8904c09b26 100644 --- a/integration/system/version_test.go +++ b/integration/system/version_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/docker/docker/internal/test/request" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestVersion(t *testing.T) { diff --git a/integration/volume/volume_test.go b/integration/volume/volume_test.go index 4acc6e8b1a..ce42bb3040 100644 --- a/integration/volume/volume_test.go +++ b/integration/volume/volume_test.go @@ -13,9 +13,9 @@ import ( "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/internal/test/request" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestVolumesCreateAndList(t *testing.T) { diff --git a/internal/test/daemon/config.go b/internal/test/daemon/config.go index c57010db90..ce99222b37 100644 --- a/internal/test/daemon/config.go +++ b/internal/test/daemon/config.go @@ -6,7 +6,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/internal/test" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // ConfigConstructor defines a swarm config constructor diff --git a/internal/test/daemon/container.go b/internal/test/daemon/container.go index 6a0ced9447..3aa69e195c 100644 --- a/internal/test/daemon/container.go +++ b/internal/test/daemon/container.go @@ -5,7 +5,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/internal/test" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // ActiveContainers returns the list of ids of the currently running containers diff --git a/internal/test/daemon/daemon.go b/internal/test/daemon/daemon.go index a0d7ed4855..98f1ee1b08 100644 --- a/internal/test/daemon/daemon.go +++ b/internal/test/daemon/daemon.go @@ -23,8 +23,8 @@ import ( "github.com/docker/docker/pkg/stringid" "github.com/docker/go-connections/sockets" "github.com/docker/go-connections/tlsconfig" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" ) type testingT interface { diff --git a/internal/test/daemon/node.go b/internal/test/daemon/node.go index 5015c75eb1..d9263a7f29 100644 --- a/internal/test/daemon/node.go +++ b/internal/test/daemon/node.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/internal/test" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // NodeConstructor defines a swarm node constructor diff --git a/internal/test/daemon/plugin.go b/internal/test/daemon/plugin.go index 9a7cc345ea..63bbeed219 100644 --- a/internal/test/daemon/plugin.go +++ b/internal/test/daemon/plugin.go @@ -5,7 +5,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/client" - "github.com/gotestyourself/gotestyourself/poll" + "gotest.tools/poll" ) // PluginIsRunning provides a poller to check if the specified plugin is running diff --git a/internal/test/daemon/secret.go b/internal/test/daemon/secret.go index 615489bfd0..f3db7a4260 100644 --- a/internal/test/daemon/secret.go +++ b/internal/test/daemon/secret.go @@ -6,7 +6,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/internal/test" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // SecretConstructor defines a swarm secret constructor diff --git a/internal/test/daemon/service.go b/internal/test/daemon/service.go index 77614d0daa..0f88ca786b 100644 --- a/internal/test/daemon/service.go +++ b/internal/test/daemon/service.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/internal/test" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // ServiceConstructor defines a swarm service constructor function diff --git a/internal/test/daemon/swarm.go b/internal/test/daemon/swarm.go index 3e803eeeb8..e8e8b945de 100644 --- a/internal/test/daemon/swarm.go +++ b/internal/test/daemon/swarm.go @@ -6,8 +6,8 @@ import ( "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/internal/test" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" ) const ( diff --git a/internal/test/environment/clean.go b/internal/test/environment/clean.go index e92006fc46..93dee593f2 100644 --- a/internal/test/environment/clean.go +++ b/internal/test/environment/clean.go @@ -9,7 +9,7 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/client" "github.com/docker/docker/internal/test" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) type testingT interface { diff --git a/internal/test/environment/protect.go b/internal/test/environment/protect.go index 6d57dedb1c..b5b27d2dd4 100644 --- a/internal/test/environment/protect.go +++ b/internal/test/environment/protect.go @@ -7,7 +7,7 @@ import ( "github.com/docker/docker/api/types/filters" dclient "github.com/docker/docker/client" "github.com/docker/docker/internal/test" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) var frozenImages = []string{"busybox:latest", "busybox:glibc", "hello-world:frozen", "debian:jessie"} diff --git a/internal/test/fakegit/fakegit.go b/internal/test/fakegit/fakegit.go index 59f4bcb056..605d1baaa8 100644 --- a/internal/test/fakegit/fakegit.go +++ b/internal/test/fakegit/fakegit.go @@ -12,7 +12,7 @@ import ( "github.com/docker/docker/internal/test" "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/internal/test/fakestorage" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) type testingT interface { diff --git a/internal/test/fakestorage/fixtures.go b/internal/test/fakestorage/fixtures.go index a694834f7d..ad8f763143 100644 --- a/internal/test/fakestorage/fixtures.go +++ b/internal/test/fakestorage/fixtures.go @@ -12,7 +12,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/internal/test" "github.com/docker/docker/pkg/archive" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) var ensureHTTPServerOnce sync.Once diff --git a/internal/test/fakestorage/storage.go b/internal/test/fakestorage/storage.go index adce3512c1..b091cbc3f1 100644 --- a/internal/test/fakestorage/storage.go +++ b/internal/test/fakestorage/storage.go @@ -20,7 +20,7 @@ import ( "github.com/docker/docker/internal/test/request" "github.com/docker/docker/internal/testutil" "github.com/docker/go-connections/nat" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) var testEnv *environment.Execution diff --git a/internal/test/registry/registry.go b/internal/test/registry/registry.go index 2e89c32e57..b6128d3ba4 100644 --- a/internal/test/registry/registry.go +++ b/internal/test/registry/registry.go @@ -10,8 +10,8 @@ import ( "time" "github.com/docker/docker/internal/test" - "github.com/gotestyourself/gotestyourself/assert" "github.com/opencontainers/go-digest" + "gotest.tools/assert" ) const ( diff --git a/internal/test/request/request.go b/internal/test/request/request.go index 00450d94a2..1986d370f1 100644 --- a/internal/test/request/request.go +++ b/internal/test/request/request.go @@ -20,8 +20,8 @@ import ( "github.com/docker/docker/pkg/ioutils" "github.com/docker/go-connections/sockets" "github.com/docker/go-connections/tlsconfig" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" ) // NewAPIClient returns a docker API client configured from environment variables diff --git a/internal/testutil/stringutils_test.go b/internal/testutil/stringutils_test.go index 1dd09af95f..753aac966d 100644 --- a/internal/testutil/stringutils_test.go +++ b/internal/testutil/stringutils_test.go @@ -3,8 +3,8 @@ package testutil // import "github.com/docker/docker/internal/testutil" import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func testLengthHelper(generator func(int) string, t *testing.T) { diff --git a/libcontainerd/queue_test.go b/libcontainerd/queue_test.go index df5332c128..e13afca89a 100644 --- a/libcontainerd/queue_test.go +++ b/libcontainerd/queue_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestSerialization(t *testing.T) { diff --git a/opts/quotedstring_test.go b/opts/quotedstring_test.go index 21e6e4c85a..89fed6cfa6 100644 --- a/opts/quotedstring_test.go +++ b/opts/quotedstring_test.go @@ -3,8 +3,8 @@ package opts // import "github.com/docker/docker/opts" import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestQuotedStringSetWithQuotes(t *testing.T) { diff --git a/pkg/archive/archive_linux_test.go b/pkg/archive/archive_linux_test.go index b06cabecb3..9422269dff 100644 --- a/pkg/archive/archive_linux_test.go +++ b/pkg/archive/archive_linux_test.go @@ -8,9 +8,9 @@ import ( "testing" "github.com/docker/docker/pkg/system" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" "golang.org/x/sys/unix" + "gotest.tools/assert" + "gotest.tools/skip" ) // setupOverlayTestDir creates files in a directory with overlay whiteouts diff --git a/pkg/archive/archive_test.go b/pkg/archive/archive_test.go index d801f2724a..9f06af9969 100644 --- a/pkg/archive/archive_test.go +++ b/pkg/archive/archive_test.go @@ -18,9 +18,9 @@ import ( "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/ioutils" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) var tmp string diff --git a/pkg/archive/archive_unix_test.go b/pkg/archive/archive_unix_test.go index 034490b573..808878d094 100644 --- a/pkg/archive/archive_unix_test.go +++ b/pkg/archive/archive_unix_test.go @@ -13,10 +13,10 @@ import ( "testing" "github.com/docker/docker/pkg/system" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" "golang.org/x/sys/unix" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestCanonicalTarNameForPath(t *testing.T) { diff --git a/pkg/archive/changes_test.go b/pkg/archive/changes_test.go index 83ad5be605..f2527cd936 100644 --- a/pkg/archive/changes_test.go +++ b/pkg/archive/changes_test.go @@ -11,8 +11,8 @@ import ( "time" "github.com/docker/docker/pkg/system" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/skip" ) func max(x, y int) int { diff --git a/pkg/archive/copy_unix_test.go b/pkg/archive/copy_unix_test.go index 08b1702cf1..739ad0e3ef 100644 --- a/pkg/archive/copy_unix_test.go +++ b/pkg/archive/copy_unix_test.go @@ -16,7 +16,7 @@ import ( "strings" "testing" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func removeAllPaths(paths ...string) { diff --git a/pkg/archive/wrap_test.go b/pkg/archive/wrap_test.go index 979536777f..1faa7aed75 100644 --- a/pkg/archive/wrap_test.go +++ b/pkg/archive/wrap_test.go @@ -6,7 +6,7 @@ import ( "io" "testing" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestGenerateEmptyFile(t *testing.T) { diff --git a/pkg/authorization/api_test.go b/pkg/authorization/api_test.go index 84964d2c5e..ff364fd0bc 100644 --- a/pkg/authorization/api_test.go +++ b/pkg/authorization/api_test.go @@ -11,8 +11,8 @@ import ( "testing" "time" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestPeerCertificateMarshalJSON(t *testing.T) { diff --git a/pkg/authorization/middleware_test.go b/pkg/authorization/middleware_test.go index e32e4bf427..6afafe082d 100644 --- a/pkg/authorization/middleware_test.go +++ b/pkg/authorization/middleware_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/docker/docker/pkg/plugingetter" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestMiddleware(t *testing.T) { diff --git a/pkg/authorization/middleware_unix_test.go b/pkg/authorization/middleware_unix_test.go index 6d1a428460..450e7fbbb7 100644 --- a/pkg/authorization/middleware_unix_test.go +++ b/pkg/authorization/middleware_unix_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/docker/docker/pkg/plugingetter" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestMiddlewareWrapHandler(t *testing.T) { diff --git a/pkg/chrootarchive/archive_test.go b/pkg/chrootarchive/archive_test.go index 3851d7224e..5911a36158 100644 --- a/pkg/chrootarchive/archive_test.go +++ b/pkg/chrootarchive/archive_test.go @@ -16,7 +16,7 @@ import ( "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/reexec" "github.com/docker/docker/pkg/system" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/skip" ) func init() { diff --git a/pkg/fileutils/fileutils_test.go b/pkg/fileutils/fileutils_test.go index b167538d5a..4b5f129a50 100644 --- a/pkg/fileutils/fileutils_test.go +++ b/pkg/fileutils/fileutils_test.go @@ -10,8 +10,8 @@ import ( "strings" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) // CopyFile with invalid src diff --git a/pkg/idtools/idtools_unix_test.go b/pkg/idtools/idtools_unix_test.go index 7d8c9715e2..608000a66b 100644 --- a/pkg/idtools/idtools_unix_test.go +++ b/pkg/idtools/idtools_unix_test.go @@ -10,10 +10,10 @@ import ( "path/filepath" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" "golang.org/x/sys/unix" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) const ( diff --git a/pkg/ioutils/readers_test.go b/pkg/ioutils/readers_test.go index e424054aa7..e645c78d83 100644 --- a/pkg/ioutils/readers_test.go +++ b/pkg/ioutils/readers_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) // Implement io.Reader diff --git a/pkg/jsonmessage/jsonmessage_test.go b/pkg/jsonmessage/jsonmessage_test.go index f9ead207ca..223d9c7f5a 100644 --- a/pkg/jsonmessage/jsonmessage_test.go +++ b/pkg/jsonmessage/jsonmessage_test.go @@ -9,8 +9,8 @@ import ( "time" "github.com/docker/docker/pkg/term" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestError(t *testing.T) { diff --git a/pkg/mount/mountinfo_linux_test.go b/pkg/mount/mountinfo_linux_test.go index f8acb9eeae..64411ccaef 100644 --- a/pkg/mount/mountinfo_linux_test.go +++ b/pkg/mount/mountinfo_linux_test.go @@ -6,7 +6,7 @@ import ( "bytes" "testing" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) const ( diff --git a/pkg/plugins/client_test.go b/pkg/plugins/client_test.go index d420010f1a..c3a4892272 100644 --- a/pkg/plugins/client_test.go +++ b/pkg/plugins/client_test.go @@ -14,9 +14,9 @@ import ( "github.com/docker/docker/pkg/plugins/transport" "github.com/docker/go-connections/tlsconfig" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) var ( diff --git a/pkg/plugins/discovery_unix_test.go b/pkg/plugins/discovery_unix_test.go index 2c718d8bee..b4aefc83e4 100644 --- a/pkg/plugins/discovery_unix_test.go +++ b/pkg/plugins/discovery_unix_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestLocalSocket(t *testing.T) { diff --git a/pkg/plugins/plugin_test.go b/pkg/plugins/plugin_test.go index ca8d598400..ce98078f87 100644 --- a/pkg/plugins/plugin_test.go +++ b/pkg/plugins/plugin_test.go @@ -14,8 +14,8 @@ import ( "github.com/docker/docker/pkg/plugins/transport" "github.com/docker/go-connections/tlsconfig" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" ) const ( diff --git a/pkg/plugins/transport/http_test.go b/pkg/plugins/transport/http_test.go index 081f60424d..78ab23724b 100644 --- a/pkg/plugins/transport/http_test.go +++ b/pkg/plugins/transport/http_test.go @@ -5,8 +5,8 @@ import ( "net/http" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestHTTPTransport(t *testing.T) { diff --git a/pkg/pools/pools_test.go b/pkg/pools/pools_test.go index 76015169d4..7ff01ce3d5 100644 --- a/pkg/pools/pools_test.go +++ b/pkg/pools/pools_test.go @@ -7,8 +7,8 @@ import ( "strings" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestBufioReaderPoolGetWithNoReaderShouldCreateOne(t *testing.T) { diff --git a/pkg/reexec/reexec_test.go b/pkg/reexec/reexec_test.go index 90aa01a390..44675e7b63 100644 --- a/pkg/reexec/reexec_test.go +++ b/pkg/reexec/reexec_test.go @@ -5,7 +5,7 @@ import ( "os/exec" "testing" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func init() { diff --git a/pkg/signal/signal_linux_test.go b/pkg/signal/signal_linux_test.go index 71c577ed64..9a021e2164 100644 --- a/pkg/signal/signal_linux_test.go +++ b/pkg/signal/signal_linux_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestCatchAll(t *testing.T) { diff --git a/pkg/signal/signal_test.go b/pkg/signal/signal_test.go index bbf3736fc8..0bfcf6ce44 100644 --- a/pkg/signal/signal_test.go +++ b/pkg/signal/signal_test.go @@ -4,8 +4,8 @@ import ( "syscall" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestParseSignal(t *testing.T) { diff --git a/pkg/signal/trap_linux_test.go b/pkg/signal/trap_linux_test.go index a3afe7a7b6..14d1543117 100644 --- a/pkg/signal/trap_linux_test.go +++ b/pkg/signal/trap_linux_test.go @@ -10,8 +10,8 @@ import ( "syscall" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func buildTestBinary(t *testing.T, tmpdir string, prefix string) (string, string) { diff --git a/pkg/streamformatter/streamformatter_test.go b/pkg/streamformatter/streamformatter_test.go index 172d568bda..4399a6509b 100644 --- a/pkg/streamformatter/streamformatter_test.go +++ b/pkg/streamformatter/streamformatter_test.go @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/pkg/jsonmessage" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestRawProgressFormatterFormatStatus(t *testing.T) { diff --git a/pkg/streamformatter/streamwriter_test.go b/pkg/streamformatter/streamwriter_test.go index b74d6fb2d3..5b679f2cf4 100644 --- a/pkg/streamformatter/streamwriter_test.go +++ b/pkg/streamformatter/streamwriter_test.go @@ -4,8 +4,8 @@ import ( "bytes" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestStreamWriterStdout(t *testing.T) { diff --git a/pkg/sysinfo/sysinfo_linux_test.go b/pkg/sysinfo/sysinfo_linux_test.go index e8a12a35c9..13a07fbce9 100644 --- a/pkg/sysinfo/sysinfo_linux_test.go +++ b/pkg/sysinfo/sysinfo_linux_test.go @@ -7,8 +7,8 @@ import ( "path/filepath" "testing" - "github.com/gotestyourself/gotestyourself/assert" "golang.org/x/sys/unix" + "gotest.tools/assert" ) func TestReadProcBool(t *testing.T) { diff --git a/pkg/system/rm_test.go b/pkg/system/rm_test.go index 19dc42cba9..0448aac619 100644 --- a/pkg/system/rm_test.go +++ b/pkg/system/rm_test.go @@ -9,7 +9,7 @@ import ( "time" "github.com/docker/docker/pkg/mount" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/skip" ) func TestEnsureRemoveAllNotExist(t *testing.T) { diff --git a/pkg/system/stat_unix_test.go b/pkg/system/stat_unix_test.go index fd68a96656..44e048f2a7 100644 --- a/pkg/system/stat_unix_test.go +++ b/pkg/system/stat_unix_test.go @@ -7,7 +7,7 @@ import ( "syscall" "testing" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // TestFromStatT tests fromStatT for a tempfile diff --git a/pkg/tarsum/tarsum_test.go b/pkg/tarsum/tarsum_test.go index e1b38a6a1b..435b91c780 100644 --- a/pkg/tarsum/tarsum_test.go +++ b/pkg/tarsum/tarsum_test.go @@ -17,8 +17,8 @@ import ( "strings" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) type testLayer struct { diff --git a/pkg/term/ascii_test.go b/pkg/term/ascii_test.go index 321d1b87de..665ab1552f 100644 --- a/pkg/term/ascii_test.go +++ b/pkg/term/ascii_test.go @@ -3,8 +3,8 @@ package term // import "github.com/docker/docker/pkg/term" import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestToBytes(t *testing.T) { diff --git a/pkg/term/proxy_test.go b/pkg/term/proxy_test.go index 72f53e58d1..df588fe15b 100644 --- a/pkg/term/proxy_test.go +++ b/pkg/term/proxy_test.go @@ -5,8 +5,8 @@ import ( "fmt" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestEscapeProxyRead(t *testing.T) { diff --git a/pkg/term/term_linux_test.go b/pkg/term/term_linux_test.go index 4f1d67586f..272395a10e 100644 --- a/pkg/term/term_linux_test.go +++ b/pkg/term/term_linux_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) // RequiresRoot skips tests that require root, unless the test.root flag has diff --git a/plugin/executor/containerd/containerd_test.go b/plugin/executor/containerd/containerd_test.go index d9185a05e1..e27063b1d8 100644 --- a/plugin/executor/containerd/containerd_test.go +++ b/plugin/executor/containerd/containerd_test.go @@ -9,9 +9,9 @@ import ( "time" "github.com/docker/docker/libcontainerd" - "github.com/gotestyourself/gotestyourself/assert" "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" + "gotest.tools/assert" ) func TestLifeCycle(t *testing.T) { diff --git a/plugin/manager_linux_test.go b/plugin/manager_linux_test.go index 740efd7a3a..fd8fa8523c 100644 --- a/plugin/manager_linux_test.go +++ b/plugin/manager_linux_test.go @@ -13,9 +13,9 @@ import ( "github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/system" "github.com/docker/docker/plugin/v2" - "github.com/gotestyourself/gotestyourself/skip" "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" + "gotest.tools/skip" ) func TestManagerWithPluginMounts(t *testing.T) { diff --git a/reference/store_test.go b/reference/store_test.go index 71f1d96e59..1ce674cbfb 100644 --- a/reference/store_test.go +++ b/reference/store_test.go @@ -9,9 +9,9 @@ import ( "testing" "github.com/docker/distribution/reference" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/opencontainers/go-digest" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) var ( diff --git a/registry/config_test.go b/registry/config_test.go index 2f9c9548ea..30a257e325 100644 --- a/registry/config_test.go +++ b/registry/config_test.go @@ -6,8 +6,8 @@ import ( "strings" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestLoadAllowNondistributableArtifacts(t *testing.T) { diff --git a/registry/registry_test.go b/registry/registry_test.go index ec11252394..b7459471b3 100644 --- a/registry/registry_test.go +++ b/registry/registry_test.go @@ -13,8 +13,8 @@ import ( "github.com/docker/distribution/registry/client/transport" "github.com/docker/docker/api/types" registrytypes "github.com/docker/docker/api/types/registry" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/skip" ) var ( diff --git a/registry/resumable/resumablerequestreader_test.go b/registry/resumable/resumablerequestreader_test.go index bd3d55885f..c72c210e77 100644 --- a/registry/resumable/resumablerequestreader_test.go +++ b/registry/resumable/resumablerequestreader_test.go @@ -10,8 +10,8 @@ import ( "testing" "time" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestResumableRequestHeaderSimpleErrors(t *testing.T) { diff --git a/registry/service_v1_test.go b/registry/service_v1_test.go index 590a653c36..11861f7c05 100644 --- a/registry/service_v1_test.go +++ b/registry/service_v1_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/skip" ) func TestLookupV1Endpoints(t *testing.T) { diff --git a/runconfig/config_test.go b/runconfig/config_test.go index 58e3a9f788..67d386969f 100644 --- a/runconfig/config_test.go +++ b/runconfig/config_test.go @@ -12,8 +12,8 @@ import ( "github.com/docker/docker/api/types/container" networktypes "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/strslice" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) type f struct { diff --git a/runconfig/hostconfig_test.go b/runconfig/hostconfig_test.go index d2482fbe7b..b04cbc6bc3 100644 --- a/runconfig/hostconfig_test.go +++ b/runconfig/hostconfig_test.go @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/pkg/sysinfo" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) // TODO Windows: This will need addressing for a Windows daemon. diff --git a/vendor.conf b/vendor.conf index 4ffb3edf56..3bd09b11a1 100644 --- a/vendor.conf +++ b/vendor.conf @@ -18,8 +18,7 @@ golang.org/x/sys 37707fdb30a5b38865cfb95e5aab41707daec7fd github.com/docker/go-units 9e638d38cf6977a37a8ea0078f3ee75a7cdb2dd1 github.com/docker/go-connections 7beb39f0b969b075d1325fecb092faf27fd357b6 golang.org/x/text f72d8390a633d5dfb0cc84043294db9f6c935756 -github.com/pmezard/go-difflib v1.0.0 -github.com/gotestyourself/gotestyourself cf3a5ab914a2efa8bc838d09f5918c1d44d029 +gotest.tools v2.1.0 github.com/google/go-cmp v0.2.0 github.com/RackSec/srslog 456df3a81436d29ba874f3590eeeee25d666f8a5 diff --git a/vendor/github.com/gotestyourself/gotestyourself/README.md b/vendor/github.com/gotestyourself/gotestyourself/README.md deleted file mode 100644 index aad893ae03..0000000000 --- a/vendor/github.com/gotestyourself/gotestyourself/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Go Test Yourself - -A collection of packages compatible with `go test` to support common testing -patterns. - -[![GoDoc](https://godoc.org/github.com/gotestyourself/gotestyourself?status.svg)](https://godoc.org/github.com/gotestyourself/gotestyourself) -[![CircleCI](https://circleci.com/gh/gotestyourself/gotestyourself/tree/master.svg?style=shield)](https://circleci.com/gh/gotestyourself/gotestyourself/tree/master) -[![Go Reportcard](https://goreportcard.com/badge/github.com/gotestyourself/gotestyourself)](https://goreportcard.com/report/github.com/gotestyourself/gotestyourself) - - -## Packages - -* [assert](http://godoc.org/github.com/gotestyourself/gotestyourself/assert) - - compare values and fail the test when the comparison fails -* [env](http://godoc.org/github.com/gotestyourself/gotestyourself/env) - - test code that uses environment variables -* [fs](http://godoc.org/github.com/gotestyourself/gotestyourself/fs) - - create test files and directories -* [golden](http://godoc.org/github.com/gotestyourself/gotestyourself/golden) - - compare large multi-line strings -* [icmd](http://godoc.org/github.com/gotestyourself/gotestyourself/icmd) - - execute binaries and test the output -* [poll](http://godoc.org/github.com/gotestyourself/gotestyourself/poll) - - test asynchronous code by polling until a desired state is reached -* [skip](http://godoc.org/github.com/gotestyourself/gotestyourself/skip) - - skip tests based on conditions -* [testsum](http://godoc.org/github.com/gotestyourself/gotestyourself/testsum) - - a program to summarize `go test` output and test failures - -## Related - -* [maxbrunsfeld/counterfeiter](https://github.com/maxbrunsfeld/counterfeiter) - generate fakes for interfaces -* [jonboulle/clockwork](https://github.com/jonboulle/clockwork) - a fake clock for testing code that uses `time` diff --git a/vendor/github.com/pmezard/go-difflib/README.md b/vendor/github.com/pmezard/go-difflib/README.md deleted file mode 100644 index e87f307ed4..0000000000 --- a/vendor/github.com/pmezard/go-difflib/README.md +++ /dev/null @@ -1,50 +0,0 @@ -go-difflib -========== - -[![Build Status](https://travis-ci.org/pmezard/go-difflib.png?branch=master)](https://travis-ci.org/pmezard/go-difflib) -[![GoDoc](https://godoc.org/github.com/pmezard/go-difflib/difflib?status.svg)](https://godoc.org/github.com/pmezard/go-difflib/difflib) - -Go-difflib is a partial port of python 3 difflib package. Its main goal -was to make unified and context diff available in pure Go, mostly for -testing purposes. - -The following class and functions (and related tests) have be ported: - -* `SequenceMatcher` -* `unified_diff()` -* `context_diff()` - -## Installation - -```bash -$ go get github.com/pmezard/go-difflib/difflib -``` - -### Quick Start - -Diffs are configured with Unified (or ContextDiff) structures, and can -be output to an io.Writer or returned as a string. - -```Go -diff := UnifiedDiff{ - A: difflib.SplitLines("foo\nbar\n"), - B: difflib.SplitLines("foo\nbaz\n"), - FromFile: "Original", - ToFile: "Current", - Context: 3, -} -text, _ := GetUnifiedDiffString(diff) -fmt.Printf(text) -``` - -would output: - -``` ---- Original -+++ Current -@@ -1,3 +1,3 @@ - foo --bar -+baz -``` - diff --git a/vendor/github.com/gotestyourself/gotestyourself/LICENSE b/vendor/gotest.tools/LICENSE similarity index 100% rename from vendor/github.com/gotestyourself/gotestyourself/LICENSE rename to vendor/gotest.tools/LICENSE diff --git a/vendor/gotest.tools/README.md b/vendor/gotest.tools/README.md new file mode 100644 index 0000000000..f5df204315 --- /dev/null +++ b/vendor/gotest.tools/README.md @@ -0,0 +1,31 @@ +# gotest.tools + +A collection of packages to augment `testing` and support common patterns. + +[![GoDoc](https://godoc.org/gotest.tools?status.svg)](https://godoc.org/gotest.tools) +[![CircleCI](https://circleci.com/gh/gotestyourself/gotestyourself/tree/master.svg?style=shield)](https://circleci.com/gh/gotestyourself/gotestyourself/tree/master) +[![Go Reportcard](https://goreportcard.com/badge/gotest.tools)](https://goreportcard.com/report/gotest.tools) + + +## Packages + +* [assert](http://godoc.org/gotest.tools/assert) - + compare values and fail the test when a comparison fails +* [env](http://godoc.org/gotest.tools/env) - + test code which uses environment variables +* [fs](http://godoc.org/gotest.tools/fs) - + create temporary files and compare a filesystem tree to an expected value +* [golden](http://godoc.org/gotest.tools/golden) - + compare large multi-line strings against values frozen in golden files +* [icmd](http://godoc.org/gotest.tools/icmd) - + execute binaries and test the output +* [poll](http://godoc.org/gotest.tools/poll) - + test asynchronous code by polling until a desired state is reached +* [skip](http://godoc.org/gotest.tools/skip) - + skip a test and print the source code of the condition used to skip the test + +## Related + +* [gotest.tools/gotestsum](https://github.com/gotestyourself/gotestsum) - go test runner with custom output +* [maxbrunsfeld/counterfeiter](https://github.com/maxbrunsfeld/counterfeiter) - generate fakes for interfaces +* [jonboulle/clockwork](https://github.com/jonboulle/clockwork) - a fake clock for testing code that uses `time` diff --git a/vendor/github.com/gotestyourself/gotestyourself/assert/assert.go b/vendor/gotest.tools/assert/assert.go similarity index 85% rename from vendor/github.com/gotestyourself/gotestyourself/assert/assert.go rename to vendor/gotest.tools/assert/assert.go index d2b05f4165..05d6635436 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/assert/assert.go +++ b/vendor/gotest.tools/assert/assert.go @@ -8,7 +8,7 @@ comparison fails. The one difference is that Assert() will end the test executio immediately (using t.FailNow()) whereas Check() will fail the test (using t.Fail()), return the value of the comparison, then proceed with the rest of the test case. -Example Usage +Example usage The example below shows assert used with some common types. @@ -16,8 +16,8 @@ The example below shows assert used with some common types. import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestEverything(t *testing.T) { @@ -49,12 +49,20 @@ The example below shows assert used with some common types. Comparisons -https://godoc.org/github.com/gotestyourself/gotestyourself/assert/cmp provides +Package https://godoc.org/gotest.tools/assert/cmp provides many common comparisons. Additional comparisons can be written to compare values in other ways. See the example Assert (CustomComparison). +Automated migration from testify + +gty-migrate-from-testify is a binary which can update source code which uses +testify assertions to use the assertions provided by this package. + +See http://bit.do/cmd-gty-migrate-from-testify. + + */ -package assert +package assert // import "gotest.tools/assert" import ( "fmt" @@ -62,9 +70,9 @@ import ( "go/token" gocmp "github.com/google/go-cmp/cmp" - "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/internal/format" - "github.com/gotestyourself/gotestyourself/internal/source" + "gotest.tools/assert/cmp" + "gotest.tools/internal/format" + "gotest.tools/internal/source" ) // BoolOrComparison can be a bool, or cmp.Comparison. See Assert() for usage. @@ -234,7 +242,17 @@ func NilError(t TestingT, err error, msgAndArgs ...interface{}) { } // Equal uses the == operator to assert two values are equal and fails the test -// if they are not equal. This is equivalent to Assert(t, cmp.Equal(x, y)). +// if they are not equal. +// +// If the comparison fails Equal will use the variable names for x and y as part +// of the failure message to identify the actual and expected values. +// +// If either x or y are a multi-line string the failure message will include a +// unified diff of the two values. If the values only differ by whitespace +// the unified diff will be augmented by replacing whitespace characters with +// visible characters to identify the whitespace difference. +// +// This is equivalent to Assert(t, cmp.Equal(x, y)). func Equal(t TestingT, x, y interface{}, msgAndArgs ...interface{}) { if ht, ok := t.(helperT); ok { ht.Helper() @@ -242,8 +260,12 @@ func Equal(t TestingT, x, y interface{}, msgAndArgs ...interface{}) { assert(t, t.FailNow, argsAfterT, cmp.Equal(x, y), msgAndArgs...) } -// DeepEqual uses https://github.com/google/go-cmp/cmp to assert two values -// are equal and fails the test if they are not equal. +// DeepEqual uses google/go-cmp (http://bit.do/go-cmp) to assert two values are +// equal and fails the test if they are not equal. +// +// Package https://godoc.org/gotest.tools/assert/opt provides some additional +// commonly used Options. +// // This is equivalent to Assert(t, cmp.DeepEqual(x, y)). func DeepEqual(t TestingT, x, y interface{}, opts ...gocmp.Option) { if ht, ok := t.(helperT); ok { @@ -276,7 +298,7 @@ func ErrorContains(t TestingT, err error, substring string, msgAndArgs ...interf // // Expected can be one of: // a func(error) bool which returns true if the error is the expected type, -// an instance of a struct of the expected type, +// an instance of (or a pointer to) a struct of the expected type, // a pointer to an interface the error is expected to implement, // a reflect.Type of the expected struct or interface. // diff --git a/vendor/github.com/gotestyourself/gotestyourself/assert/cmp/compare.go b/vendor/gotest.tools/assert/cmp/compare.go similarity index 90% rename from vendor/github.com/gotestyourself/gotestyourself/assert/cmp/compare.go rename to vendor/gotest.tools/assert/cmp/compare.go index 64a25f00b3..ae03749e20 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/assert/cmp/compare.go +++ b/vendor/gotest.tools/assert/cmp/compare.go @@ -1,5 +1,5 @@ /*Package cmp provides Comparisons for Assert and Check*/ -package cmp +package cmp // import "gotest.tools/assert/cmp" import ( "fmt" @@ -7,7 +7,7 @@ import ( "strings" "github.com/google/go-cmp/cmp" - "github.com/pmezard/go-difflib/difflib" + "gotest.tools/internal/format" ) // Comparison is a function which compares values and returns ResultSuccess if @@ -15,10 +15,12 @@ import ( // Result will contain a message about why it failed. type Comparison func() Result -// DeepEqual compares two values using https://godoc.org/github.com/google/go-cmp/cmp +// DeepEqual compares two values using google/go-cmp (http://bit.do/go-cmp) // and succeeds if the values are equal. // // The comparison can be customized using comparison Options. +// Package https://godoc.org/gotest.tools/assert/opt provides some additional +// commonly used Options. func DeepEqual(x, y interface{}, opts ...cmp.Option) Comparison { return func() (result Result) { defer func() { @@ -27,7 +29,10 @@ func DeepEqual(x, y interface{}, opts ...cmp.Option) Comparison { } }() diff := cmp.Diff(x, y, opts...) - return toResult(diff == "", "\n"+diff) + if diff == "" { + return ResultSuccess + } + return multiLineDiffResult(diff) } } @@ -53,14 +58,15 @@ func toResult(success bool, msg string) Result { return ResultFailure(msg) } -// Equal succeeds if x == y. +// Equal succeeds if x == y. See assert.Equal for full documentation. func Equal(x, y interface{}) Comparison { return func() Result { switch { case x == y: return ResultSuccess case isMultiLineStringCompare(x, y): - return multiLineStringDiffResult(x.(string), y.(string)) + diff := format.UnifiedDiff(format.DiffConfig{A: x.(string), B: y.(string)}) + return multiLineDiffResult(diff) } return ResultFailureTemplate(` {{- .Data.x}} ( @@ -86,15 +92,7 @@ func isMultiLineStringCompare(x, y interface{}) bool { return strings.Contains(strX, "\n") || strings.Contains(strY, "\n") } -func multiLineStringDiffResult(x, y string) Result { - diff, err := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ - A: difflib.SplitLines(x), - B: difflib.SplitLines(y), - Context: 3, - }) - if err != nil { - return ResultFailure(fmt.Sprintf("failed to diff: %s", err)) - } +func multiLineDiffResult(diff string) Result { return ResultFailureTemplate(` --- {{ with callArg 0 }}{{ formatNode . }}{{else}}←{{end}} +++ {{ with callArg 1 }}{{ formatNode . }}{{else}}→{{end}} @@ -242,7 +240,7 @@ func isNil(obj interface{}, msgFunc func(reflect.Value) string) Comparison { // // Expected can be one of: // a func(error) bool which returns true if the error is the expected type, -// an instance of a struct of the expected type, +// an instance of (or a pointer to) a struct of the expected type, // a pointer to an interface the error is expected to implement, // a reflect.Type of the expected struct or interface. func ErrorType(err error, expected interface{}) Comparison { @@ -261,7 +259,7 @@ func ErrorType(err error, expected interface{}) Comparison { expectedType := reflect.TypeOf(expected) switch { - case expectedType.Kind() == reflect.Struct: + case expectedType.Kind() == reflect.Struct, isPtrToStruct(expectedType): return cmpErrorTypeEqualType(err, expectedType) case isPtrToInterface(expectedType): return cmpErrorTypeImplementsType(err, expectedType.Elem()) @@ -308,3 +306,7 @@ func cmpErrorTypeImplementsType(err error, expectedType reflect.Type) Result { func isPtrToInterface(typ reflect.Type) bool { return typ.Kind() == reflect.Ptr && typ.Elem().Kind() == reflect.Interface } + +func isPtrToStruct(typ reflect.Type) bool { + return typ.Kind() == reflect.Ptr && typ.Elem().Kind() == reflect.Struct +} diff --git a/vendor/github.com/gotestyourself/gotestyourself/assert/cmp/result.go b/vendor/gotest.tools/assert/cmp/result.go similarity index 97% rename from vendor/github.com/gotestyourself/gotestyourself/assert/cmp/result.go rename to vendor/gotest.tools/assert/cmp/result.go index 99f39eeb27..7c3c37dd72 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/assert/cmp/result.go +++ b/vendor/gotest.tools/assert/cmp/result.go @@ -6,7 +6,7 @@ import ( "go/ast" "text/template" - "github.com/gotestyourself/gotestyourself/internal/source" + "gotest.tools/internal/source" ) // Result of a Comparison. diff --git a/vendor/github.com/gotestyourself/gotestyourself/assert/result.go b/vendor/gotest.tools/assert/result.go similarity index 93% rename from vendor/github.com/gotestyourself/gotestyourself/assert/result.go rename to vendor/gotest.tools/assert/result.go index b685b7f3e5..3900264d0b 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/assert/result.go +++ b/vendor/gotest.tools/assert/result.go @@ -4,9 +4,9 @@ import ( "fmt" "go/ast" - "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/internal/format" - "github.com/gotestyourself/gotestyourself/internal/source" + "gotest.tools/assert/cmp" + "gotest.tools/internal/format" + "gotest.tools/internal/source" ) func runComparison( diff --git a/vendor/github.com/gotestyourself/gotestyourself/env/env.go b/vendor/gotest.tools/env/env.go similarity index 84% rename from vendor/github.com/gotestyourself/gotestyourself/env/env.go rename to vendor/gotest.tools/env/env.go index 700430f1dd..ed0f189916 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/env/env.go +++ b/vendor/gotest.tools/env/env.go @@ -1,13 +1,14 @@ /*Package env provides functions to test code that read environment variables or the current working directory. */ -package env +package env // import "gotest.tools/env" import ( "os" "strings" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" + "gotest.tools/x/subtest" ) type helperT interface { @@ -23,7 +24,7 @@ func Patch(t assert.TestingT, key, value string) func() { } oldValue, ok := os.LookupEnv(key) assert.NilError(t, os.Setenv(key, value)) - return func() { + cleanup := func() { if ht, ok := t.(helperT); ok { ht.Helper() } @@ -33,6 +34,10 @@ func Patch(t assert.TestingT, key, value string) func() { } assert.NilError(t, os.Setenv(key, oldValue)) } + if tc, ok := t.(subtest.TestContext); ok { + tc.AddCleanup(cleanup) + } + return cleanup } // PatchAll sets the environment to env, and returns a function which will @@ -47,7 +52,7 @@ func PatchAll(t assert.TestingT, env map[string]string) func() { for key, value := range env { assert.NilError(t, os.Setenv(key, value), "setenv %s=%s", key, value) } - return func() { + cleanup := func() { if ht, ok := t.(helperT); ok { ht.Helper() } @@ -56,6 +61,10 @@ func PatchAll(t assert.TestingT, env map[string]string) func() { assert.NilError(t, os.Setenv(key, oldVal), "setenv %s=%s", key, oldVal) } } + if tc, ok := t.(subtest.TestContext); ok { + tc.AddCleanup(cleanup) + } + return cleanup } // ToMap takes a list of strings in the format returned by os.Environ() and @@ -89,10 +98,14 @@ func ChangeWorkingDir(t assert.TestingT, dir string) func() { cwd, err := os.Getwd() assert.NilError(t, err) assert.NilError(t, os.Chdir(dir)) - return func() { + cleanup := func() { if ht, ok := t.(helperT); ok { ht.Helper() } assert.NilError(t, os.Chdir(cwd)) } + if tc, ok := t.(subtest.TestContext); ok { + tc.AddCleanup(cleanup) + } + return cleanup } diff --git a/vendor/github.com/gotestyourself/gotestyourself/fs/file.go b/vendor/gotest.tools/fs/file.go similarity index 77% rename from vendor/github.com/gotestyourself/gotestyourself/fs/file.go rename to vendor/gotest.tools/fs/file.go index a2f731093b..8bf0188d2f 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/fs/file.go +++ b/vendor/gotest.tools/fs/file.go @@ -1,17 +1,20 @@ -/*Package fs provides tools for creating and working with temporary files and -directories. +/*Package fs provides tools for creating temporary files, and testing the +contents and structure of a directory. */ -package fs +package fs // import "gotest.tools/fs" import ( "io/ioutil" "os" "path/filepath" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" + "gotest.tools/x/subtest" ) -// Path objects return their filesystem path. Both File and Dir implement Path. +// Path objects return their filesystem path. Path may be implemented by a +// real filesystem object (such as File and Dir) or by a type which updates +// entries in a Manifest. type Path interface { Path() string Remove() @@ -45,6 +48,9 @@ func NewFile(t assert.TestingT, prefix string, ops ...PathOp) *File { for _, op := range ops { assert.NilError(t, op(file)) } + if tc, ok := t.(subtest.TestContext); ok { + tc.AddCleanup(file.Remove) + } return file } @@ -77,6 +83,9 @@ func NewDir(t assert.TestingT, prefix string, ops ...PathOp) *Dir { for _, op := range ops { assert.NilError(t, op(dir)) } + if tc, ok := t.(subtest.TestContext); ok { + tc.AddCleanup(dir.Remove) + } return dir } diff --git a/vendor/gotest.tools/fs/manifest.go b/vendor/gotest.tools/fs/manifest.go new file mode 100644 index 0000000000..00976ef19c --- /dev/null +++ b/vendor/gotest.tools/fs/manifest.go @@ -0,0 +1,129 @@ +package fs + +import ( + "io" + "io/ioutil" + "os" + "path/filepath" + + "github.com/pkg/errors" + "gotest.tools/assert" +) + +// Manifest stores the expected structure and properties of files and directories +// in a filesystem. +type Manifest struct { + root *directory +} + +type resource struct { + mode os.FileMode + uid uint32 + gid uint32 +} + +type file struct { + resource + content io.ReadCloser +} + +func (f *file) Type() string { + return "file" +} + +type symlink struct { + resource + target string +} + +func (f *symlink) Type() string { + return "symlink" +} + +type directory struct { + resource + items map[string]dirEntry +} + +func (f *directory) Type() string { + return "directory" +} + +type dirEntry interface { + Type() string +} + +// ManifestFromDir creates a Manifest by reading the directory at path. The +// manifest stores the structure and properties of files in the directory. +// ManifestFromDir can be used with Equal to compare two directories. +func ManifestFromDir(t assert.TestingT, path string) Manifest { + if ht, ok := t.(helperT); ok { + ht.Helper() + } + + manifest, err := manifestFromDir(path) + assert.NilError(t, err) + return manifest +} + +func manifestFromDir(path string) (Manifest, error) { + info, err := os.Stat(path) + switch { + case err != nil: + return Manifest{}, err + case !info.IsDir(): + return Manifest{}, errors.Errorf("path %s must be a directory", path) + } + + directory, err := newDirectory(path, info) + return Manifest{root: directory}, err +} + +func newDirectory(path string, info os.FileInfo) (*directory, error) { + items := make(map[string]dirEntry) + children, err := ioutil.ReadDir(path) + if err != nil { + return nil, err + } + for _, child := range children { + fullPath := filepath.Join(path, child.Name()) + items[child.Name()], err = getTypedResource(fullPath, child) + if err != nil { + return nil, err + } + } + + return &directory{ + resource: newResourceFromInfo(info), + items: items, + }, nil +} + +func getTypedResource(path string, info os.FileInfo) (dirEntry, error) { + switch { + case info.IsDir(): + return newDirectory(path, info) + case info.Mode()&os.ModeSymlink != 0: + return newSymlink(path, info) + // TODO: devices, pipes? + default: + return newFile(path, info) + } +} + +func newSymlink(path string, info os.FileInfo) (*symlink, error) { + target, err := os.Readlink(path) + return &symlink{ + resource: newResourceFromInfo(info), + target: target, + }, err +} + +func newFile(path string, info os.FileInfo) (*file, error) { + // TODO: defer file opening to reduce number of open FDs? + readCloser, err := os.Open(path) + return &file{ + resource: newResourceFromInfo(info), + content: readCloser, + }, err +} diff --git a/vendor/gotest.tools/fs/manifest_unix.go b/vendor/gotest.tools/fs/manifest_unix.go new file mode 100644 index 0000000000..bba2fcd9df --- /dev/null +++ b/vendor/gotest.tools/fs/manifest_unix.go @@ -0,0 +1,30 @@ +// +build !windows + +package fs + +import ( + "os" + "syscall" +) + +const ( + defaultRootDirMode = os.ModeDir | 0700 + defaultSymlinkMode = os.ModeSymlink | 0777 +) + +func newResourceFromInfo(info os.FileInfo) resource { + statT := info.Sys().(*syscall.Stat_t) + return resource{ + mode: info.Mode(), + uid: statT.Uid, + gid: statT.Gid, + } +} + +func (p *filePath) SetMode(mode os.FileMode) { + p.file.mode = mode +} + +func (p *directoryPath) SetMode(mode os.FileMode) { + p.directory.mode = mode | os.ModeDir +} diff --git a/vendor/gotest.tools/fs/manifest_windows.go b/vendor/gotest.tools/fs/manifest_windows.go new file mode 100644 index 0000000000..1c1a093679 --- /dev/null +++ b/vendor/gotest.tools/fs/manifest_windows.go @@ -0,0 +1,22 @@ +package fs + +import "os" + +const ( + defaultRootDirMode = os.ModeDir | 0777 + defaultSymlinkMode = os.ModeSymlink | 0666 +) + +func newResourceFromInfo(info os.FileInfo) resource { + return resource{mode: info.Mode()} +} + +func (p *filePath) SetMode(mode os.FileMode) { + bits := mode & 0600 + p.file.mode = bits + bits/010 + bits/0100 +} + +// TODO: is mode ignored on windows? +func (p *directoryPath) SetMode(mode os.FileMode) { + p.directory.mode = defaultRootDirMode +} diff --git a/vendor/github.com/gotestyourself/gotestyourself/fs/ops.go b/vendor/gotest.tools/fs/ops.go similarity index 61% rename from vendor/github.com/gotestyourself/gotestyourself/fs/ops.go rename to vendor/gotest.tools/fs/ops.go index bf9d2150b3..ec9d11c110 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/fs/ops.go +++ b/vendor/gotest.tools/fs/ops.go @@ -1,32 +1,73 @@ package fs import ( + "bytes" + "io" "io/ioutil" "os" "path/filepath" + "strings" "time" + + "github.com/pkg/errors" ) -// PathOp is a function which accepts a Path to perform some operation +const defaultFileMode = 0644 + +// PathOp is a function which accepts a Path and performs an operation on that +// path. When called with real filesystem objects (File or Dir) a PathOp modifies +// the filesystem at the path. When used with a Manifest object a PathOp updates +// the manifest to expect a value. type PathOp func(path Path) error +type manifestResource interface { + SetMode(mode os.FileMode) + SetUID(uid uint32) + SetGID(gid uint32) +} + +type manifestFile interface { + manifestResource + SetContent(content io.ReadCloser) +} + +type manifestDirectory interface { + manifestResource + AddSymlink(path, target string) error + AddFile(path string, ops ...PathOp) error + AddDirectory(path string, ops ...PathOp) error +} + // WithContent writes content to a file at Path func WithContent(content string) PathOp { return func(path Path) error { - return ioutil.WriteFile(path.Path(), []byte(content), 0644) + if m, ok := path.(manifestFile); ok { + m.SetContent(ioutil.NopCloser(strings.NewReader(content))) + return nil + } + return ioutil.WriteFile(path.Path(), []byte(content), defaultFileMode) } } // WithBytes write bytes to a file at Path func WithBytes(raw []byte) PathOp { return func(path Path) error { - return ioutil.WriteFile(path.Path(), raw, 0644) + if m, ok := path.(manifestFile); ok { + m.SetContent(ioutil.NopCloser(bytes.NewReader(raw))) + return nil + } + return ioutil.WriteFile(path.Path(), raw, defaultFileMode) } } // AsUser changes ownership of the file system object at Path func AsUser(uid, gid int) PathOp { return func(path Path) error { + if m, ok := path.(manifestResource); ok { + m.SetUID(uint32(uid)) + m.SetGID(uint32(gid)) + return nil + } return os.Chown(path.Path(), uid, gid) } } @@ -34,6 +75,11 @@ func AsUser(uid, gid int) PathOp { // WithFile creates a file in the directory at path with content func WithFile(filename, content string, ops ...PathOp) PathOp { return func(path Path) error { + if m, ok := path.(manifestDirectory); ok { + ops = append([]PathOp{WithContent(content), WithMode(defaultFileMode)}, ops...) + return m.AddFile(filename, ops...) + } + fullpath := filepath.Join(path.Path(), filepath.FromSlash(filename)) if err := createFile(fullpath, content); err != nil { return err @@ -43,12 +89,22 @@ func WithFile(filename, content string, ops ...PathOp) PathOp { } func createFile(fullpath string, content string) error { - return ioutil.WriteFile(fullpath, []byte(content), 0644) + return ioutil.WriteFile(fullpath, []byte(content), defaultFileMode) } // WithFiles creates all the files in the directory at path with their content func WithFiles(files map[string]string) PathOp { return func(path Path) error { + if m, ok := path.(manifestDirectory); ok { + for filename, content := range files { + // TODO: remove duplication with WithFile + if err := m.AddFile(filename, WithContent(content), WithMode(defaultFileMode)); err != nil { + return err + } + } + return nil + } + for filename, content := range files { fullpath := filepath.Join(path.Path(), filepath.FromSlash(filename)) if err := createFile(fullpath, content); err != nil { @@ -62,6 +118,9 @@ func WithFiles(files map[string]string) PathOp { // FromDir copies the directory tree from the source path into the new Dir func FromDir(source string) PathOp { return func(path Path) error { + if _, ok := path.(manifestDirectory); ok { + return errors.New("use manifest.FromDir") + } return copyDirectory(source, path.Path()) } } @@ -69,9 +128,15 @@ func FromDir(source string) PathOp { // WithDir creates a subdirectory in the directory at path. Additional PathOp // can be used to modify the subdirectory func WithDir(name string, ops ...PathOp) PathOp { + const defaultMode = 0755 return func(path Path) error { + if m, ok := path.(manifestDirectory); ok { + ops = append([]PathOp{WithMode(defaultMode)}, ops...) + return m.AddDirectory(name, ops...) + } + fullpath := filepath.Join(path.Path(), filepath.FromSlash(name)) - err := os.MkdirAll(fullpath, 0755) + err := os.MkdirAll(fullpath, defaultMode) if err != nil { return err } @@ -91,6 +156,10 @@ func applyPathOps(path Path, ops []PathOp) error { // WithMode sets the file mode on the directory or file at path func WithMode(mode os.FileMode) PathOp { return func(path Path) error { + if m, ok := path.(manifestResource); ok { + m.SetMode(mode) + return nil + } return os.Chmod(path.Path(), mode) } } @@ -112,6 +181,7 @@ func copyDirectory(source, dest string) error { } continue } + // TODO: handle symlinks if err := copyFile(sourcePath, destPath); err != nil { return err } @@ -134,6 +204,9 @@ func copyFile(source, dest string) error { // the other functions in this package. func WithSymlink(path, target string) PathOp { return func(root Path) error { + if v, ok := root.(manifestDirectory); ok { + return v.AddSymlink(path, target) + } return os.Symlink(filepath.Join(root.Path(), target), filepath.Join(root.Path(), path)) } } @@ -145,6 +218,9 @@ func WithSymlink(path, target string) PathOp { // the other functions in this package. func WithHardlink(path, target string) PathOp { return func(root Path) error { + if _, ok := root.(manifestDirectory); ok { + return errors.New("WithHardlink yet implemented for manifests") + } return os.Link(filepath.Join(root.Path(), target), filepath.Join(root.Path(), path)) } } @@ -153,6 +229,9 @@ func WithHardlink(path, target string) PathOp { // at path. func WithTimestamps(atime, mtime time.Time) PathOp { return func(root Path) error { + if _, ok := root.(manifestDirectory); ok { + return errors.New("WithTimestamp yet implemented for manifests") + } return os.Chtimes(root.Path(), atime, mtime) } } diff --git a/vendor/gotest.tools/fs/path.go b/vendor/gotest.tools/fs/path.go new file mode 100644 index 0000000000..baf777f0df --- /dev/null +++ b/vendor/gotest.tools/fs/path.go @@ -0,0 +1,151 @@ +package fs + +import ( + "bytes" + "io" + "io/ioutil" + "os" + + "gotest.tools/assert" +) + +// resourcePath is an adaptor for resources so they can be used as a Path +// with PathOps. +type resourcePath struct{} + +func (p *resourcePath) Path() string { + return "manifest: not a filesystem path" +} + +func (p *resourcePath) Remove() {} + +type filePath struct { + resourcePath + file *file +} + +func (p *filePath) SetContent(content io.ReadCloser) { + p.file.content = content +} + +func (p *filePath) SetUID(uid uint32) { + p.file.uid = uid +} + +func (p *filePath) SetGID(gid uint32) { + p.file.gid = gid +} + +type directoryPath struct { + resourcePath + directory *directory +} + +func (p *directoryPath) SetUID(uid uint32) { + p.directory.uid = uid +} + +func (p *directoryPath) SetGID(gid uint32) { + p.directory.gid = gid +} + +func (p *directoryPath) AddSymlink(path, target string) error { + p.directory.items[path] = &symlink{ + resource: newResource(defaultSymlinkMode), + target: target, + } + return nil +} + +func (p *directoryPath) AddFile(path string, ops ...PathOp) error { + newFile := &file{resource: newResource(0)} + p.directory.items[path] = newFile + exp := &filePath{file: newFile} + return applyPathOps(exp, ops) +} + +func (p *directoryPath) AddDirectory(path string, ops ...PathOp) error { + newDir := newDirectoryWithDefaults() + p.directory.items[path] = newDir + exp := &directoryPath{directory: newDir} + return applyPathOps(exp, ops) +} + +// Expected returns a Manifest with a directory structured created by ops. The +// PathOp operations are applied to the manifest as expectations of the +// filesystem structure and properties. +func Expected(t assert.TestingT, ops ...PathOp) Manifest { + if ht, ok := t.(helperT); ok { + ht.Helper() + } + + newDir := newDirectoryWithDefaults() + e := &directoryPath{directory: newDir} + assert.NilError(t, applyPathOps(e, ops)) + return Manifest{root: newDir} +} + +func newDirectoryWithDefaults() *directory { + return &directory{ + resource: newResource(defaultRootDirMode), + items: make(map[string]dirEntry), + } +} + +func newResource(mode os.FileMode) resource { + return resource{ + mode: mode, + uid: currentUID(), + gid: currentGID(), + } +} + +func currentUID() uint32 { + return normalizeID(os.Getuid()) +} + +func currentGID() uint32 { + return normalizeID(os.Getgid()) +} + +func normalizeID(id int) uint32 { + // ids will be -1 on windows + if id < 0 { + return 0 + } + return uint32(id) +} + +var anyFileContent = ioutil.NopCloser(bytes.NewReader(nil)) + +// MatchAnyFileContent is a PathOp that updates a Manifest so that the file +// at path may contain any content. +func MatchAnyFileContent(path Path) error { + if m, ok := path.(*filePath); ok { + m.SetContent(anyFileContent) + } + return nil +} + +const anyFile = "*" + +// MatchExtraFiles is a PathOp that updates a Manifest to allow a directory +// to contain unspecified files. +func MatchExtraFiles(path Path) error { + if m, ok := path.(*directoryPath); ok { + m.AddFile(anyFile) + } + return nil +} + +// anyFileMode is represented by uint32_max +const anyFileMode os.FileMode = 4294967295 + +// MatchAnyFileMode is a PathOp that updates a Manifest so that the resource at path +// will match any file mode. +func MatchAnyFileMode(path Path) error { + if m, ok := path.(manifestResource); ok { + m.SetMode(anyFileMode) + } + return nil +} diff --git a/vendor/gotest.tools/fs/report.go b/vendor/gotest.tools/fs/report.go new file mode 100644 index 0000000000..4de85a6ef7 --- /dev/null +++ b/vendor/gotest.tools/fs/report.go @@ -0,0 +1,215 @@ +package fs + +import ( + "bytes" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "sort" + "strings" + + "gotest.tools/assert/cmp" + "gotest.tools/internal/format" +) + +// Equal compares a directory to the expected structured described by a manifest +// and returns success if they match. If they do not match the failure message +// will contain all the differences between the directory structure and the +// expected structure defined by the Manifest. +// +// Equal is a cmp.Comparison which can be used with assert.Assert(). +func Equal(path string, expected Manifest) cmp.Comparison { + return func() cmp.Result { + actual, err := manifestFromDir(path) + if err != nil { + return cmp.ResultFromError(err) + } + failures := eqDirectory(string(os.PathSeparator), expected.root, actual.root) + if len(failures) == 0 { + return cmp.ResultSuccess + } + msg := fmt.Sprintf("directory %s does not match expected:\n", path) + return cmp.ResultFailure(msg + formatFailures(failures)) + } +} + +type failure struct { + path string + problems []problem +} + +type problem string + +func notEqual(property string, x, y interface{}) problem { + return problem(fmt.Sprintf("%s: expected %s got %s", property, x, y)) +} + +func errProblem(reason string, err error) problem { + return problem(fmt.Sprintf("%s: %s", reason, err)) +} + +func existenceProblem(filename, reason string, args ...interface{}) problem { + return problem(filename + ": " + fmt.Sprintf(reason, args...)) +} + +func eqResource(x, y resource) []problem { + var p []problem + if x.uid != y.uid { + p = append(p, notEqual("uid", x.uid, y.uid)) + } + if x.gid != y.gid { + p = append(p, notEqual("gid", x.gid, y.gid)) + } + if x.mode != anyFileMode && x.mode != y.mode { + p = append(p, notEqual("mode", x.mode, y.mode)) + } + return p +} + +func eqFile(x, y *file) []problem { + p := eqResource(x.resource, y.resource) + + switch { + case x.content == nil: + p = append(p, existenceProblem("content", "expected content is nil")) + return p + case x.content == anyFileContent: + return p + case y.content == nil: + p = append(p, existenceProblem("content", "actual content is nil")) + return p + } + + xContent, xErr := ioutil.ReadAll(x.content) + defer x.content.Close() + yContent, yErr := ioutil.ReadAll(y.content) + defer y.content.Close() + + if xErr != nil { + p = append(p, errProblem("failed to read expected content", xErr)) + } + if yErr != nil { + p = append(p, errProblem("failed to read actual content", xErr)) + } + if xErr != nil || yErr != nil { + return p + } + + if !bytes.Equal(xContent, yContent) { + p = append(p, diffContent(xContent, yContent)) + } + return p +} + +func diffContent(x, y []byte) problem { + diff := format.UnifiedDiff(format.DiffConfig{ + A: string(x), + B: string(y), + From: "expected", + To: "actual", + }) + // Remove the trailing newline in the diff. A trailing newline is always + // added to a problem by formatFailures. + diff = strings.TrimSuffix(diff, "\n") + return problem("content:\n" + indent(diff, " ")) +} + +func indent(s, prefix string) string { + buf := new(bytes.Buffer) + lines := strings.SplitAfter(s, "\n") + for _, line := range lines { + buf.WriteString(prefix + line) + } + return buf.String() +} + +func eqSymlink(x, y *symlink) []problem { + p := eqResource(x.resource, y.resource) + if x.target != y.target { + p = append(p, notEqual("target", x.target, y.target)) + } + return p +} + +func eqDirectory(path string, x, y *directory) []failure { + p := eqResource(x.resource, y.resource) + var f []failure + + for _, name := range sortedKeys(x.items) { + if name == anyFile { + continue + } + xEntry := x.items[name] + yEntry, ok := y.items[name] + if !ok { + p = append(p, existenceProblem(name, "expected %s to exist", xEntry.Type())) + continue + } + + if xEntry.Type() != yEntry.Type() { + p = append(p, notEqual(name, xEntry.Type(), yEntry.Type())) + continue + } + + f = append(f, eqEntry(filepath.Join(path, name), xEntry, yEntry)...) + } + + if _, ok := x.items[anyFile]; !ok { + for _, name := range sortedKeys(y.items) { + if _, ok := x.items[name]; !ok { + yEntry := y.items[name] + p = append(p, existenceProblem(name, "unexpected %s", yEntry.Type())) + } + } + } + + if len(p) > 0 { + f = append(f, failure{path: path, problems: p}) + } + return f +} + +func sortedKeys(items map[string]dirEntry) []string { + var keys []string + for key := range items { + keys = append(keys, key) + } + sort.Strings(keys) + return keys +} + +// eqEntry assumes x and y to be the same type +func eqEntry(path string, x, y dirEntry) []failure { + resp := func(problems []problem) []failure { + if len(problems) == 0 { + return nil + } + return []failure{{path: path, problems: problems}} + } + + switch typed := x.(type) { + case *file: + return resp(eqFile(typed, y.(*file))) + case *symlink: + return resp(eqSymlink(typed, y.(*symlink))) + case *directory: + return eqDirectory(path, typed, y.(*directory)) + } + return nil +} + +func formatFailures(failures []failure) string { + sort.Slice(failures, func(i, j int) bool { + return failures[i].path < failures[j].path + }) + + buf := new(bytes.Buffer) + for _, failure := range failures { + buf.WriteString(failure.path + "\n") + for _, problem := range failure.problems { + buf.WriteString(" " + string(problem) + "\n") + } + } + return buf.String() +} diff --git a/vendor/github.com/gotestyourself/gotestyourself/icmd/command.go b/vendor/gotest.tools/icmd/command.go similarity index 98% rename from vendor/github.com/gotestyourself/gotestyourself/icmd/command.go rename to vendor/gotest.tools/icmd/command.go index 0066c51514..901895991a 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/icmd/command.go +++ b/vendor/gotest.tools/icmd/command.go @@ -1,6 +1,6 @@ /*Package icmd executes binaries and provides convenient assertions for testing the results. */ -package icmd +package icmd // import "gotest.tools/icmd" import ( "bytes" @@ -11,8 +11,8 @@ import ( "sync" "time" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + "gotest.tools/assert/cmp" ) type helperT interface { @@ -228,6 +228,7 @@ func StartCmd(cmd Cmd) *Result { return result } +// TODO: support exec.CommandContext func buildCmd(cmd Cmd) *Result { var execCmd *exec.Cmd switch len(cmd.Command) { diff --git a/vendor/github.com/gotestyourself/gotestyourself/icmd/exitcode.go b/vendor/gotest.tools/icmd/exitcode.go similarity index 100% rename from vendor/github.com/gotestyourself/gotestyourself/icmd/exitcode.go rename to vendor/gotest.tools/icmd/exitcode.go diff --git a/vendor/github.com/gotestyourself/gotestyourself/icmd/ops.go b/vendor/gotest.tools/icmd/ops.go similarity index 100% rename from vendor/github.com/gotestyourself/gotestyourself/icmd/ops.go rename to vendor/gotest.tools/icmd/ops.go diff --git a/vendor/github.com/pmezard/go-difflib/LICENSE b/vendor/gotest.tools/internal/difflib/LICENSE similarity index 100% rename from vendor/github.com/pmezard/go-difflib/LICENSE rename to vendor/gotest.tools/internal/difflib/LICENSE diff --git a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go b/vendor/gotest.tools/internal/difflib/difflib.go similarity index 56% rename from vendor/github.com/pmezard/go-difflib/difflib/difflib.go rename to vendor/gotest.tools/internal/difflib/difflib.go index 003e99fadb..5efa99c1d4 100644 --- a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go +++ b/vendor/gotest.tools/internal/difflib/difflib.go @@ -1,27 +1,10 @@ -// Package difflib is a partial port of Python difflib module. -// -// It provides tools to compare sequences of strings and generate textual diffs. -// -// The following class and functions have been ported: -// -// - SequenceMatcher -// -// - unified_diff -// -// - context_diff -// -// Getting unified diffs was the main goal of the port. Keep in mind this code -// is mostly suitable to output text differences in a human friendly way, there -// are no guarantees generated diffs are consumable by patch(1). -package difflib +/* Package difflib is a partial port of Python difflib module. -import ( - "bufio" - "bytes" - "fmt" - "io" - "strings" -) +Original source: https://github.com/pmezard/go-difflib + +This file is trimmed to only the parts used by this repository. +*/ +package difflib // import "gotest.tools/internal/difflib" func min(a, b int) int { if a < b { @@ -37,13 +20,6 @@ func max(a, b int) int { return b } -func calculateRatio(matches, length int) float64 { - if length > 0 { - return 2.0 * float64(matches) / float64(length) - } - return 1.0 -} - type Match struct { A int B int @@ -103,14 +79,6 @@ func NewMatcher(a, b []string) *SequenceMatcher { return &m } -func NewMatcherWithJunk(a, b []string, autoJunk bool, - isJunk func(string) bool) *SequenceMatcher { - - m := SequenceMatcher{IsJunk: isJunk, autoJunk: autoJunk} - m.SetSeqs(a, b) - return &m -} - // Set two sequences to be compared. func (m *SequenceMatcher) SetSeqs(a, b []string) { m.SetSeq1(a) @@ -450,323 +418,3 @@ func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode { } return groups } - -// Return a measure of the sequences' similarity (float in [0,1]). -// -// Where T is the total number of elements in both sequences, and -// M is the number of matches, this is 2.0*M / T. -// Note that this is 1 if the sequences are identical, and 0 if -// they have nothing in common. -// -// .Ratio() is expensive to compute if you haven't already computed -// .GetMatchingBlocks() or .GetOpCodes(), in which case you may -// want to try .QuickRatio() or .RealQuickRation() first to get an -// upper bound. -func (m *SequenceMatcher) Ratio() float64 { - matches := 0 - for _, m := range m.GetMatchingBlocks() { - matches += m.Size - } - return calculateRatio(matches, len(m.a)+len(m.b)) -} - -// Return an upper bound on ratio() relatively quickly. -// -// This isn't defined beyond that it is an upper bound on .Ratio(), and -// is faster to compute. -func (m *SequenceMatcher) QuickRatio() float64 { - // viewing a and b as multisets, set matches to the cardinality - // of their intersection; this counts the number of matches - // without regard to order, so is clearly an upper bound - if m.fullBCount == nil { - m.fullBCount = map[string]int{} - for _, s := range m.b { - m.fullBCount[s] = m.fullBCount[s] + 1 - } - } - - // avail[x] is the number of times x appears in 'b' less the - // number of times we've seen it in 'a' so far ... kinda - avail := map[string]int{} - matches := 0 - for _, s := range m.a { - n, ok := avail[s] - if !ok { - n = m.fullBCount[s] - } - avail[s] = n - 1 - if n > 0 { - matches += 1 - } - } - return calculateRatio(matches, len(m.a)+len(m.b)) -} - -// Return an upper bound on ratio() very quickly. -// -// This isn't defined beyond that it is an upper bound on .Ratio(), and -// is faster to compute than either .Ratio() or .QuickRatio(). -func (m *SequenceMatcher) RealQuickRatio() float64 { - la, lb := len(m.a), len(m.b) - return calculateRatio(min(la, lb), la+lb) -} - -// Convert range to the "ed" format -func formatRangeUnified(start, stop int) string { - // Per the diff spec at http://www.unix.org/single_unix_specification/ - beginning := start + 1 // lines start numbering with one - length := stop - start - if length == 1 { - return fmt.Sprintf("%d", beginning) - } - if length == 0 { - beginning -= 1 // empty ranges begin at line just before the range - } - return fmt.Sprintf("%d,%d", beginning, length) -} - -// Unified diff parameters -type UnifiedDiff struct { - A []string // First sequence lines - FromFile string // First file name - FromDate string // First file time - B []string // Second sequence lines - ToFile string // Second file name - ToDate string // Second file time - Eol string // Headers end of line, defaults to LF - Context int // Number of context lines -} - -// Compare two sequences of lines; generate the delta as a unified diff. -// -// Unified diffs are a compact way of showing line changes and a few -// lines of context. The number of context lines is set by 'n' which -// defaults to three. -// -// By default, the diff control lines (those with ---, +++, or @@) are -// created with a trailing newline. This is helpful so that inputs -// created from file.readlines() result in diffs that are suitable for -// file.writelines() since both the inputs and outputs have trailing -// newlines. -// -// For inputs that do not have trailing newlines, set the lineterm -// argument to "" so that the output will be uniformly newline free. -// -// The unidiff format normally has a header for filenames and modification -// times. Any or all of these may be specified using strings for -// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. -// The modification times are normally expressed in the ISO 8601 format. -func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error { - buf := bufio.NewWriter(writer) - defer buf.Flush() - wf := func(format string, args ...interface{}) error { - _, err := buf.WriteString(fmt.Sprintf(format, args...)) - return err - } - ws := func(s string) error { - _, err := buf.WriteString(s) - return err - } - - if len(diff.Eol) == 0 { - diff.Eol = "\n" - } - - started := false - m := NewMatcher(diff.A, diff.B) - for _, g := range m.GetGroupedOpCodes(diff.Context) { - if !started { - started = true - fromDate := "" - if len(diff.FromDate) > 0 { - fromDate = "\t" + diff.FromDate - } - toDate := "" - if len(diff.ToDate) > 0 { - toDate = "\t" + diff.ToDate - } - if diff.FromFile != "" || diff.ToFile != "" { - err := wf("--- %s%s%s", diff.FromFile, fromDate, diff.Eol) - if err != nil { - return err - } - err = wf("+++ %s%s%s", diff.ToFile, toDate, diff.Eol) - if err != nil { - return err - } - } - } - first, last := g[0], g[len(g)-1] - range1 := formatRangeUnified(first.I1, last.I2) - range2 := formatRangeUnified(first.J1, last.J2) - if err := wf("@@ -%s +%s @@%s", range1, range2, diff.Eol); err != nil { - return err - } - for _, c := range g { - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - if c.Tag == 'e' { - for _, line := range diff.A[i1:i2] { - if err := ws(" " + line); err != nil { - return err - } - } - continue - } - if c.Tag == 'r' || c.Tag == 'd' { - for _, line := range diff.A[i1:i2] { - if err := ws("-" + line); err != nil { - return err - } - } - } - if c.Tag == 'r' || c.Tag == 'i' { - for _, line := range diff.B[j1:j2] { - if err := ws("+" + line); err != nil { - return err - } - } - } - } - } - return nil -} - -// Like WriteUnifiedDiff but returns the diff a string. -func GetUnifiedDiffString(diff UnifiedDiff) (string, error) { - w := &bytes.Buffer{} - err := WriteUnifiedDiff(w, diff) - return string(w.Bytes()), err -} - -// Convert range to the "ed" format. -func formatRangeContext(start, stop int) string { - // Per the diff spec at http://www.unix.org/single_unix_specification/ - beginning := start + 1 // lines start numbering with one - length := stop - start - if length == 0 { - beginning -= 1 // empty ranges begin at line just before the range - } - if length <= 1 { - return fmt.Sprintf("%d", beginning) - } - return fmt.Sprintf("%d,%d", beginning, beginning+length-1) -} - -type ContextDiff UnifiedDiff - -// Compare two sequences of lines; generate the delta as a context diff. -// -// Context diffs are a compact way of showing line changes and a few -// lines of context. The number of context lines is set by diff.Context -// which defaults to three. -// -// By default, the diff control lines (those with *** or ---) are -// created with a trailing newline. -// -// For inputs that do not have trailing newlines, set the diff.Eol -// argument to "" so that the output will be uniformly newline free. -// -// The context diff format normally has a header for filenames and -// modification times. Any or all of these may be specified using -// strings for diff.FromFile, diff.ToFile, diff.FromDate, diff.ToDate. -// The modification times are normally expressed in the ISO 8601 format. -// If not specified, the strings default to blanks. -func WriteContextDiff(writer io.Writer, diff ContextDiff) error { - buf := bufio.NewWriter(writer) - defer buf.Flush() - var diffErr error - wf := func(format string, args ...interface{}) { - _, err := buf.WriteString(fmt.Sprintf(format, args...)) - if diffErr == nil && err != nil { - diffErr = err - } - } - ws := func(s string) { - _, err := buf.WriteString(s) - if diffErr == nil && err != nil { - diffErr = err - } - } - - if len(diff.Eol) == 0 { - diff.Eol = "\n" - } - - prefix := map[byte]string{ - 'i': "+ ", - 'd': "- ", - 'r': "! ", - 'e': " ", - } - - started := false - m := NewMatcher(diff.A, diff.B) - for _, g := range m.GetGroupedOpCodes(diff.Context) { - if !started { - started = true - fromDate := "" - if len(diff.FromDate) > 0 { - fromDate = "\t" + diff.FromDate - } - toDate := "" - if len(diff.ToDate) > 0 { - toDate = "\t" + diff.ToDate - } - if diff.FromFile != "" || diff.ToFile != "" { - wf("*** %s%s%s", diff.FromFile, fromDate, diff.Eol) - wf("--- %s%s%s", diff.ToFile, toDate, diff.Eol) - } - } - - first, last := g[0], g[len(g)-1] - ws("***************" + diff.Eol) - - range1 := formatRangeContext(first.I1, last.I2) - wf("*** %s ****%s", range1, diff.Eol) - for _, c := range g { - if c.Tag == 'r' || c.Tag == 'd' { - for _, cc := range g { - if cc.Tag == 'i' { - continue - } - for _, line := range diff.A[cc.I1:cc.I2] { - ws(prefix[cc.Tag] + line) - } - } - break - } - } - - range2 := formatRangeContext(first.J1, last.J2) - wf("--- %s ----%s", range2, diff.Eol) - for _, c := range g { - if c.Tag == 'r' || c.Tag == 'i' { - for _, cc := range g { - if cc.Tag == 'd' { - continue - } - for _, line := range diff.B[cc.J1:cc.J2] { - ws(prefix[cc.Tag] + line) - } - } - break - } - } - } - return diffErr -} - -// Like WriteContextDiff but returns the diff a string. -func GetContextDiffString(diff ContextDiff) (string, error) { - w := &bytes.Buffer{} - err := WriteContextDiff(w, diff) - return string(w.Bytes()), err -} - -// Split a string on "\n" while preserving them. The output can be used -// as input for UnifiedDiff and ContextDiff structures. -func SplitLines(s string) []string { - lines := strings.SplitAfter(s, "\n") - lines[len(lines)-1] += "\n" - return lines -} diff --git a/vendor/gotest.tools/internal/format/diff.go b/vendor/gotest.tools/internal/format/diff.go new file mode 100644 index 0000000000..c938c97bec --- /dev/null +++ b/vendor/gotest.tools/internal/format/diff.go @@ -0,0 +1,161 @@ +package format + +import ( + "bytes" + "fmt" + "strings" + "unicode" + + "gotest.tools/internal/difflib" +) + +const ( + contextLines = 2 +) + +// DiffConfig for a unified diff +type DiffConfig struct { + A string + B string + From string + To string +} + +// UnifiedDiff is a modified version of difflib.WriteUnifiedDiff with better +// support for showing the whitespace differences. +func UnifiedDiff(conf DiffConfig) string { + a := strings.SplitAfter(conf.A, "\n") + b := strings.SplitAfter(conf.B, "\n") + groups := difflib.NewMatcher(a, b).GetGroupedOpCodes(contextLines) + if len(groups) == 0 { + return "" + } + + buf := new(bytes.Buffer) + writeFormat := func(format string, args ...interface{}) { + buf.WriteString(fmt.Sprintf(format, args...)) + } + writeLine := func(prefix string, s string) { + buf.WriteString(prefix + s) + } + if hasWhitespaceDiffLines(groups, a, b) { + writeLine = visibleWhitespaceLine(writeLine) + } + formatHeader(writeFormat, conf) + for _, group := range groups { + formatRangeLine(writeFormat, group) + for _, opCode := range group { + in, out := a[opCode.I1:opCode.I2], b[opCode.J1:opCode.J2] + switch opCode.Tag { + case 'e': + formatLines(writeLine, " ", in) + case 'r': + formatLines(writeLine, "-", in) + formatLines(writeLine, "+", out) + case 'd': + formatLines(writeLine, "-", in) + case 'i': + formatLines(writeLine, "+", out) + } + } + } + return buf.String() +} + +// hasWhitespaceDiffLines returns true if any diff groups is only different +// because of whitespace characters. +func hasWhitespaceDiffLines(groups [][]difflib.OpCode, a, b []string) bool { + for _, group := range groups { + in, out := new(bytes.Buffer), new(bytes.Buffer) + for _, opCode := range group { + if opCode.Tag == 'e' { + continue + } + for _, line := range a[opCode.I1:opCode.I2] { + in.WriteString(line) + } + for _, line := range b[opCode.J1:opCode.J2] { + out.WriteString(line) + } + } + if removeWhitespace(in.String()) == removeWhitespace(out.String()) { + return true + } + } + return false +} + +func removeWhitespace(s string) string { + var result []rune + for _, r := range s { + if !unicode.IsSpace(r) { + result = append(result, r) + } + } + return string(result) +} + +func visibleWhitespaceLine(ws func(string, string)) func(string, string) { + mapToVisibleSpace := func(r rune) rune { + switch r { + case '\n': + case ' ': + return '·' + case '\t': + return '▷' + case '\v': + return '▽' + case '\r': + return '↵' + case '\f': + return '↓' + default: + if unicode.IsSpace(r) { + return '�' + } + } + return r + } + return func(prefix, s string) { + ws(prefix, strings.Map(mapToVisibleSpace, s)) + } +} + +func formatHeader(wf func(string, ...interface{}), conf DiffConfig) { + if conf.From != "" || conf.To != "" { + wf("--- %s\n", conf.From) + wf("+++ %s\n", conf.To) + } +} + +func formatRangeLine(wf func(string, ...interface{}), group []difflib.OpCode) { + first, last := group[0], group[len(group)-1] + range1 := formatRangeUnified(first.I1, last.I2) + range2 := formatRangeUnified(first.J1, last.J2) + wf("@@ -%s +%s @@\n", range1, range2) +} + +// Convert range to the "ed" format +func formatRangeUnified(start, stop int) string { + // Per the diff spec at http://www.unix.org/single_unix_specification/ + beginning := start + 1 // lines start numbering with one + length := stop - start + if length == 1 { + return fmt.Sprintf("%d", beginning) + } + if length == 0 { + beginning-- // empty ranges begin at line just before the range + } + return fmt.Sprintf("%d,%d", beginning, length) +} + +func formatLines(writeLine func(string, string), prefix string, lines []string) { + for _, line := range lines { + writeLine(prefix, line) + } + // Add a newline if the last line is missing one so that the diff displays + // properly. + if !strings.HasSuffix(lines[len(lines)-1], "\n") { + writeLine("", "\n") + } +} diff --git a/vendor/github.com/gotestyourself/gotestyourself/internal/format/format.go b/vendor/gotest.tools/internal/format/format.go similarity index 91% rename from vendor/github.com/gotestyourself/gotestyourself/internal/format/format.go rename to vendor/gotest.tools/internal/format/format.go index 6961ffe6da..8f6494f994 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/internal/format/format.go +++ b/vendor/gotest.tools/internal/format/format.go @@ -1,4 +1,4 @@ -package format +package format // import "gotest.tools/internal/format" import "fmt" diff --git a/vendor/github.com/gotestyourself/gotestyourself/internal/source/source.go b/vendor/gotest.tools/internal/source/source.go similarity index 98% rename from vendor/github.com/gotestyourself/gotestyourself/internal/source/source.go rename to vendor/gotest.tools/internal/source/source.go index f71c5129b8..a05933cc33 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/internal/source/source.go +++ b/vendor/gotest.tools/internal/source/source.go @@ -1,4 +1,4 @@ -package source +package source // import "gotest.tools/internal/source" import ( "bytes" diff --git a/vendor/github.com/gotestyourself/gotestyourself/poll/poll.go b/vendor/gotest.tools/poll/poll.go similarity index 95% rename from vendor/github.com/gotestyourself/gotestyourself/poll/poll.go rename to vendor/gotest.tools/poll/poll.go index 42a42cc149..3e3dd7f58a 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/poll/poll.go +++ b/vendor/gotest.tools/poll/poll.go @@ -1,6 +1,6 @@ /*Package poll provides tools for testing asynchronous code. */ -package poll +package poll // import "gotest.tools/poll" import ( "fmt" @@ -25,15 +25,15 @@ type helperT interface { // Settings are used to configure the behaviour of WaitOn type Settings struct { - // Timeout is the maximum time to wait for the condition. Defaults to 10s + // Timeout is the maximum time to wait for the condition. Defaults to 10s. Timeout time.Duration - // Delay is the time to sleep between checking the condition. Detaults to - // 1ms + // Delay is the time to sleep between checking the condition. Defaults to + // 100ms. Delay time.Duration } func defaultConfig() *Settings { - return &Settings{Timeout: 10 * time.Second, Delay: time.Millisecond} + return &Settings{Timeout: 10 * time.Second, Delay: 100 * time.Millisecond} } // SettingOp is a function which accepts and modifies Settings diff --git a/vendor/github.com/gotestyourself/gotestyourself/skip/skip.go b/vendor/gotest.tools/skip/skip.go similarity index 60% rename from vendor/github.com/gotestyourself/gotestyourself/skip/skip.go rename to vendor/gotest.tools/skip/skip.go index 46ab288819..4bfc9a11c2 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/skip/skip.go +++ b/vendor/gotest.tools/skip/skip.go @@ -1,6 +1,7 @@ -/*Package skip provides functions for skipping based on a condition. - */ -package skip +/*Package skip provides functions for skipping a test and printing the source code +of the condition used to skip the test. +*/ +package skip // import "gotest.tools/skip" import ( "fmt" @@ -9,8 +10,8 @@ import ( "runtime" "strings" - "github.com/gotestyourself/gotestyourself/internal/format" - "github.com/gotestyourself/gotestyourself/internal/source" + "gotest.tools/internal/format" + "gotest.tools/internal/source" ) type skipT interface { @@ -25,9 +26,10 @@ type helperT interface { // BoolOrCheckFunc can be a bool or func() bool, other types will panic type BoolOrCheckFunc interface{} -// If skips the test if the check function returns true. The skip message will -// contain the name of the check function. Extra message text can be passed as a -// format string with args +// If the condition expression evaluates to true, or the condition function returns +// true, skip the test. +// The skip message will contain the source code of the expression. +// Extra message text can be passed as a format string with args func If(t skipT, condition BoolOrCheckFunc, msgAndArgs ...interface{}) { if ht, ok := t.(helperT); ok { ht.Helper() @@ -49,18 +51,6 @@ func getFunctionName(function func() bool) string { return strings.SplitN(path.Base(funcPath), ".", 2)[1] } -// IfCondition skips the test if the condition is true. The skip message will -// contain the source of the expression passed as the condition. Extra message -// text can be passed as a format string with args. -// -// Deprecated: Use If() which now accepts bool arguments -func IfCondition(t skipT, condition bool, msgAndArgs ...interface{}) { - if ht, ok := t.(helperT); ok { - ht.Helper() - } - ifCondition(t, condition, msgAndArgs...) -} - func ifCondition(t skipT, condition bool, msgAndArgs ...interface{}) { if ht, ok := t.(helperT); ok { ht.Helper() diff --git a/vendor/gotest.tools/x/subtest/context.go b/vendor/gotest.tools/x/subtest/context.go new file mode 100644 index 0000000000..878bdebf14 --- /dev/null +++ b/vendor/gotest.tools/x/subtest/context.go @@ -0,0 +1,81 @@ +/*Package subtest provides a TestContext to subtests which handles cleanup, and +provides a testing.TB, and context.Context. + +This package was inspired by github.com/frankban/quicktest. +*/ +package subtest // import "gotest.tools/x/subtest" + +import ( + "context" + "testing" +) + +type testcase struct { + testing.TB + ctx context.Context + cleanupFuncs []cleanupFunc +} + +type cleanupFunc func() + +func (tc *testcase) Ctx() context.Context { + if tc.ctx == nil { + var cancel func() + tc.ctx, cancel = context.WithCancel(context.Background()) + tc.AddCleanup(cancel) + } + return tc.ctx +} + +// Cleanup runs all cleanup functions. Functions are run in the opposite order +// in which they were added. Cleanup is called automatically before Run exits. +func (tc *testcase) Cleanup() { + for _, f := range tc.cleanupFuncs { + // Defer all cleanup functions so they all run even if one calls + // t.FailNow() or panics. Deferring them also runs them in reverse order. + defer f() + } + tc.cleanupFuncs = nil +} + +func (tc *testcase) AddCleanup(f func()) { + tc.cleanupFuncs = append(tc.cleanupFuncs, f) +} + +func (tc *testcase) Parallel() { + tp, ok := tc.TB.(parallel) + if !ok { + panic("Parallel called with a testing.B") + } + tp.Parallel() +} + +type parallel interface { + Parallel() +} + +// Run a subtest. When subtest exits, every cleanup function added with +// TestContext.AddCleanup will be run. +func Run(t *testing.T, name string, subtest func(t TestContext)) bool { + return t.Run(name, func(t *testing.T) { + tc := &testcase{TB: t} + defer tc.Cleanup() + subtest(tc) + }) +} + +// TestContext provides a testing.TB and a context.Context for a test case. +type TestContext interface { + testing.TB + // AddCleanup function which will be run when before Run returns. + AddCleanup(f func()) + // Ctx returns a context for the test case. Multiple calls from the same subtest + // will return the same context. The context is cancelled when Run + // returns. + Ctx() context.Context + // Parallel calls t.Parallel on the testing.TB. Panics if testing.TB does + // not implement Parallel. + Parallel() +} + +var _ TestContext = &testcase{} diff --git a/volume/local/local_test.go b/volume/local/local_test.go index 541b8448aa..4cb47ba045 100644 --- a/volume/local/local_test.go +++ b/volume/local/local_test.go @@ -11,7 +11,7 @@ import ( "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/mount" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/skip" ) func TestGetAddress(t *testing.T) { diff --git a/volume/service/db_test.go b/volume/service/db_test.go index 14ad87a514..4cac9176b7 100644 --- a/volume/service/db_test.go +++ b/volume/service/db_test.go @@ -8,8 +8,8 @@ import ( "time" "github.com/boltdb/bolt" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestSetGetMeta(t *testing.T) { diff --git a/volume/service/restore_test.go b/volume/service/restore_test.go index d3c6c9f92c..95420d9586 100644 --- a/volume/service/restore_test.go +++ b/volume/service/restore_test.go @@ -10,7 +10,7 @@ import ( volumedrivers "github.com/docker/docker/volume/drivers" "github.com/docker/docker/volume/service/opts" volumetestutils "github.com/docker/docker/volume/testutils" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestRestore(t *testing.T) { diff --git a/volume/service/service_linux_test.go b/volume/service/service_linux_test.go index 6c1f936b6a..ae70d7e2c5 100644 --- a/volume/service/service_linux_test.go +++ b/volume/service/service_linux_test.go @@ -13,8 +13,8 @@ import ( "github.com/docker/docker/volume/local" "github.com/docker/docker/volume/service/opts" "github.com/docker/docker/volume/testutils" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestLocalVolumeSize(t *testing.T) { diff --git a/volume/service/service_test.go b/volume/service/service_test.go index 3c4130eab5..870d19f8a0 100644 --- a/volume/service/service_test.go +++ b/volume/service/service_test.go @@ -12,8 +12,8 @@ import ( volumedrivers "github.com/docker/docker/volume/drivers" "github.com/docker/docker/volume/service/opts" "github.com/docker/docker/volume/testutils" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestServiceCreate(t *testing.T) { diff --git a/volume/service/store_test.go b/volume/service/store_test.go index b6b0829952..53345f318b 100644 --- a/volume/service/store_test.go +++ b/volume/service/store_test.go @@ -15,8 +15,8 @@ import ( "github.com/docker/docker/volume/service/opts" volumetestutils "github.com/docker/docker/volume/testutils" "github.com/google/go-cmp/cmp" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestCreate(t *testing.T) {