diff --git a/cli/command/bundlefile/bundlefile_test.go b/cli/command/bundlefile/bundlefile_test.go index 8837aa1a27..cbaa341cd7 100644 --- a/cli/command/bundlefile/bundlefile_test.go +++ b/cli/command/bundlefile/bundlefile_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 TestLoadFileV01Success(t *testing.T) { diff --git a/cli/command/checkpoint/create_test.go b/cli/command/checkpoint/create_test.go index 59fdf9d108..70c6aad7e7 100644 --- a/cli/command/checkpoint/create_test.go +++ b/cli/command/checkpoint/create_test.go @@ -7,9 +7,9 @@ import ( "github.com/docker/cli/internal/test" "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 TestCheckpointCreateErrors(t *testing.T) { diff --git a/cli/command/checkpoint/list_test.go b/cli/command/checkpoint/list_test.go index 2523bba566..986d3ee469 100644 --- a/cli/command/checkpoint/list_test.go +++ b/cli/command/checkpoint/list_test.go @@ -6,10 +6,10 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestCheckpointListErrors(t *testing.T) { diff --git a/cli/command/checkpoint/remove_test.go b/cli/command/checkpoint/remove_test.go index 9816b2f16c..d1a9ac4bce 100644 --- a/cli/command/checkpoint/remove_test.go +++ b/cli/command/checkpoint/remove_test.go @@ -6,9 +6,9 @@ import ( "github.com/docker/cli/internal/test" "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 TestCheckpointRemoveErrors(t *testing.T) { diff --git a/cli/command/cli_test.go b/cli/command/cli_test.go index 1418d1b1df..26ead5ddb4 100644 --- a/cli/command/cli_test.go +++ b/cli/command/cli_test.go @@ -13,11 +13,11 @@ import ( "github.com/docker/docker/api" "github.com/docker/docker/api/types" "github.com/docker/docker/client" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/env" - "github.com/gotestyourself/gotestyourself/fs" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/env" + "gotest.tools/fs" ) func TestNewAPIClientFromFlags(t *testing.T) { diff --git a/cli/command/config/create_test.go b/cli/command/config/create_test.go index 46515ca524..bb2ea946d7 100644 --- a/cli/command/config/create_test.go +++ b/cli/command/config/create_test.go @@ -10,10 +10,10 @@ import ( "github.com/docker/cli/internal/test" "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" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) const configDataFile = "config-create-with-name.golden" diff --git a/cli/command/config/inspect_test.go b/cli/command/config/inspect_test.go index b714e95830..1b4f275ccb 100644 --- a/cli/command/config/inspect_test.go +++ b/cli/command/config/inspect_test.go @@ -11,8 +11,8 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestConfigInspectErrors(t *testing.T) { diff --git a/cli/command/config/ls_test.go b/cli/command/config/ls_test.go index 3ef7a91783..d3055b4aa1 100644 --- a/cli/command/config/ls_test.go +++ b/cli/command/config/ls_test.go @@ -12,9 +12,9 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestConfigListErrors(t *testing.T) { diff --git a/cli/command/config/remove_test.go b/cli/command/config/remove_test.go index 6501210dcf..4a1980bc80 100644 --- a/cli/command/config/remove_test.go +++ b/cli/command/config/remove_test.go @@ -6,9 +6,9 @@ import ( "testing" "github.com/docker/cli/internal/test" - "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 TestConfigRemoveErrors(t *testing.T) { diff --git a/cli/command/container/attach_test.go b/cli/command/container/attach_test.go index e8f6da29aa..7d8d3f6edf 100644 --- a/cli/command/container/attach_test.go +++ b/cli/command/container/attach_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" ) func TestNewAttachCommandErrors(t *testing.T) { diff --git a/cli/command/container/cp_test.go b/cli/command/container/cp_test.go index 7d706f354c..67cdaf15a9 100644 --- a/cli/command/container/cp_test.go +++ b/cli/command/container/cp_test.go @@ -11,10 +11,10 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/archive" - "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 TestRunCopyWithInvalidArguments(t *testing.T) { @@ -182,7 +182,7 @@ func TestSplitCpArg(t *testing.T) { } for _, testcase := range testcases { t.Run(testcase.doc, func(t *testing.T) { - skip.IfCondition(t, testcase.os != "" && testcase.os != runtime.GOOS) + skip.If(t, testcase.os != "" && testcase.os != runtime.GOOS) container, path := splitCpArg(testcase.path) assert.Check(t, is.Equal(testcase.expectedContainer, container)) diff --git a/cli/command/container/create_test.go b/cli/command/container/create_test.go index a5367dfc66..1df09c7d6f 100644 --- a/cli/command/container/create_test.go +++ b/cli/command/container/create_test.go @@ -16,10 +16,10 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" "github.com/google/go-cmp/cmp" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" ) func TestCIDFileNoOPWithNoFilename(t *testing.T) { diff --git a/cli/command/container/exec_test.go b/cli/command/container/exec_test.go index b4012a34c0..0c6e2614b9 100644 --- a/cli/command/container/exec_test.go +++ b/cli/command/container/exec_test.go @@ -10,9 +10,9 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/opts" "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 withDefaultOpts(options execOptions) execOptions { diff --git a/cli/command/container/list_test.go b/cli/command/container/list_test.go index 9a064eb735..2bc1949a7f 100644 --- a/cli/command/container/list_test.go +++ b/cli/command/container/list_test.go @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/api/types" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestContainerListErrors(t *testing.T) { diff --git a/cli/command/container/logs_test.go b/cli/command/container/logs_test.go index 4465df9a56..a618ad5e57 100644 --- a/cli/command/container/logs_test.go +++ b/cli/command/container/logs_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) var logFn = func(expectedOut string) func(string, types.ContainerLogsOptions) (io.ReadCloser, error) { diff --git a/cli/command/container/opts_test.go b/cli/command/container/opts_test.go index 5d43409662..67f0cad44d 100644 --- a/cli/command/container/opts_test.go +++ b/cli/command/container/opts_test.go @@ -12,10 +12,10 @@ import ( "github.com/docker/docker/api/types/container" networktypes "github.com/docker/docker/api/types/network" "github.com/docker/go-connections/nat" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pkg/errors" "github.com/spf13/pflag" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestValidateAttach(t *testing.T) { diff --git a/cli/command/container/ps_test.go b/cli/command/container/ps_test.go index 4ca11dcb41..28853576fe 100644 --- a/cli/command/container/ps_test.go +++ b/cli/command/container/ps_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/docker/cli/opts" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestBuildContainerListOptions(t *testing.T) { diff --git a/cli/command/container/run_test.go b/cli/command/container/run_test.go index 94dea46805..2dcf1af240 100644 --- a/cli/command/container/run_test.go +++ b/cli/command/container/run_test.go @@ -8,8 +8,8 @@ import ( "github.com/docker/cli/internal/test/notary" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestRunLabel(t *testing.T) { diff --git a/cli/command/container/stats_helpers_test.go b/cli/command/container/stats_helpers_test.go index 099f425d49..a9657e2e2c 100644 --- a/cli/command/container/stats_helpers_test.go +++ b/cli/command/container/stats_helpers_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestCalculateMemUsageUnixNoCache(t *testing.T) { diff --git a/cli/command/container/utils_test.go b/cli/command/container/utils_test.go index de9d33a734..970549c04c 100644 --- a/cli/command/container/utils_test.go +++ b/cli/command/container/utils_test.go @@ -8,9 +8,9 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api" "github.com/docker/docker/api/types/container" - "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 waitFn(cid string) (<-chan container.ContainerWaitOKBody, <-chan error) { diff --git a/cli/command/formatter/checkpoint_test.go b/cli/command/formatter/checkpoint_test.go index b91748044b..9b8ac5e505 100644 --- a/cli/command/formatter/checkpoint_test.go +++ b/cli/command/formatter/checkpoint_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestCheckpointContextFormatWrite(t *testing.T) { diff --git a/cli/command/formatter/config_test.go b/cli/command/formatter/config_test.go index 3a5efb80d2..7cd310c9ec 100644 --- a/cli/command/formatter/config_test.go +++ b/cli/command/formatter/config_test.go @@ -6,8 +6,8 @@ import ( "time" "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 TestConfigContextFormatWrite(t *testing.T) { diff --git a/cli/command/formatter/container_test.go b/cli/command/formatter/container_test.go index 8b1893f8d5..cafb9abdac 100644 --- a/cli/command/formatter/container_test.go +++ b/cli/command/formatter/container_test.go @@ -10,9 +10,9 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/stringid" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestContainerPsContext(t *testing.T) { diff --git a/cli/command/formatter/custom_test.go b/cli/command/formatter/custom_test.go index 02df8d9f85..6a4bfec784 100644 --- a/cli/command/formatter/custom_test.go +++ b/cli/command/formatter/custom_test.go @@ -4,8 +4,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 compareMultipleValues(t *testing.T, value, expected string) { diff --git a/cli/command/formatter/diff_test.go b/cli/command/formatter/diff_test.go index dd104aecc7..aad5945057 100644 --- a/cli/command/formatter/diff_test.go +++ b/cli/command/formatter/diff_test.go @@ -6,8 +6,8 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/pkg/archive" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestDiffContextFormatWrite(t *testing.T) { diff --git a/cli/command/formatter/disk_usage_test.go b/cli/command/formatter/disk_usage_test.go index dc206dea4c..6196af5986 100644 --- a/cli/command/formatter/disk_usage_test.go +++ b/cli/command/formatter/disk_usage_test.go @@ -4,9 +4,9 @@ import ( "bytes" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestDiskUsageContextFormatWrite(t *testing.T) { diff --git a/cli/command/formatter/displayutils_test.go b/cli/command/formatter/displayutils_test.go index 0182d70759..db60610bb2 100644 --- a/cli/command/formatter/displayutils_test.go +++ b/cli/command/formatter/displayutils_test.go @@ -3,8 +3,8 @@ package formatter import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestEllipsis(t *testing.T) { diff --git a/cli/command/formatter/history_test.go b/cli/command/formatter/history_test.go index 77423a8010..7dfc146be3 100644 --- a/cli/command/formatter/history_test.go +++ b/cli/command/formatter/history_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/api/types/image" "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" ) type historyCase struct { diff --git a/cli/command/formatter/image_test.go b/cli/command/formatter/image_test.go index 26488f335a..7efad0a758 100644 --- a/cli/command/formatter/image_test.go +++ b/cli/command/formatter/image_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/api/types" "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" ) func TestImageContext(t *testing.T) { diff --git a/cli/command/formatter/network_test.go b/cli/command/formatter/network_test.go index 79b5880543..6831926e46 100644 --- a/cli/command/formatter/network_test.go +++ b/cli/command/formatter/network_test.go @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/api/types" "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" ) func TestNetworkContext(t *testing.T) { diff --git a/cli/command/formatter/node_test.go b/cli/command/formatter/node_test.go index 3fa9ceb785..cf9ccbde82 100644 --- a/cli/command/formatter/node_test.go +++ b/cli/command/formatter/node_test.go @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "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" ) func TestNodeContext(t *testing.T) { diff --git a/cli/command/formatter/plugin_test.go b/cli/command/formatter/plugin_test.go index ebe615dd13..b8551589e1 100644 --- a/cli/command/formatter/plugin_test.go +++ b/cli/command/formatter/plugin_test.go @@ -8,8 +8,8 @@ import ( "github.com/docker/docker/api/types" "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" ) func TestPluginContext(t *testing.T) { diff --git a/cli/command/formatter/search_test.go b/cli/command/formatter/search_test.go index e5a2d1a91a..2e5bac0fc8 100644 --- a/cli/command/formatter/search_test.go +++ b/cli/command/formatter/search_test.go @@ -7,9 +7,9 @@ import ( "testing" registrytypes "github.com/docker/docker/api/types/registry" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestSearchContext(t *testing.T) { diff --git a/cli/command/formatter/secret_test.go b/cli/command/formatter/secret_test.go index e62793d3b1..31119786ff 100644 --- a/cli/command/formatter/secret_test.go +++ b/cli/command/formatter/secret_test.go @@ -6,8 +6,8 @@ import ( "time" "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 TestSecretContextFormatWrite(t *testing.T) { diff --git a/cli/command/formatter/service_test.go b/cli/command/formatter/service_test.go index 11c00c4b01..243899d1b9 100644 --- a/cli/command/formatter/service_test.go +++ b/cli/command/formatter/service_test.go @@ -8,9 +8,9 @@ import ( "testing" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestServiceContextWrite(t *testing.T) { diff --git a/cli/command/formatter/stack_test.go b/cli/command/formatter/stack_test.go index 27ca17e5a6..44a08406c3 100644 --- a/cli/command/formatter/stack_test.go +++ b/cli/command/formatter/stack_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 TestStackContextWrite(t *testing.T) { diff --git a/cli/command/formatter/stats_test.go b/cli/command/formatter/stats_test.go index 6c88fe8771..3325dd9fba 100644 --- a/cli/command/formatter/stats_test.go +++ b/cli/command/formatter/stats_test.go @@ -5,8 +5,8 @@ import ( "testing" "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" ) func TestContainerStatsContext(t *testing.T) { diff --git a/cli/command/formatter/task_test.go b/cli/command/formatter/task_test.go index 9dc8a18bb8..84bdbfeb97 100644 --- a/cli/command/formatter/task_test.go +++ b/cli/command/formatter/task_test.go @@ -7,9 +7,9 @@ import ( "testing" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestTaskContextWrite(t *testing.T) { diff --git a/cli/command/formatter/trust_test.go b/cli/command/formatter/trust_test.go index 4f97996a7c..7e1d894fbd 100644 --- a/cli/command/formatter/trust_test.go +++ b/cli/command/formatter/trust_test.go @@ -5,8 +5,8 @@ import ( "testing" "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" ) func TestTrustTag(t *testing.T) { diff --git a/cli/command/formatter/volume_test.go b/cli/command/formatter/volume_test.go index 425aaed12d..43c6061d6e 100644 --- a/cli/command/formatter/volume_test.go +++ b/cli/command/formatter/volume_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/api/types" "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" ) func TestVolumeContext(t *testing.T) { diff --git a/cli/command/idresolver/idresolver_test.go b/cli/command/idresolver/idresolver_test.go index c4ab3fecd4..f667b10641 100644 --- a/cli/command/idresolver/idresolver_test.go +++ b/cli/command/idresolver/idresolver_test.go @@ -4,8 +4,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" // Import builders to get the builder function as package function "context" diff --git a/cli/command/image/build/context_test.go b/cli/command/image/build/context_test.go index 493eda014c..d74add88b2 100644 --- a/cli/command/image/build/context_test.go +++ b/cli/command/image/build/context_test.go @@ -12,8 +12,8 @@ import ( "testing" "github.com/docker/docker/pkg/archive" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) const dockerfileContents = "FROM busybox" diff --git a/cli/command/image/build_test.go b/cli/command/image/build_test.go index fb8764c64d..adcacd49f8 100644 --- a/cli/command/image/build_test.go +++ b/cli/command/image/build_test.go @@ -17,9 +17,9 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/archive" "github.com/google/go-cmp/cmp" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/fs" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/fs" + "gotest.tools/skip" ) func TestRunBuildDockerfileFromStdinWithCompress(t *testing.T) { diff --git a/cli/command/image/history_test.go b/cli/command/image/history_test.go index b94e4ce8c9..ad2beb9a83 100644 --- a/cli/command/image/history_test.go +++ b/cli/command/image/history_test.go @@ -8,10 +8,10 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/image" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" - "github.com/gotestyourself/gotestyourself/skip" "github.com/pkg/errors" + "gotest.tools/assert" + "gotest.tools/golden" + "gotest.tools/skip" ) func TestNewHistoryCommandErrors(t *testing.T) { diff --git a/cli/command/image/import_test.go b/cli/command/image/import_test.go index 2eefe72479..9e2fad61fa 100644 --- a/cli/command/image/import_test.go +++ b/cli/command/image/import_test.go @@ -8,9 +8,9 @@ import ( "github.com/docker/cli/internal/test" "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 TestNewImportCommandErrors(t *testing.T) { diff --git a/cli/command/image/inspect_test.go b/cli/command/image/inspect_test.go index 4bf0547416..d881ae0aa3 100644 --- a/cli/command/image/inspect_test.go +++ b/cli/command/image/inspect_test.go @@ -7,9 +7,9 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestNewInspectCommandErrors(t *testing.T) { diff --git a/cli/command/image/list_test.go b/cli/command/image/list_test.go index f4ce847262..81394a797b 100644 --- a/cli/command/image/list_test.go +++ b/cli/command/image/list_test.go @@ -8,10 +8,10 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestNewImagesCommandErrors(t *testing.T) { diff --git a/cli/command/image/load_test.go b/cli/command/image/load_test.go index d3ec89e36c..5fe4344f6d 100644 --- a/cli/command/image/load_test.go +++ b/cli/command/image/load_test.go @@ -9,9 +9,9 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestNewLoadCommandErrors(t *testing.T) { diff --git a/cli/command/image/prune_test.go b/cli/command/image/prune_test.go index 9c03d83d72..ca46bbf6bb 100644 --- a/cli/command/image/prune_test.go +++ b/cli/command/image/prune_test.go @@ -8,10 +8,10 @@ import ( "github.com/docker/cli/internal/test" "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" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestNewPruneCommandErrors(t *testing.T) { diff --git a/cli/command/image/pull_test.go b/cli/command/image/pull_test.go index df639232fa..c5ae75608a 100644 --- a/cli/command/image/pull_test.go +++ b/cli/command/image/pull_test.go @@ -10,9 +10,9 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/notary" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestNewPullCommandErrors(t *testing.T) { diff --git a/cli/command/image/push_test.go b/cli/command/image/push_test.go index 10d5cb3a81..75798aaaf1 100644 --- a/cli/command/image/push_test.go +++ b/cli/command/image/push_test.go @@ -8,8 +8,8 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" ) func TestNewPushCommandErrors(t *testing.T) { diff --git a/cli/command/image/remove_test.go b/cli/command/image/remove_test.go index 2c0cc9b0ac..6db2e03187 100644 --- a/cli/command/image/remove_test.go +++ b/cli/command/image/remove_test.go @@ -7,10 +7,10 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) type notFound struct { diff --git a/cli/command/image/save_test.go b/cli/command/image/save_test.go index b87be3c8af..d051e8cb5c 100644 --- a/cli/command/image/save_test.go +++ b/cli/command/image/save_test.go @@ -8,9 +8,9 @@ import ( "testing" "github.com/docker/cli/internal/test" - "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 TestNewSaveCommandErrors(t *testing.T) { diff --git a/cli/command/image/tag_test.go b/cli/command/image/tag_test.go index 0319cb0522..9c43f3fe77 100644 --- a/cli/command/image/tag_test.go +++ b/cli/command/image/tag_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestCliNewTagCommandErrors(t *testing.T) { diff --git a/cli/command/image/trust_test.go b/cli/command/image/trust_test.go index 946caf444f..97585a7299 100644 --- a/cli/command/image/trust_test.go +++ b/cli/command/image/trust_test.go @@ -7,10 +7,10 @@ import ( "github.com/docker/cli/cli/trust" registrytypes "github.com/docker/docker/api/types/registry" - "github.com/gotestyourself/gotestyourself/assert" "github.com/theupdateframework/notary/client" "github.com/theupdateframework/notary/passphrase" "github.com/theupdateframework/notary/trustpinning" + "gotest.tools/assert" ) func unsetENV() { diff --git a/cli/command/inspect/inspector_test.go b/cli/command/inspect/inspector_test.go index 8eb818ee7d..f4df36848d 100644 --- a/cli/command/inspect/inspector_test.go +++ b/cli/command/inspect/inspector_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/docker/cli/templates" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) type testElement struct { diff --git a/cli/command/manifest/annotate_test.go b/cli/command/manifest/annotate_test.go index ab6f3bbf3a..e5cce8f629 100644 --- a/cli/command/manifest/annotate_test.go +++ b/cli/command/manifest/annotate_test.go @@ -5,9 +5,9 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestManifestAnnotateError(t *testing.T) { diff --git a/cli/command/manifest/create_test.go b/cli/command/manifest/create_test.go index 9082c56ed3..fbf0ae7b8f 100644 --- a/cli/command/manifest/create_test.go +++ b/cli/command/manifest/create_test.go @@ -8,10 +8,10 @@ import ( manifesttypes "github.com/docker/cli/cli/manifest/types" "github.com/docker/cli/internal/test" "github.com/docker/distribution/reference" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestManifestCreateErrors(t *testing.T) { diff --git a/cli/command/manifest/inspect_test.go b/cli/command/manifest/inspect_test.go index 06192fb38d..4c43796808 100644 --- a/cli/command/manifest/inspect_test.go +++ b/cli/command/manifest/inspect_test.go @@ -13,11 +13,11 @@ import ( "github.com/docker/distribution" "github.com/docker/distribution/manifest/schema2" "github.com/docker/distribution/reference" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func newTempManifestStore(t *testing.T) (store.Store, func()) { diff --git a/cli/command/manifest/push_test.go b/cli/command/manifest/push_test.go index a09069606b..3a2e9b8a99 100644 --- a/cli/command/manifest/push_test.go +++ b/cli/command/manifest/push_test.go @@ -8,8 +8,8 @@ import ( manifesttypes "github.com/docker/cli/cli/manifest/types" "github.com/docker/cli/internal/test" "github.com/docker/distribution/reference" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" ) func newFakeRegistryClient() *fakeRegistryClient { diff --git a/cli/command/network/connect_test.go b/cli/command/network/connect_test.go index 59e35ab1ae..2c1d040147 100644 --- a/cli/command/network/connect_test.go +++ b/cli/command/network/connect_test.go @@ -7,9 +7,9 @@ import ( "github.com/docker/cli/internal/test" "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 TestNetworkConnectErrors(t *testing.T) { diff --git a/cli/command/network/create_test.go b/cli/command/network/create_test.go index 3a0fa0fba9..6bfa7b65bc 100644 --- a/cli/command/network/create_test.go +++ b/cli/command/network/create_test.go @@ -9,9 +9,9 @@ import ( "github.com/docker/cli/internal/test" "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 TestNetworkCreateErrors(t *testing.T) { diff --git a/cli/command/network/disconnect_test.go b/cli/command/network/disconnect_test.go index 5f15e61877..9a55257051 100644 --- a/cli/command/network/disconnect_test.go +++ b/cli/command/network/disconnect_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" ) func TestNetworkDisconnectErrors(t *testing.T) { diff --git a/cli/command/network/list_test.go b/cli/command/network/list_test.go index cdffcc6459..1106315f7e 100644 --- a/cli/command/network/list_test.go +++ b/cli/command/network/list_test.go @@ -11,10 +11,10 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/google/go-cmp/cmp" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestNetworkListErrors(t *testing.T) { diff --git a/cli/command/node/demote_test.go b/cli/command/node/demote_test.go index 5bbc7dae36..3f18d63d41 100644 --- a/cli/command/node/demote_test.go +++ b/cli/command/node/demote_test.go @@ -6,8 +6,8 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" ) diff --git a/cli/command/node/inspect_test.go b/cli/command/node/inspect_test.go index 73f0a9e872..de343b0f49 100644 --- a/cli/command/node/inspect_test.go +++ b/cli/command/node/inspect_test.go @@ -11,8 +11,8 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestNodeInspectErrors(t *testing.T) { diff --git a/cli/command/node/list_test.go b/cli/command/node/list_test.go index 2d56af8377..5dc11c961a 100644 --- a/cli/command/node/list_test.go +++ b/cli/command/node/list_test.go @@ -8,10 +8,10 @@ import ( "github.com/docker/cli/internal/test" "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" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" ) diff --git a/cli/command/node/promote_test.go b/cli/command/node/promote_test.go index 5d5c105dfe..c6b5342320 100644 --- a/cli/command/node/promote_test.go +++ b/cli/command/node/promote_test.go @@ -6,8 +6,8 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" ) diff --git a/cli/command/node/ps_test.go b/cli/command/node/ps_test.go index 2a8533fb08..ae5ed6169f 100644 --- a/cli/command/node/ps_test.go +++ b/cli/command/node/ps_test.go @@ -12,8 +12,8 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestNodePsErrors(t *testing.T) { diff --git a/cli/command/node/remove_test.go b/cli/command/node/remove_test.go index 17ebb46f75..8ae01c7b2f 100644 --- a/cli/command/node/remove_test.go +++ b/cli/command/node/remove_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" ) func TestNodeRemoveErrors(t *testing.T) { diff --git a/cli/command/node/update_test.go b/cli/command/node/update_test.go index 6d3f6f0bd4..8b6ae807da 100644 --- a/cli/command/node/update_test.go +++ b/cli/command/node/update_test.go @@ -6,8 +6,8 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" ) diff --git a/cli/command/plugin/create_test.go b/cli/command/plugin/create_test.go index 41191cab35..bef002c07a 100644 --- a/cli/command/plugin/create_test.go +++ b/cli/command/plugin/create_test.go @@ -9,9 +9,9 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" - "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 TestCreateErrors(t *testing.T) { diff --git a/cli/command/plugin/disable_test.go b/cli/command/plugin/disable_test.go index 592e0e4951..c9292965f7 100644 --- a/cli/command/plugin/disable_test.go +++ b/cli/command/plugin/disable_test.go @@ -7,8 +7,8 @@ import ( "github.com/docker/cli/internal/test" "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 TestPluginDisableErrors(t *testing.T) { diff --git a/cli/command/plugin/enable_test.go b/cli/command/plugin/enable_test.go index 42ce53576a..933ff5de1c 100644 --- a/cli/command/plugin/enable_test.go +++ b/cli/command/plugin/enable_test.go @@ -7,8 +7,8 @@ import ( "github.com/docker/cli/internal/test" "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 TestPluginEnableErrors(t *testing.T) { diff --git a/cli/command/plugin/remove_test.go b/cli/command/plugin/remove_test.go index 813c7615f6..4cfec43341 100644 --- a/cli/command/plugin/remove_test.go +++ b/cli/command/plugin/remove_test.go @@ -7,8 +7,8 @@ import ( "github.com/docker/cli/internal/test" "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 TestRemoveErrors(t *testing.T) { diff --git a/cli/command/registry/login_test.go b/cli/command/registry/login_test.go index 9eb3f682c1..7e77494186 100644 --- a/cli/command/registry/login_test.go +++ b/cli/command/registry/login_test.go @@ -10,9 +10,9 @@ import ( "github.com/docker/docker/api/types" registrytypes "github.com/docker/docker/api/types/registry" "github.com/docker/docker/client" - "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" ) const userErr = "userunknownError" diff --git a/cli/command/registry_test.go b/cli/command/registry_test.go index f6be9b316b..8c9f5835f6 100644 --- a/cli/command/registry_test.go +++ b/cli/command/registry_test.go @@ -6,9 +6,9 @@ import ( "fmt" "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" // Prevents a circular import with "github.com/docker/cli/internal/test" diff --git a/cli/command/secret/create_test.go b/cli/command/secret/create_test.go index 7a9492ca0f..eb9c089861 100644 --- a/cli/command/secret/create_test.go +++ b/cli/command/secret/create_test.go @@ -10,9 +10,9 @@ import ( "github.com/docker/cli/internal/test" "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" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) const secretDataFile = "secret-create-with-name.golden" diff --git a/cli/command/secret/inspect_test.go b/cli/command/secret/inspect_test.go index b23d78beb9..67addaeadf 100644 --- a/cli/command/secret/inspect_test.go +++ b/cli/command/secret/inspect_test.go @@ -11,8 +11,8 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestSecretInspectErrors(t *testing.T) { diff --git a/cli/command/secret/ls_test.go b/cli/command/secret/ls_test.go index 371218926c..e1417115ce 100644 --- a/cli/command/secret/ls_test.go +++ b/cli/command/secret/ls_test.go @@ -12,9 +12,9 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestSecretListErrors(t *testing.T) { diff --git a/cli/command/secret/remove_test.go b/cli/command/secret/remove_test.go index 349f47b387..d2fc8ad093 100644 --- a/cli/command/secret/remove_test.go +++ b/cli/command/secret/remove_test.go @@ -6,9 +6,9 @@ import ( "testing" "github.com/docker/cli/internal/test" - "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 TestSecretRemoveErrors(t *testing.T) { diff --git a/cli/command/service/generic_resource_opts_test.go b/cli/command/service/generic_resource_opts_test.go index ffc7f4ca64..c750f1dc88 100644 --- a/cli/command/service/generic_resource_opts_test.go +++ b/cli/command/service/generic_resource_opts_test.go @@ -3,8 +3,8 @@ package service import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestValidateSingleGenericResource(t *testing.T) { diff --git a/cli/command/service/inspect_test.go b/cli/command/service/inspect_test.go index 41736f8894..c27a9a8850 100644 --- a/cli/command/service/inspect_test.go +++ b/cli/command/service/inspect_test.go @@ -10,8 +10,8 @@ import ( "github.com/docker/cli/cli/command/formatter" "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 formatServiceInspect(t *testing.T, format formatter.Format, now time.Time) string { diff --git a/cli/command/service/list_test.go b/cli/command/service/list_test.go index c84dd587fd..e52e7e03c2 100644 --- a/cli/command/service/list_test.go +++ b/cli/command/service/list_test.go @@ -7,8 +7,8 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestServiceListOrder(t *testing.T) { diff --git a/cli/command/service/opts_test.go b/cli/command/service/opts_test.go index 0cacffec93..344893f552 100644 --- a/cli/command/service/opts_test.go +++ b/cli/command/service/opts_test.go @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "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 TestMemBytesString(t *testing.T) { diff --git a/cli/command/service/progress/progress_test.go b/cli/command/service/progress/progress_test.go index 198d29acf6..2a386d64f5 100644 --- a/cli/command/service/progress/progress_test.go +++ b/cli/command/service/progress/progress_test.go @@ -7,8 +7,8 @@ import ( "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/pkg/progress" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) type mockProgress struct { diff --git a/cli/command/service/ps_test.go b/cli/command/service/ps_test.go index 80ee61e9f7..6459cfcc3b 100644 --- a/cli/command/service/ps_test.go +++ b/cli/command/service/ps_test.go @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" "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 TestCreateFilter(t *testing.T) { diff --git a/cli/command/service/rollback_test.go b/cli/command/service/rollback_test.go index 70795af945..e61d1c20bb 100644 --- a/cli/command/service/rollback_test.go +++ b/cli/command/service/rollback_test.go @@ -10,8 +10,8 @@ import ( "github.com/docker/cli/internal/test" "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 TestRollback(t *testing.T) { diff --git a/cli/command/service/update_test.go b/cli/command/service/update_test.go index 94ccb4963f..fa761ba08f 100644 --- a/cli/command/service/update_test.go +++ b/cli/command/service/update_test.go @@ -12,8 +12,8 @@ import ( "github.com/docker/docker/api/types/container" mounttypes "github.com/docker/docker/api/types/mount" "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 TestUpdateServiceArgs(t *testing.T) { diff --git a/cli/command/stack/kubernetes/conversion_test.go b/cli/command/stack/kubernetes/conversion_test.go index 866557b3a7..213e9ea60e 100644 --- a/cli/command/stack/kubernetes/conversion_test.go +++ b/cli/command/stack/kubernetes/conversion_test.go @@ -6,7 +6,7 @@ import ( "github.com/docker/cli/cli/command/formatter" "github.com/docker/cli/kubernetes/labels" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" appsv1beta2 "k8s.io/api/apps/v1beta2" apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/cli/command/stack/kubernetes/services_test.go b/cli/command/stack/kubernetes/services_test.go index 89cb9b7e4e..5603eeda15 100644 --- a/cli/command/stack/kubernetes/services_test.go +++ b/cli/command/stack/kubernetes/services_test.go @@ -5,8 +5,8 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + "gotest.tools/assert/cmp" ) func TestServiceFiltersLabelSelectorGen(t *testing.T) { diff --git a/cli/command/stack/kubernetes/stackclient_test.go b/cli/command/stack/kubernetes/stackclient_test.go index b82e6b13ef..8757f1c466 100644 --- a/cli/command/stack/kubernetes/stackclient_test.go +++ b/cli/command/stack/kubernetes/stackclient_test.go @@ -5,7 +5,7 @@ import ( "testing" composetypes "github.com/docker/cli/cli/compose/types" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestFromCompose(t *testing.T) { diff --git a/cli/command/stack/kubernetes/warnings_test.go b/cli/command/stack/kubernetes/warnings_test.go index b1d911e094..bdb7bf9de7 100644 --- a/cli/command/stack/kubernetes/warnings_test.go +++ b/cli/command/stack/kubernetes/warnings_test.go @@ -6,7 +6,7 @@ import ( "time" composetypes "github.com/docker/cli/cli/compose/types" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/golden" ) func TestWarnings(t *testing.T) { diff --git a/cli/command/stack/kubernetes/watcher_test.go b/cli/command/stack/kubernetes/watcher_test.go index 80c7b5fd8d..84e51ea3b3 100644 --- a/cli/command/stack/kubernetes/watcher_test.go +++ b/cli/command/stack/kubernetes/watcher_test.go @@ -5,7 +5,7 @@ import ( apiv1beta1 "github.com/docker/cli/kubernetes/compose/v1beta1" composelabels "github.com/docker/cli/kubernetes/labels" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" diff --git a/cli/command/stack/list_test.go b/cli/command/stack/list_test.go index c3d827ccda..2e7ad4df12 100644 --- a/cli/command/stack/list_test.go +++ b/cli/command/stack/list_test.go @@ -9,9 +9,9 @@ import ( . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestListErrors(t *testing.T) { diff --git a/cli/command/stack/loader/loader_test.go b/cli/command/stack/loader/loader_test.go index c027371dda..de524cc527 100644 --- a/cli/command/stack/loader/loader_test.go +++ b/cli/command/stack/loader/loader_test.go @@ -6,9 +6,9 @@ import ( "strings" "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" ) func TestGetConfigDetails(t *testing.T) { diff --git a/cli/command/stack/ps_test.go b/cli/command/stack/ps_test.go index b3cce8d58a..da769d8659 100644 --- a/cli/command/stack/ps_test.go +++ b/cli/command/stack/ps_test.go @@ -11,10 +11,10 @@ import ( . "github.com/docker/cli/internal/test/builders" "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" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestStackPsErrors(t *testing.T) { diff --git a/cli/command/stack/remove_test.go b/cli/command/stack/remove_test.go index 5f27a9b32a..196ebdc67a 100644 --- a/cli/command/stack/remove_test.go +++ b/cli/command/stack/remove_test.go @@ -7,8 +7,8 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func fakeClientForRemoveStackTest(version string) *fakeClient { diff --git a/cli/command/stack/services_test.go b/cli/command/stack/services_test.go index 195d65c346..2acb91ca73 100644 --- a/cli/command/stack/services_test.go +++ b/cli/command/stack/services_test.go @@ -10,10 +10,10 @@ import ( . "github.com/docker/cli/internal/test/builders" "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" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) func TestStackServicesErrors(t *testing.T) { diff --git a/cli/command/stack/swarm/deploy_bundlefile_test.go b/cli/command/stack/swarm/deploy_bundlefile_test.go index 4e66caabed..485271cbc9 100644 --- a/cli/command/stack/swarm/deploy_bundlefile_test.go +++ b/cli/command/stack/swarm/deploy_bundlefile_test.go @@ -5,8 +5,8 @@ import ( "path/filepath" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestLoadBundlefileErrors(t *testing.T) { diff --git a/cli/command/stack/swarm/deploy_composefile_test.go b/cli/command/stack/swarm/deploy_composefile_test.go index a3278b8479..065a4f2938 100644 --- a/cli/command/stack/swarm/deploy_composefile_test.go +++ b/cli/command/stack/swarm/deploy_composefile_test.go @@ -6,8 +6,8 @@ import ( "github.com/docker/cli/internal/test/network" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" ) type notFound struct { diff --git a/cli/command/stack/swarm/deploy_test.go b/cli/command/stack/swarm/deploy_test.go index 690ab48444..64aafec382 100644 --- a/cli/command/stack/swarm/deploy_test.go +++ b/cli/command/stack/swarm/deploy_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/cli/internal/test" "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 TestPruneServices(t *testing.T) { diff --git a/cli/command/stack/swarm/ps_test.go b/cli/command/stack/swarm/ps_test.go index 1989f140bd..33401da655 100644 --- a/cli/command/stack/swarm/ps_test.go +++ b/cli/command/stack/swarm/ps_test.go @@ -5,8 +5,8 @@ import ( "github.com/docker/cli/cli/command/stack/options" "github.com/docker/cli/internal/test" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestRunPSWithEmptyName(t *testing.T) { diff --git a/cli/command/stack/swarm/remove_test.go b/cli/command/stack/swarm/remove_test.go index bfc43e742e..3d30b288ac 100644 --- a/cli/command/stack/swarm/remove_test.go +++ b/cli/command/stack/swarm/remove_test.go @@ -5,8 +5,8 @@ import ( "github.com/docker/cli/cli/command/stack/options" "github.com/docker/cli/internal/test" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestRunRemoveWithEmptyName(t *testing.T) { diff --git a/cli/command/stack/swarm/services_test.go b/cli/command/stack/swarm/services_test.go index dbd56222d5..9e3ca47f3a 100644 --- a/cli/command/stack/swarm/services_test.go +++ b/cli/command/stack/swarm/services_test.go @@ -5,8 +5,8 @@ import ( "github.com/docker/cli/cli/command/stack/options" "github.com/docker/cli/internal/test" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestRunServicesWithEmptyName(t *testing.T) { diff --git a/cli/command/swarm/ca_test.go b/cli/command/swarm/ca_test.go index d11739ec37..499090477e 100644 --- a/cli/command/swarm/ca_test.go +++ b/cli/command/swarm/ca_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/cli/internal/test" "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 swarmSpecWithFullCAConfig() *swarm.Spec { diff --git a/cli/command/swarm/init_test.go b/cli/command/swarm/init_test.go index 22712726ca..735cc8da4d 100644 --- a/cli/command/swarm/init_test.go +++ b/cli/command/swarm/init_test.go @@ -8,9 +8,9 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestSwarmInitErrorOnAPIFailure(t *testing.T) { diff --git a/cli/command/swarm/join_test.go b/cli/command/swarm/join_test.go index 7817df1440..e70d448db0 100644 --- a/cli/command/swarm/join_test.go +++ b/cli/command/swarm/join_test.go @@ -8,9 +8,9 @@ import ( "github.com/docker/cli/internal/test" "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" "github.com/pkg/errors" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestSwarmJoinErrors(t *testing.T) { diff --git a/cli/command/swarm/join_token_test.go b/cli/command/swarm/join_token_test.go index ca042671b2..1bd7ba2508 100644 --- a/cli/command/swarm/join_token_test.go +++ b/cli/command/swarm/join_token_test.go @@ -11,8 +11,8 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestSwarmJoinTokenErrors(t *testing.T) { diff --git a/cli/command/swarm/leave_test.go b/cli/command/swarm/leave_test.go index 07eac2c4da..91ee6e248e 100644 --- a/cli/command/swarm/leave_test.go +++ b/cli/command/swarm/leave_test.go @@ -6,9 +6,9 @@ import ( "testing" "github.com/docker/cli/internal/test" - "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 TestSwarmLeaveErrors(t *testing.T) { diff --git a/cli/command/swarm/opts_test.go b/cli/command/swarm/opts_test.go index 6aa12b89c4..6382d2a02a 100644 --- a/cli/command/swarm/opts_test.go +++ b/cli/command/swarm/opts_test.go @@ -3,8 +3,8 @@ package swarm import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestNodeAddrOptionSetHostAndPort(t *testing.T) { diff --git a/cli/command/swarm/unlock_key_test.go b/cli/command/swarm/unlock_key_test.go index aaade6fe9c..d28921a141 100644 --- a/cli/command/swarm/unlock_key_test.go +++ b/cli/command/swarm/unlock_key_test.go @@ -11,8 +11,8 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestSwarmUnlockKeyErrors(t *testing.T) { diff --git a/cli/command/swarm/unlock_test.go b/cli/command/swarm/unlock_test.go index eb481d13ca..8eb2ecd4f0 100644 --- a/cli/command/swarm/unlock_test.go +++ b/cli/command/swarm/unlock_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" ) func TestSwarmUnlockErrors(t *testing.T) { diff --git a/cli/command/swarm/update_test.go b/cli/command/swarm/update_test.go index 60e44ddfe0..256c9de6d0 100644 --- a/cli/command/swarm/update_test.go +++ b/cli/command/swarm/update_test.go @@ -12,8 +12,8 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestSwarmUpdateErrors(t *testing.T) { diff --git a/cli/command/system/info_test.go b/cli/command/system/info_test.go index 7e2dd6bff8..600e79ac3e 100644 --- a/cli/command/system/info_test.go +++ b/cli/command/system/info_test.go @@ -10,9 +10,9 @@ import ( "github.com/docker/docker/api/types" "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/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) // helper function that base64 decodes a string and ignores the error diff --git a/cli/command/system/prune_test.go b/cli/command/system/prune_test.go index b763c480ab..c0b5cafd3d 100644 --- a/cli/command/system/prune_test.go +++ b/cli/command/system/prune_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestPrunePromptPre131DoesNotIncludeBuildCache(t *testing.T) { diff --git a/cli/command/system/version_test.go b/cli/command/system/version_test.go index 81fc5b91af..fdf870d0f5 100644 --- a/cli/command/system/version_test.go +++ b/cli/command/system/version_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" "github.com/docker/cli/internal/test" "github.com/docker/docker/api" diff --git a/cli/command/task/print_test.go b/cli/command/task/print_test.go index aa1cfed370..6fa6e58653 100644 --- a/cli/command/task/print_test.go +++ b/cli/command/task/print_test.go @@ -12,8 +12,8 @@ import ( . "github.com/docker/cli/internal/test/builders" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestTaskPrintWithQuietOption(t *testing.T) { diff --git a/cli/command/trust/helpers_test.go b/cli/command/trust/helpers_test.go index 216ae5ce9d..fab61214c4 100644 --- a/cli/command/trust/helpers_test.go +++ b/cli/command/trust/helpers_test.go @@ -5,10 +5,10 @@ import ( "os" "testing" - "github.com/gotestyourself/gotestyourself/assert" "github.com/theupdateframework/notary/client" "github.com/theupdateframework/notary/passphrase" "github.com/theupdateframework/notary/trustpinning" + "gotest.tools/assert" ) func TestGetOrGenerateNotaryKeyAndInitRepo(t *testing.T) { diff --git a/cli/command/trust/inspect_pretty_test.go b/cli/command/trust/inspect_pretty_test.go index 5db01666b7..8c5141b331 100644 --- a/cli/command/trust/inspect_pretty_test.go +++ b/cli/command/trust/inspect_pretty_test.go @@ -9,12 +9,12 @@ import ( "github.com/docker/cli/internal/test" notaryfake "github.com/docker/cli/internal/test/notary" dockerClient "github.com/docker/docker/client" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" "github.com/theupdateframework/notary" "github.com/theupdateframework/notary/client" "github.com/theupdateframework/notary/tuf/data" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" ) // TODO(n4ss): remove common tests with the regular inspect command diff --git a/cli/command/trust/inspect_test.go b/cli/command/trust/inspect_test.go index 6e0e402bbd..3cf6e0ebcb 100644 --- a/cli/command/trust/inspect_test.go +++ b/cli/command/trust/inspect_test.go @@ -6,8 +6,8 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/notary" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestTrustInspectCommandErrors(t *testing.T) { diff --git a/cli/command/trust/key_generate_test.go b/cli/command/trust/key_generate_test.go index 6e26f98d1f..b4c798d87d 100644 --- a/cli/command/trust/key_generate_test.go +++ b/cli/command/trust/key_generate_test.go @@ -10,12 +10,12 @@ import ( "github.com/docker/cli/cli/config" "github.com/docker/cli/internal/test" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/theupdateframework/notary" "github.com/theupdateframework/notary/passphrase" "github.com/theupdateframework/notary/trustmanager" tufutils "github.com/theupdateframework/notary/tuf/utils" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestTrustKeyGenerateErrors(t *testing.T) { diff --git a/cli/command/trust/key_load_test.go b/cli/command/trust/key_load_test.go index c4da320a59..e0e35aab9b 100644 --- a/cli/command/trust/key_load_test.go +++ b/cli/command/trust/key_load_test.go @@ -11,14 +11,14 @@ import ( "github.com/docker/cli/cli/config" "github.com/docker/cli/internal/test" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" "github.com/theupdateframework/notary" "github.com/theupdateframework/notary/passphrase" "github.com/theupdateframework/notary/storage" "github.com/theupdateframework/notary/trustmanager" tufutils "github.com/theupdateframework/notary/tuf/utils" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) func TestTrustKeyLoadErrors(t *testing.T) { diff --git a/cli/command/trust/revoke_test.go b/cli/command/trust/revoke_test.go index 289fd3f173..b0a43876ce 100644 --- a/cli/command/trust/revoke_test.go +++ b/cli/command/trust/revoke_test.go @@ -7,11 +7,11 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/notary" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/theupdateframework/notary/client" "github.com/theupdateframework/notary/passphrase" "github.com/theupdateframework/notary/trustpinning" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestTrustRevokeCommandErrors(t *testing.T) { diff --git a/cli/command/trust/sign_test.go b/cli/command/trust/sign_test.go index e441f7bef2..5a7b6b5f37 100644 --- a/cli/command/trust/sign_test.go +++ b/cli/command/trust/sign_test.go @@ -12,15 +12,15 @@ import ( "github.com/docker/cli/cli/trust" "github.com/docker/cli/internal/test" notaryfake "github.com/docker/cli/internal/test/notary" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/skip" "github.com/theupdateframework/notary" "github.com/theupdateframework/notary/client" "github.com/theupdateframework/notary/client/changelist" "github.com/theupdateframework/notary/passphrase" "github.com/theupdateframework/notary/trustpinning" "github.com/theupdateframework/notary/tuf/data" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/skip" ) const passwd = "password" diff --git a/cli/command/trust/signer_add_test.go b/cli/command/trust/signer_add_test.go index 643a31b75a..64121e2958 100644 --- a/cli/command/trust/signer_add_test.go +++ b/cli/command/trust/signer_add_test.go @@ -11,9 +11,9 @@ import ( "github.com/docker/cli/cli/config" "github.com/docker/cli/internal/test" notaryfake "github.com/docker/cli/internal/test/notary" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/theupdateframework/notary" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestTrustSignerAddErrors(t *testing.T) { diff --git a/cli/command/trust/signer_remove_test.go b/cli/command/trust/signer_remove_test.go index 4f11634be2..f86bd84018 100644 --- a/cli/command/trust/signer_remove_test.go +++ b/cli/command/trust/signer_remove_test.go @@ -6,10 +6,10 @@ import ( "github.com/docker/cli/internal/test" notaryfake "github.com/docker/cli/internal/test/notary" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/theupdateframework/notary/client" "github.com/theupdateframework/notary/tuf/data" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestTrustSignerRemoveErrors(t *testing.T) { diff --git a/cli/command/volume/create_test.go b/cli/command/volume/create_test.go index 40462a8c67..a0646ed113 100644 --- a/cli/command/volume/create_test.go +++ b/cli/command/volume/create_test.go @@ -9,9 +9,9 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" volumetypes "github.com/docker/docker/api/types/volume" - "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 TestVolumeCreateErrors(t *testing.T) { diff --git a/cli/command/volume/inspect_test.go b/cli/command/volume/inspect_test.go index c827b7281c..759042a512 100644 --- a/cli/command/volume/inspect_test.go +++ b/cli/command/volume/inspect_test.go @@ -10,8 +10,8 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestVolumeInspectErrors(t *testing.T) { diff --git a/cli/command/volume/list_test.go b/cli/command/volume/list_test.go index ac140e3585..62d7d95664 100644 --- a/cli/command/volume/list_test.go +++ b/cli/command/volume/list_test.go @@ -12,8 +12,8 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" + "gotest.tools/assert" + "gotest.tools/golden" ) func TestVolumeListErrors(t *testing.T) { diff --git a/cli/command/volume/prune_test.go b/cli/command/volume/prune_test.go index 0d75d3b75d..79d4d52e32 100644 --- a/cli/command/volume/prune_test.go +++ b/cli/command/volume/prune_test.go @@ -11,10 +11,10 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" - "github.com/gotestyourself/gotestyourself/skip" "github.com/pkg/errors" + "gotest.tools/assert" + "gotest.tools/golden" + "gotest.tools/skip" ) func TestVolumePruneErrors(t *testing.T) { @@ -79,7 +79,7 @@ func TestVolumePruneForce(t *testing.T) { func TestVolumePrunePromptYes(t *testing.T) { // FIXME(vdemeester) make it work.. - skip.IfCondition(t, runtime.GOOS == "windows", "TODO: fix test on windows") + skip.If(t, runtime.GOOS == "windows", "TODO: fix test on windows") for _, input := range []string{"y", "Y"} { cli := test.NewFakeCli(&fakeClient{ @@ -95,7 +95,7 @@ func TestVolumePrunePromptYes(t *testing.T) { func TestVolumePrunePromptNo(t *testing.T) { // FIXME(vdemeester) make it work.. - skip.IfCondition(t, runtime.GOOS == "windows", "TODO: fix test on windows") + skip.If(t, runtime.GOOS == "windows", "TODO: fix test on windows") for _, input := range []string{"n", "N", "no", "anything", "really"} { cli := test.NewFakeCli(&fakeClient{ diff --git a/cli/command/volume/remove_test.go b/cli/command/volume/remove_test.go index f773a3648e..789d906a87 100644 --- a/cli/command/volume/remove_test.go +++ b/cli/command/volume/remove_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" + "gotest.tools/assert" ) func TestVolumeRemoveErrors(t *testing.T) { diff --git a/cli/compose/convert/compose_test.go b/cli/compose/convert/compose_test.go index 1846df17ee..98b2dc1cc5 100644 --- a/cli/compose/convert/compose_test.go +++ b/cli/compose/convert/compose_test.go @@ -6,9 +6,9 @@ import ( composetypes "github.com/docker/cli/cli/compose/types" "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/gotestyourself/gotestyourself/fs" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" ) func TestNamespaceScope(t *testing.T) { diff --git a/cli/compose/convert/service_test.go b/cli/compose/convert/service_test.go index 3d9e471409..7e5fa4e18a 100644 --- a/cli/compose/convert/service_test.go +++ b/cli/compose/convert/service_test.go @@ -13,9 +13,9 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" - "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 TestConvertRestartPolicyFromNone(t *testing.T) { diff --git a/cli/compose/convert/volume_test.go b/cli/compose/convert/volume_test.go index d7d45eedf5..d29c3b6de2 100644 --- a/cli/compose/convert/volume_test.go +++ b/cli/compose/convert/volume_test.go @@ -5,8 +5,8 @@ import ( composetypes "github.com/docker/cli/cli/compose/types" "github.com/docker/docker/api/types/mount" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestConvertVolumeToMountAnonymousVolume(t *testing.T) { diff --git a/cli/compose/interpolation/interpolation_test.go b/cli/compose/interpolation/interpolation_test.go index 42ea55ff1f..3e76642a91 100644 --- a/cli/compose/interpolation/interpolation_test.go +++ b/cli/compose/interpolation/interpolation_test.go @@ -5,9 +5,9 @@ import ( "strconv" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/env" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/env" ) var defaults = map[string]string{ diff --git a/cli/compose/loader/loader_test.go b/cli/compose/loader/loader_test.go index 64b7406e60..a00a972eb8 100644 --- a/cli/compose/loader/loader_test.go +++ b/cli/compose/loader/loader_test.go @@ -11,9 +11,9 @@ import ( "github.com/docker/cli/cli/compose/types" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/sirupsen/logrus" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func buildConfigDetails(source map[string]interface{}, env map[string]string) types.ConfigDetails { diff --git a/cli/compose/loader/merge_test.go b/cli/compose/loader/merge_test.go index df74ad17f2..178d302da2 100644 --- a/cli/compose/loader/merge_test.go +++ b/cli/compose/loader/merge_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/docker/cli/cli/compose/types" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) func TestLoadTwoDifferentVersion(t *testing.T) { diff --git a/cli/compose/loader/types_test.go b/cli/compose/loader/types_test.go index 88f6778092..0d604d8cea 100644 --- a/cli/compose/loader/types_test.go +++ b/cli/compose/loader/types_test.go @@ -3,9 +3,9 @@ package loader import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" yaml "gopkg.in/yaml.v2" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestMarshallConfig(t *testing.T) { diff --git a/cli/compose/loader/volume_test.go b/cli/compose/loader/volume_test.go index 5e96b0aeff..ebe5f6b596 100644 --- a/cli/compose/loader/volume_test.go +++ b/cli/compose/loader/volume_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/docker/cli/cli/compose/types" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestParseVolumeAnonymousVolume(t *testing.T) { diff --git a/cli/compose/schema/schema_test.go b/cli/compose/schema/schema_test.go index 17ffb203f6..6fa027e495 100644 --- a/cli/compose/schema/schema_test.go +++ b/cli/compose/schema/schema_test.go @@ -3,7 +3,7 @@ package schema import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" + "gotest.tools/assert" ) type dict map[string]interface{} diff --git a/cli/compose/template/template_test.go b/cli/compose/template/template_test.go index 5e4ff9b3ed..48d76bb9fc 100644 --- a/cli/compose/template/template_test.go +++ b/cli/compose/template/template_test.go @@ -4,8 +4,8 @@ import ( "reflect" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) var defaults = map[string]string{ diff --git a/cli/config/config_test.go b/cli/config/config_test.go index 74c441a4b4..11c8dd6de5 100644 --- a/cli/config/config_test.go +++ b/cli/config/config_test.go @@ -12,9 +12,9 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/cli/config/credentials" "github.com/docker/docker/pkg/homedir" - "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 setupConfigDir(t *testing.T) (string, func()) { diff --git a/cli/config/configfile/file_test.go b/cli/config/configfile/file_test.go index 34e3b485b0..f0704cef3f 100644 --- a/cli/config/configfile/file_test.go +++ b/cli/config/configfile/file_test.go @@ -6,8 +6,8 @@ import ( "github.com/docker/cli/cli/config/credentials" "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 TestEncodeAuth(t *testing.T) { diff --git a/cli/config/credentials/file_store_test.go b/cli/config/credentials/file_store_test.go index 984dc1fa69..eb27d3774f 100644 --- a/cli/config/credentials/file_store_test.go +++ b/cli/config/credentials/file_store_test.go @@ -4,8 +4,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" ) type fakeStore struct { diff --git a/cli/config/credentials/native_store_test.go b/cli/config/credentials/native_store_test.go index 57a506f62c..88befab5ee 100644 --- a/cli/config/credentials/native_store_test.go +++ b/cli/config/credentials/native_store_test.go @@ -11,9 +11,9 @@ import ( "github.com/docker/docker-credential-helpers/client" "github.com/docker/docker-credential-helpers/credentials" "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" ) const ( diff --git a/cli/flags/common_test.go b/cli/flags/common_test.go index 2f06e11e44..7150691ecc 100644 --- a/cli/flags/common_test.go +++ b/cli/flags/common_test.go @@ -5,9 +5,9 @@ import ( "testing" cliconfig "github.com/docker/cli/cli/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/cli/manifest/store/store_test.go b/cli/manifest/store/store_test.go index 669b81e7c5..ae56fea924 100644 --- a/cli/manifest/store/store_test.go +++ b/cli/manifest/store/store_test.go @@ -8,8 +8,8 @@ import ( "github.com/docker/cli/cli/manifest/types" "github.com/docker/distribution/reference" "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" ) type fakeRef struct { diff --git a/cli/required_test.go b/cli/required_test.go index c82e3b965f..df3e9a467a 100644 --- a/cli/required_test.go +++ b/cli/required_test.go @@ -5,8 +5,8 @@ import ( "io/ioutil" "testing" - "github.com/gotestyourself/gotestyourself/assert" "github.com/spf13/cobra" + "gotest.tools/assert" ) func TestRequiresNoArgs(t *testing.T) { diff --git a/cli/trust/trust_test.go b/cli/trust/trust_test.go index 67e181ba20..b49b7ca878 100644 --- a/cli/trust/trust_test.go +++ b/cli/trust/trust_test.go @@ -6,12 +6,12 @@ import ( "testing" "github.com/docker/distribution/reference" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" digest "github.com/opencontainers/go-digest" "github.com/theupdateframework/notary/client" "github.com/theupdateframework/notary/passphrase" "github.com/theupdateframework/notary/trustpinning" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestGetTag(t *testing.T) { diff --git a/cmd/docker/docker_test.go b/cmd/docker/docker_test.go index 1bf30bf7cb..92a9466853 100644 --- a/cmd/docker/docker_test.go +++ b/cmd/docker/docker_test.go @@ -7,9 +7,9 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/debug" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/sirupsen/logrus" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestClientDebugEnabled(t *testing.T) { diff --git a/e2e/container/attach_test.go b/e2e/container/attach_test.go index 393d8cc81e..3be6c2ae14 100644 --- a/e2e/container/attach_test.go +++ b/e2e/container/attach_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/docker/cli/e2e/internal/fixtures" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) func TestAttachExitCode(t *testing.T) { diff --git a/e2e/container/create_test.go b/e2e/container/create_test.go index 23e6883b51..9733808604 100644 --- a/e2e/container/create_test.go +++ b/e2e/container/create_test.go @@ -6,8 +6,8 @@ import ( "github.com/docker/cli/e2e/internal/fixtures" "github.com/docker/cli/internal/test/environment" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/icmd" + "gotest.tools/skip" ) func TestCreateWithContentTrust(t *testing.T) { diff --git a/e2e/container/kill_test.go b/e2e/container/kill_test.go index cfa0193867..d4e71591af 100644 --- a/e2e/container/kill_test.go +++ b/e2e/container/kill_test.go @@ -6,8 +6,8 @@ import ( "time" "github.com/docker/cli/e2e/internal/fixtures" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/poll" + "gotest.tools/icmd" + "gotest.tools/poll" ) func TestKillContainer(t *testing.T) { diff --git a/e2e/container/run_test.go b/e2e/container/run_test.go index ed9f9d0b0b..68a3e40027 100644 --- a/e2e/container/run_test.go +++ b/e2e/container/run_test.go @@ -6,11 +6,11 @@ import ( "github.com/docker/cli/e2e/internal/fixtures" "github.com/docker/cli/internal/test/environment" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/golden" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/golden" + "gotest.tools/icmd" + "gotest.tools/skip" ) const registryPrefix = "registry:5000" diff --git a/e2e/image/build_test.go b/e2e/image/build_test.go index 4d7ff08975..7d89a6f3b5 100644 --- a/e2e/image/build_test.go +++ b/e2e/image/build_test.go @@ -7,9 +7,9 @@ import ( "github.com/docker/cli/e2e/internal/fixtures" "github.com/docker/cli/internal/test/environment" "github.com/docker/cli/internal/test/output" - "github.com/gotestyourself/gotestyourself/fs" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/fs" + "gotest.tools/icmd" + "gotest.tools/skip" ) func TestBuildFromContextDirectoryWithTag(t *testing.T) { diff --git a/e2e/image/pull_test.go b/e2e/image/pull_test.go index fbf14d46b1..625ccd5993 100644 --- a/e2e/image/pull_test.go +++ b/e2e/image/pull_test.go @@ -5,9 +5,9 @@ import ( "github.com/docker/cli/e2e/internal/fixtures" "github.com/docker/cli/internal/test/environment" - "github.com/gotestyourself/gotestyourself/golden" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/golden" + "gotest.tools/icmd" + "gotest.tools/skip" ) const registryPrefix = "registry:5000" diff --git a/e2e/image/push_test.go b/e2e/image/push_test.go index 6b21f1196b..91dbc1cba8 100644 --- a/e2e/image/push_test.go +++ b/e2e/image/push_test.go @@ -10,11 +10,11 @@ import ( "github.com/docker/cli/e2e/internal/fixtures" "github.com/docker/cli/internal/test/environment" "github.com/docker/cli/internal/test/output" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/fs" - "github.com/gotestyourself/gotestyourself/golden" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/fs" + "gotest.tools/golden" + "gotest.tools/icmd" + "gotest.tools/skip" ) const ( diff --git a/e2e/internal/fixtures/fixtures.go b/e2e/internal/fixtures/fixtures.go index 528e07b955..99343f6541 100644 --- a/e2e/internal/fixtures/fixtures.go +++ b/e2e/internal/fixtures/fixtures.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/gotestyourself/gotestyourself/fs" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/fs" + "gotest.tools/icmd" ) const ( diff --git a/e2e/plugin/trust_test.go b/e2e/plugin/trust_test.go index f19034e384..8dc3cad87a 100644 --- a/e2e/plugin/trust_test.go +++ b/e2e/plugin/trust_test.go @@ -11,11 +11,11 @@ import ( "github.com/docker/cli/e2e/internal/fixtures" "github.com/docker/cli/internal/test/environment" "github.com/docker/docker/api/types" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/fs" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/skip" "github.com/pkg/errors" + "gotest.tools/assert" + "gotest.tools/fs" + "gotest.tools/icmd" + "gotest.tools/skip" ) const registryPrefix = "registry:5000" diff --git a/e2e/stack/deploy_test.go b/e2e/stack/deploy_test.go index a19f1ea81a..a0e7d28608 100644 --- a/e2e/stack/deploy_test.go +++ b/e2e/stack/deploy_test.go @@ -7,10 +7,10 @@ import ( "testing" "github.com/docker/cli/internal/test/environment" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/golden" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + "gotest.tools/golden" + "gotest.tools/icmd" + "gotest.tools/skip" ) func TestDeployWithNamedResources(t *testing.T) { diff --git a/e2e/stack/remove_test.go b/e2e/stack/remove_test.go index 47ec92bbef..27300b1cc2 100644 --- a/e2e/stack/remove_test.go +++ b/e2e/stack/remove_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/docker/cli/internal/test/environment" - "github.com/gotestyourself/gotestyourself/golden" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/poll" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/golden" + "gotest.tools/icmd" + "gotest.tools/poll" + "gotest.tools/skip" ) var pollSettings = environment.DefaultPollSettings diff --git a/e2e/system/inspect_test.go b/e2e/system/inspect_test.go index aefab51606..2b32959721 100644 --- a/e2e/system/inspect_test.go +++ b/e2e/system/inspect_test.go @@ -3,7 +3,7 @@ package system import ( "testing" - "github.com/gotestyourself/gotestyourself/icmd" + "gotest.tools/icmd" ) // TestInspectInvalidReference migrated from moby/integration-cli diff --git a/e2e/trust/revoke_test.go b/e2e/trust/revoke_test.go index b356bd76cf..85b1cdc0e1 100644 --- a/e2e/trust/revoke_test.go +++ b/e2e/trust/revoke_test.go @@ -6,11 +6,11 @@ import ( "github.com/docker/cli/e2e/internal/fixtures" "github.com/docker/cli/internal/test/environment" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" + "gotest.tools/icmd" + "gotest.tools/skip" ) const ( diff --git a/e2e/trust/sign_test.go b/e2e/trust/sign_test.go index 5dbf959ae5..ffa320e904 100644 --- a/e2e/trust/sign_test.go +++ b/e2e/trust/sign_test.go @@ -6,11 +6,11 @@ import ( "github.com/docker/cli/e2e/internal/fixtures" "github.com/docker/cli/internal/test/environment" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/gotestyourself/gotestyourself/fs" - "github.com/gotestyourself/gotestyourself/icmd" - "github.com/gotestyourself/gotestyourself/skip" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" + "gotest.tools/fs" + "gotest.tools/icmd" + "gotest.tools/skip" ) const ( diff --git a/internal/test/environment/testenv.go b/internal/test/environment/testenv.go index 9d719014b7..3e4ef8495d 100644 --- a/internal/test/environment/testenv.go +++ b/internal/test/environment/testenv.go @@ -5,8 +5,8 @@ import ( "strings" "time" - "github.com/gotestyourself/gotestyourself/poll" "github.com/pkg/errors" + "gotest.tools/poll" ) // Setup a new environment diff --git a/kubernetes/check_test.go b/kubernetes/check_test.go index a8a6e65931..e9b9aa7f9a 100644 --- a/kubernetes/check_test.go +++ b/kubernetes/check_test.go @@ -3,8 +3,8 @@ package kubernetes import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/kubernetes/labels/labels_test.go b/kubernetes/labels/labels_test.go index d99f881829..7815b73d34 100644 --- a/kubernetes/labels/labels_test.go +++ b/kubernetes/labels/labels_test.go @@ -3,8 +3,8 @@ package labels import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestForService(t *testing.T) { diff --git a/opts/duration_test.go b/opts/duration_test.go index 937585d89e..1a2c76a8d3 100644 --- a/opts/duration_test.go +++ b/opts/duration_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 TestDurationOptString(t *testing.T) { diff --git a/opts/mount_test.go b/opts/mount_test.go index bf7b0f2012..e59f07fe62 100644 --- a/opts/mount_test.go +++ b/opts/mount_test.go @@ -5,8 +5,8 @@ import ( "testing" mounttypes "github.com/docker/docker/api/types/mount" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestMountOptString(t *testing.T) { diff --git a/opts/network_test.go b/opts/network_test.go index 357ac10804..5219d14a3a 100644 --- a/opts/network_test.go +++ b/opts/network_test.go @@ -3,8 +3,8 @@ package opts import ( "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestNetworkOptLegacySyntax(t *testing.T) { diff --git a/opts/port_test.go b/opts/port_test.go index 7f07a86cfe..fb3498f7c5 100644 --- a/opts/port_test.go +++ b/opts/port_test.go @@ -4,8 +4,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 TestPortOptValidSimpleSyntax(t *testing.T) { diff --git a/opts/quotedstring_test.go b/opts/quotedstring_test.go index a23448f1b1..72ec6a21cb 100644 --- a/opts/quotedstring_test.go +++ b/opts/quotedstring_test.go @@ -3,8 +3,8 @@ package 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/opts/secret_test.go b/opts/secret_test.go index 95ed752148..94dd80d19a 100644 --- a/opts/secret_test.go +++ b/opts/secret_test.go @@ -4,8 +4,8 @@ import ( "os" "testing" - "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" + "gotest.tools/assert" + is "gotest.tools/assert/cmp" ) func TestSecretOptionsSimple(t *testing.T) { diff --git a/service/logs/parse_logs_test.go b/service/logs/parse_logs_test.go index a8f612ce4a..24bd0db7b7 100644 --- a/service/logs/parse_logs_test.go +++ b/service/logs/parse_logs_test.go @@ -3,9 +3,9 @@ package logs import ( "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 TestParseLogDetails(t *testing.T) { diff --git a/templates/templates_test.go b/templates/templates_test.go index fa4d773395..102de2bd9f 100644 --- a/templates/templates_test.go +++ b/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" ) // GitHub #32120 diff --git a/vendor.conf b/vendor.conf index 8793dd3097..ef96c0381e 100755 --- a/vendor.conf +++ b/vendor.conf @@ -29,7 +29,7 @@ github.com/google/gofuzz 44d81051d367757e1c7c6a5a86423ece9afcf63c github.com/googleapis/gnostic e4f56557df6250e1945ee6854f181ce4e1c2c646 github.com/gorilla/context v1.1 github.com/gorilla/mux v1.1 -github.com/gotestyourself/gotestyourself cf3a5ab914a2efa8bc838d09f5918c1d44d02909 +gotest.tools v2.1.0 github.com/go-openapi/jsonpointer 46af16f9f7b149af66e5d1bd010e3574dc06de98 github.com/go-openapi/jsonreference 13c6e3589ad90f49bd3e3bbe2c2cb3d7a4142272 github.com/go-openapi/spec 6aced65f8501fe1217321abf0749d354824ba2ff @@ -58,7 +58,6 @@ github.com/opencontainers/runc 69663f0bd4b60df09991c08812a60108003fa340 github.com/opentracing/opentracing-go 1361b9cd60be79c4c3a7fa9841b3c132e40066a7 github.com/peterbourgon/diskv 5f041e8faa004a95c88a202771f4cc3e991971e6 github.com/pkg/errors 839d9e913e063e28dfd0e6c7b7512793e0a48be9 -github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/client_golang 52437c81da6b127a9925d17eb3a382a2e5fd395e github.com/prometheus/client_model fa8ad6fec33561be4280a8f0514318c79d7f6cb6 github.com/prometheus/common ebdfc6da46522d58825777cf1f90490a5b1ef1d8 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/golden/golden.go b/vendor/gotest.tools/golden/golden.go similarity index 76% rename from vendor/github.com/gotestyourself/gotestyourself/golden/golden.go rename to vendor/gotest.tools/golden/golden.go index 357edcfd44..1804b65931 100644 --- a/vendor/github.com/gotestyourself/gotestyourself/golden/golden.go +++ b/vendor/gotest.tools/golden/golden.go @@ -2,7 +2,7 @@ Golden files are files in the ./testdata/ subdirectory of the package under test. */ -package golden +package golden // import "gotest.tools/golden" import ( "bytes" @@ -11,9 +11,9 @@ import ( "io/ioutil" "path/filepath" - "github.com/gotestyourself/gotestyourself/assert" - "github.com/gotestyourself/gotestyourself/assert/cmp" - "github.com/pmezard/go-difflib/difflib" + "gotest.tools/assert" + "gotest.tools/assert/cmp" + "gotest.tools/internal/format" ) var flagUpdate = flag.Bool("test.update-golden", false, "update golden file") @@ -62,16 +62,11 @@ func exactBytes(in []byte) []byte { // to the golden file. // Returns whether the assertion was successful (true) or not (false). // This is equivalent to assert.Check(t, String(actual, filename)) -// -// Deprecated: In a future version this function will change to use assert.Assert -// instead of assert.Check to be consistent with other assert functions. -// Use assert.Check(t, String(actual, filename) if you want to preserve the -// current behaviour. -func Assert(t assert.TestingT, actual string, filename string, msgAndArgs ...interface{}) bool { +func Assert(t assert.TestingT, actual string, filename string, msgAndArgs ...interface{}) { if ht, ok := t.(helperT); ok { ht.Helper() } - return assert.Check(t, String(actual, filename), msgAndArgs...) + assert.Assert(t, String(actual, filename), msgAndArgs...) } // String compares actual to the contents of filename and returns success @@ -90,16 +85,12 @@ func String(actual string, filename string) cmp.Comparison { if result != nil { return result } - diff, err := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ - A: difflib.SplitLines(string(expected)), - B: difflib.SplitLines(string(actualBytes)), - FromFile: "expected", - ToFile: "actual", - Context: 3, + diff := format.UnifiedDiff(format.DiffConfig{ + A: string(expected), + B: string(actualBytes), + From: "expected", + To: "actual", }) - if err != nil { - return cmp.ResultFromError(err) - } return cmp.ResultFailure("\n" + diff) } } @@ -109,21 +100,16 @@ func String(actual string, filename string) cmp.Comparison { // written to the golden file. // Returns whether the assertion was successful (true) or not (false) // This is equivalent to assert.Check(t, Bytes(actual, filename)) -// -// Deprecated: In a future version this function will change to use assert.Assert -// instead of assert.Check to be consistent with other assert functions. -// Use assert.Check(t, Bytes(actual, filename) if you want to preserve the -// current behaviour. func AssertBytes( t assert.TestingT, actual []byte, filename string, msgAndArgs ...interface{}, -) bool { +) { if ht, ok := t.(helperT); ok { ht.Helper() } - return assert.Check(t, Bytes(actual, filename), msgAndArgs...) + assert.Assert(t, Bytes(actual, filename), msgAndArgs...) } // Bytes compares actual to the contents of filename and returns success 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{}