From 681c921528a892e0a087fa90124838e4ad29f940 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 6 Mar 2018 14:03:47 -0500 Subject: [PATCH] Remove testutil Signed-off-by: Daniel Nephin --- cli/command/checkpoint/create_test.go | 3 +-- cli/command/checkpoint/list_test.go | 3 +-- cli/command/checkpoint/remove_test.go | 3 +-- cli/command/cli_test.go | 3 +-- cli/command/config/create_test.go | 3 +-- cli/command/config/inspect_test.go | 3 +-- cli/command/config/ls_test.go | 3 +-- cli/command/config/remove_test.go | 3 +-- cli/command/container/cp_test.go | 7 +++---- cli/command/container/exec_test.go | 5 ++--- cli/command/container/list_test.go | 3 +-- cli/command/container/logs_test.go | 3 +-- cli/command/container/opts_test.go | 11 +++++------ cli/command/image/build/context_test.go | 7 +++---- cli/command/image/history_test.go | 3 +-- cli/command/image/import_test.go | 5 ++--- cli/command/image/inspect_test.go | 3 +-- cli/command/image/list_test.go | 3 +-- cli/command/image/load_test.go | 5 ++--- cli/command/image/prune_test.go | 3 +-- cli/command/image/pull_test.go | 3 +-- cli/command/image/push_test.go | 3 +-- cli/command/image/remove_test.go | 3 +-- cli/command/image/save_test.go | 3 +-- cli/command/image/tag_test.go | 3 +-- cli/command/manifest/annotate_test.go | 7 +++---- cli/command/manifest/create_test.go | 3 +-- cli/command/manifest/push_test.go | 3 +-- cli/command/network/connect_test.go | 3 +-- cli/command/network/create_test.go | 3 +-- cli/command/network/disconnect_test.go | 4 ++-- cli/command/node/demote_test.go | 3 +-- cli/command/node/inspect_test.go | 3 +-- cli/command/node/promote_test.go | 3 +-- cli/command/node/remove_test.go | 3 +-- cli/command/node/update_test.go | 3 +-- cli/command/plugin/create_test.go | 11 +++++------ cli/command/plugin/disable_test.go | 3 +-- cli/command/plugin/enable_test.go | 3 +-- cli/command/plugin/remove_test.go | 3 +-- cli/command/secret/create_test.go | 3 +-- cli/command/secret/inspect_test.go | 3 +-- cli/command/secret/ls_test.go | 3 +-- cli/command/secret/remove_test.go | 3 +-- cli/command/service/rollback_test.go | 3 +-- cli/command/service/update_test.go | 7 +++---- cli/command/stack/list_test.go | 3 +-- cli/command/stack/ps_test.go | 3 +-- cli/command/stack/services_test.go | 3 +-- .../stack/swarm/deploy_composefile_test.go | 3 +-- cli/command/swarm/ca_test.go | 3 +-- cli/command/swarm/join_test.go | 3 +-- cli/command/swarm/join_token_test.go | 3 +-- cli/command/swarm/leave_test.go | 3 +-- cli/command/swarm/unlock_key_test.go | 3 +-- cli/command/swarm/unlock_test.go | 3 +-- cli/command/swarm/update_test.go | 3 +-- cli/command/trust/inspect_test.go | 11 +++++------ cli/command/trust/key_generate_test.go | 3 +-- cli/command/trust/key_load_test.go | 3 +-- cli/command/trust/revoke_test.go | 13 ++++++------- cli/command/trust/sign_test.go | 5 ++--- cli/command/trust/signer_add_test.go | 3 +-- cli/command/trust/signer_remove_test.go | 3 +-- cli/command/trust/view_test.go | 11 +++++------ cli/command/volume/create_test.go | 3 +-- cli/command/volume/inspect_test.go | 3 +-- cli/command/volume/list_test.go | 3 +-- cli/command/volume/prune_test.go | 3 +-- cli/command/volume/remove_test.go | 3 +-- cli/compose/loader/volume_test.go | 7 +++---- cli/config/credentials/native_store_test.go | 7 +++---- internal/test/testutil/assert.go | 19 ------------------- opts/mount_test.go | 11 +++++------ opts/network_test.go | 3 +-- opts/port_test.go | 3 +-- 76 files changed, 117 insertions(+), 210 deletions(-) delete mode 100644 internal/test/testutil/assert.go diff --git a/cli/command/checkpoint/create_test.go b/cli/command/checkpoint/create_test.go index 838e889f1b..a74c9922c0 100644 --- a/cli/command/checkpoint/create_test.go +++ b/cli/command/checkpoint/create_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -43,7 +42,7 @@ func TestCheckpointCreateErrors(t *testing.T) { cmd := newCreateCommand(cli) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/checkpoint/list_test.go b/cli/command/checkpoint/list_test.go index 6c2277b517..5e67084479 100644 --- a/cli/command/checkpoint/list_test.go +++ b/cli/command/checkpoint/list_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -43,7 +42,7 @@ func TestCheckpointListErrors(t *testing.T) { cmd := newListCommand(cli) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/checkpoint/remove_test.go b/cli/command/checkpoint/remove_test.go index 386a1a0a12..f73673608e 100644 --- a/cli/command/checkpoint/remove_test.go +++ b/cli/command/checkpoint/remove_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -42,7 +41,7 @@ func TestCheckpointRemoveErrors(t *testing.T) { cmd := newRemoveCommand(cli) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/cli_test.go b/cli/command/cli_test.go index dec09c8ee5..6e4f0cdf74 100644 --- a/cli/command/cli_test.go +++ b/cli/command/cli_test.go @@ -8,7 +8,6 @@ import ( cliconfig "github.com/docker/cli/cli/config" "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/cli/flags" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api" "github.com/docker/docker/api/types" "github.com/docker/docker/client" @@ -331,7 +330,7 @@ func TestGetClientWithPassword(t *testing.T) { _, err := getClientWithPassword(passRetriever, newClient) if testcase.expectedErr != "" { - testutil.ErrorContains(t, err, testcase.expectedErr) + assert.ErrorContains(t, err, testcase.expectedErr) return } diff --git a/cli/command/config/create_test.go b/cli/command/config/create_test.go index faa9ba972a..a21b59708e 100644 --- a/cli/command/config/create_test.go +++ b/cli/command/config/create_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/assert" @@ -48,7 +47,7 @@ func TestConfigCreateErrors(t *testing.T) { ) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/config/inspect_test.go b/cli/command/config/inspect_test.go index 7c5930d413..cd4535db3d 100644 --- a/cli/command/config/inspect_test.go +++ b/cli/command/config/inspect_test.go @@ -11,7 +11,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/golden" ) @@ -62,7 +61,7 @@ func TestConfigInspectErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/config/ls_test.go b/cli/command/config/ls_test.go index b1ec2d1c93..4eac2df705 100644 --- a/cli/command/config/ls_test.go +++ b/cli/command/config/ls_test.go @@ -12,7 +12,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/gotestyourself/gotestyourself/golden" @@ -43,7 +42,7 @@ func TestConfigListErrors(t *testing.T) { ) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/config/remove_test.go b/cli/command/config/remove_test.go index e4af842cf0..bf8e0dcdc4 100644 --- a/cli/command/config/remove_test.go +++ b/cli/command/config/remove_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pkg/errors" @@ -38,7 +37,7 @@ func TestConfigRemoveErrors(t *testing.T) { ) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/container/cp_test.go b/cli/command/container/cp_test.go index 11b799b48e..ba45a073a3 100644 --- a/cli/command/container/cp_test.go +++ b/cli/command/container/cp_test.go @@ -9,7 +9,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/archive" "github.com/gotestyourself/gotestyourself/assert" @@ -109,7 +108,7 @@ func TestRunCopyFromContainerToFilesystemMissingDestinationDirectory(t *testing. } cli := test.NewFakeCli(fakeClient) err := runCopy(cli, options) - testutil.ErrorContains(t, err, destDir.Join("missing")) + assert.ErrorContains(t, err, destDir.Join("missing")) } func TestRunCopyToContainerFromFileWithTrailingSlash(t *testing.T) { @@ -122,7 +121,7 @@ func TestRunCopyToContainerFromFileWithTrailingSlash(t *testing.T) { } cli := test.NewFakeCli(&fakeClient{}) err := runCopy(cli, options) - testutil.ErrorContains(t, err, "not a directory") + assert.ErrorContains(t, err, "not a directory") } func TestRunCopyToContainerSourceDoesNotExist(t *testing.T) { @@ -136,7 +135,7 @@ func TestRunCopyToContainerSourceDoesNotExist(t *testing.T) { if runtime.GOOS == "windows" { expected = "cannot find the file specified" } - testutil.ErrorContains(t, err, expected) + assert.ErrorContains(t, err, expected) } func TestSplitCpArg(t *testing.T) { diff --git a/cli/command/container/exec_test.go b/cli/command/container/exec_test.go index 9e61eaa502..d40c74fff3 100644 --- a/cli/command/container/exec_test.go +++ b/cli/command/container/exec_test.go @@ -7,7 +7,6 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/cli/opts" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" @@ -151,7 +150,7 @@ func TestRunExec(t *testing.T) { err := runExec(cli, testcase.options) if testcase.expectedError != "" { - testutil.ErrorContains(t, err, testcase.expectedError) + assert.ErrorContains(t, err, testcase.expectedError) } else { if !assert.Check(t, err) { return @@ -223,6 +222,6 @@ func TestNewExecCommandErrors(t *testing.T) { cmd := NewExecCommand(cli) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/container/list_test.go b/cli/command/container/list_test.go index 61abd885d3..b4221334c4 100644 --- a/cli/command/container/list_test.go +++ b/cli/command/container/list_test.go @@ -7,7 +7,6 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" @@ -52,7 +51,7 @@ func TestContainerListErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/container/logs_test.go b/cli/command/container/logs_test.go index 91699317fd..4465df9a56 100644 --- a/cli/command/container/logs_test.go +++ b/cli/command/container/logs_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/gotestyourself/gotestyourself/assert" @@ -50,7 +49,7 @@ func TestRunLogs(t *testing.T) { err := runLogs(cli, testcase.options) if testcase.expectedError != "" { - testutil.ErrorContains(t, err, testcase.expectedError) + assert.ErrorContains(t, err, testcase.expectedError) } else { if !assert.Check(t, err) { return diff --git a/cli/command/container/opts_test.go b/cli/command/container/opts_test.go index cfb53425e6..b08f76c536 100644 --- a/cli/command/container/opts_test.go +++ b/cli/command/container/opts_test.go @@ -9,7 +9,6 @@ import ( "testing" "time" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types/container" networktypes "github.com/docker/docker/api/types/network" "github.com/docker/go-connections/nat" @@ -236,7 +235,7 @@ func TestRunFlagsParseWithMemory(t *testing.T) { flags, _ := setupRunFlags() args := []string{"--memory=invalid", "img", "cmd"} err := flags.Parse(args) - testutil.ErrorContains(t, err, `invalid argument "invalid" for "-m, --memory" flag`) + assert.ErrorContains(t, err, `invalid argument "invalid" for "-m, --memory" flag`) _, hostconfig := mustParse(t, "--memory=1G") assert.Check(t, is.Equal(int64(1073741824), hostconfig.Memory)) @@ -246,7 +245,7 @@ func TestParseWithMemorySwap(t *testing.T) { flags, _ := setupRunFlags() args := []string{"--memory-swap=invalid", "img", "cmd"} err := flags.Parse(args) - testutil.ErrorContains(t, err, `invalid argument "invalid" for "--memory-swap" flag`) + assert.ErrorContains(t, err, `invalid argument "invalid" for "--memory-swap" flag`) _, hostconfig := mustParse(t, "--memory-swap=1G") assert.Check(t, is.Equal(int64(1073741824), hostconfig.MemorySwap)) @@ -375,7 +374,7 @@ func TestParseModes(t *testing.T) { args := []string{"--pid=container:", "img", "cmd"} assert.NilError(t, flags.Parse(args)) _, err := parse(flags, copts) - testutil.ErrorContains(t, err, "--pid: invalid PID mode") + assert.ErrorContains(t, err, "--pid: invalid PID mode") // pid ok _, hostconfig, _, err := parseRun([]string{"--pid=host", "img", "cmd"}) @@ -386,7 +385,7 @@ func TestParseModes(t *testing.T) { // uts ko _, _, _, err = parseRun([]string{"--uts=container:", "img", "cmd"}) - testutil.ErrorContains(t, err, "--uts: invalid UTS mode") + assert.ErrorContains(t, err, "--uts: invalid UTS mode") // uts ok _, hostconfig, _, err = parseRun([]string{"--uts=host", "img", "cmd"}) @@ -402,7 +401,7 @@ func TestRunFlagsParseShmSize(t *testing.T) { args := []string{"--shm-size=a128m", "img", "cmd"} expectedErr := `invalid argument "a128m" for "--shm-size" flag: invalid size: 'a128m'` err := flags.Parse(args) - testutil.ErrorContains(t, err, expectedErr) + assert.ErrorContains(t, err, expectedErr) // shm-size ok _, hostconfig, _, err := parseRun([]string{"--shm-size=128m", "img", "cmd"}) diff --git a/cli/command/image/build/context_test.go b/cli/command/image/build/context_test.go index 8b615ba7ed..493eda014c 100644 --- a/cli/command/image/build/context_test.go +++ b/cli/command/image/build/context_test.go @@ -11,7 +11,6 @@ import ( "strings" "testing" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/pkg/archive" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -46,7 +45,7 @@ func TestGetContextFromLocalDirNoDockerfile(t *testing.T) { defer cleanup() _, _, err := GetContextFromLocalDir(contextDir, "") - testutil.ErrorContains(t, err, "Dockerfile") + assert.ErrorContains(t, err, "Dockerfile") } func TestGetContextFromLocalDirNotExistingDir(t *testing.T) { @@ -56,7 +55,7 @@ func TestGetContextFromLocalDirNotExistingDir(t *testing.T) { fakePath := filepath.Join(contextDir, "fake") _, _, err := GetContextFromLocalDir(fakePath, "") - testutil.ErrorContains(t, err, "fake") + assert.ErrorContains(t, err, "fake") } func TestGetContextFromLocalDirNotExistingDockerfile(t *testing.T) { @@ -66,7 +65,7 @@ func TestGetContextFromLocalDirNotExistingDockerfile(t *testing.T) { fakePath := filepath.Join(contextDir, "fake") _, _, err := GetContextFromLocalDir(contextDir, fakePath) - testutil.ErrorContains(t, err, "fake") + assert.ErrorContains(t, err, "fake") } func TestGetContextFromLocalDirWithNoDirectory(t *testing.T) { diff --git a/cli/command/image/history_test.go b/cli/command/image/history_test.go index 0fb4e5e8be..1005e87486 100644 --- a/cli/command/image/history_test.go +++ b/cli/command/image/history_test.go @@ -7,7 +7,6 @@ import ( "time" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types/image" "github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/golden" @@ -39,7 +38,7 @@ func TestNewHistoryCommandErrors(t *testing.T) { cmd := NewHistoryCommand(test.NewFakeCli(&fakeClient{imageHistoryFunc: tc.imageHistoryFunc})) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/image/import_test.go b/cli/command/image/import_test.go index 0390663c55..0bab6ae642 100644 --- a/cli/command/image/import_test.go +++ b/cli/command/image/import_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -39,7 +38,7 @@ func TestNewImportCommandErrors(t *testing.T) { cmd := NewImportCommand(test.NewFakeCli(&fakeClient{imageImportFunc: tc.imageImportFunc})) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -47,7 +46,7 @@ func TestNewImportCommandInvalidFile(t *testing.T) { cmd := NewImportCommand(test.NewFakeCli(&fakeClient{})) cmd.SetOutput(ioutil.Discard) cmd.SetArgs([]string{"testdata/import-command-success.unexistent-file"}) - testutil.ErrorContains(t, cmd.Execute(), "testdata/import-command-success.unexistent-file") + assert.ErrorContains(t, cmd.Execute(), "testdata/import-command-success.unexistent-file") } func TestNewImportCommandSuccess(t *testing.T) { diff --git a/cli/command/image/inspect_test.go b/cli/command/image/inspect_test.go index 320759ef51..76f47ae003 100644 --- a/cli/command/image/inspect_test.go +++ b/cli/command/image/inspect_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -29,7 +28,7 @@ func TestNewInspectCommandErrors(t *testing.T) { cmd := newInspectCommand(test.NewFakeCli(&fakeClient{})) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/image/list_test.go b/cli/command/image/list_test.go index 8fb4510255..3df7c4b75a 100644 --- a/cli/command/image/list_test.go +++ b/cli/command/image/list_test.go @@ -7,7 +7,6 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -39,7 +38,7 @@ func TestNewImagesCommandErrors(t *testing.T) { cmd := NewImagesCommand(test.NewFakeCli(&fakeClient{imageListFunc: tc.imageListFunc})) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/image/load_test.go b/cli/command/image/load_test.go index af5f669062..69ff76d891 100644 --- a/cli/command/image/load_test.go +++ b/cli/command/image/load_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/golden" @@ -47,7 +46,7 @@ func TestNewLoadCommandErrors(t *testing.T) { cmd := NewLoadCommand(cli) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -57,7 +56,7 @@ func TestNewLoadCommandInvalidInput(t *testing.T) { cmd.SetOutput(ioutil.Discard) cmd.SetArgs([]string{"--input", "*"}) err := cmd.Execute() - testutil.ErrorContains(t, err, expectedError) + assert.ErrorContains(t, err, expectedError) } func TestNewLoadCommandSuccess(t *testing.T) { diff --git a/cli/command/image/prune_test.go b/cli/command/image/prune_test.go index 00138e1a90..26622db6ff 100644 --- a/cli/command/image/prune_test.go +++ b/cli/command/image/prune_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/gotestyourself/gotestyourself/assert" @@ -42,7 +41,7 @@ func TestNewPruneCommandErrors(t *testing.T) { })) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/image/pull_test.go b/cli/command/image/pull_test.go index 9d39e4bada..ba0048fdbb 100644 --- a/cli/command/image/pull_test.go +++ b/cli/command/image/pull_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -42,7 +41,7 @@ func TestNewPullCommandErrors(t *testing.T) { cmd := NewPullCommand(cli) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/image/push_test.go b/cli/command/image/push_test.go index f2ca7e0a0f..8031aa4985 100644 --- a/cli/command/image/push_test.go +++ b/cli/command/image/push_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" @@ -49,7 +48,7 @@ func TestNewPushCommandErrors(t *testing.T) { cmd := NewPushCommand(cli) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/image/remove_test.go b/cli/command/image/remove_test.go index 35ad08535a..ee5cfd02e0 100644 --- a/cli/command/image/remove_test.go +++ b/cli/command/image/remove_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -71,7 +70,7 @@ func TestNewRemoveCommandErrors(t *testing.T) { })) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) }) } } diff --git a/cli/command/image/save_test.go b/cli/command/image/save_test.go index 0ad4bdcd03..f12ba6d805 100644 --- a/cli/command/image/save_test.go +++ b/cli/command/image/save_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pkg/errors" @@ -54,7 +53,7 @@ func TestNewSaveCommandErrors(t *testing.T) { cmd := NewSaveCommand(cli) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/image/tag_test.go b/cli/command/image/tag_test.go index 53576f81e7..9db565c8a2 100644 --- a/cli/command/image/tag_test.go +++ b/cli/command/image/tag_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" ) @@ -21,7 +20,7 @@ func TestCliNewTagCommandErrors(t *testing.T) { cmd := NewTagCommand(test.NewFakeCli(&fakeClient{})) cmd.SetArgs(args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), expectedError) + assert.ErrorContains(t, cmd.Execute(), expectedError) } } diff --git a/cli/command/manifest/annotate_test.go b/cli/command/manifest/annotate_test.go index dd05dd8977..ab6f3bbf3a 100644 --- a/cli/command/manifest/annotate_test.go +++ b/cli/command/manifest/annotate_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/gotestyourself/gotestyourself/golden" @@ -35,7 +34,7 @@ func TestManifestAnnotateError(t *testing.T) { cmd := newAnnotateCommand(cli) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -54,7 +53,7 @@ func TestManifestAnnotate(t *testing.T) { cmd.SetArgs([]string{"example.com/list:v1", "example.com/fake:0.0"}) cmd.SetOutput(ioutil.Discard) expectedError := "manifest for image example.com/fake:0.0 does not exist" - testutil.ErrorContains(t, cmd.Execute(), expectedError) + assert.ErrorContains(t, cmd.Execute(), expectedError) cmd.SetArgs([]string{"example.com/list:v1", "example.com/alpine:3.0"}) cmd.Flags().Set("os", "freebsd") @@ -62,7 +61,7 @@ func TestManifestAnnotate(t *testing.T) { cmd.Flags().Set("os-features", "feature1") cmd.Flags().Set("variant", "v7") expectedError = "manifest entry for image has unsupported os/arch combination" - testutil.ErrorContains(t, cmd.Execute(), expectedError) + assert.ErrorContains(t, cmd.Execute(), expectedError) cmd.Flags().Set("arch", "arm") assert.NilError(t, cmd.Execute()) diff --git a/cli/command/manifest/create_test.go b/cli/command/manifest/create_test.go index 058990b44b..d3c040e5fb 100644 --- a/cli/command/manifest/create_test.go +++ b/cli/command/manifest/create_test.go @@ -6,7 +6,6 @@ import ( manifesttypes "github.com/docker/cli/cli/manifest/types" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/distribution/reference" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -35,7 +34,7 @@ func TestManifestCreateErrors(t *testing.T) { cmd := newCreateListCommand(cli) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/manifest/push_test.go b/cli/command/manifest/push_test.go index aa5581168f..f339ea0de6 100644 --- a/cli/command/manifest/push_test.go +++ b/cli/command/manifest/push_test.go @@ -6,7 +6,6 @@ import ( manifesttypes "github.com/docker/cli/cli/manifest/types" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/distribution/reference" "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" @@ -46,7 +45,7 @@ func TestManifestPushErrors(t *testing.T) { cmd := newPushListCommand(cli) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/network/connect_test.go b/cli/command/network/connect_test.go index bdd382450a..c4cffc7dd9 100644 --- a/cli/command/network/connect_test.go +++ b/cli/command/network/connect_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types/network" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -39,7 +38,7 @@ func TestNetworkConnectErrors(t *testing.T) { ) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/network/create_test.go b/cli/command/network/create_test.go index 7ab03cc074..8880e467be 100644 --- a/cli/command/network/create_test.go +++ b/cli/command/network/create_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/network" "github.com/gotestyourself/gotestyourself/assert" @@ -139,7 +138,7 @@ func TestNetworkCreateErrors(t *testing.T) { assert.NilError(t, cmd.Flags().Set(key, value)) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/network/disconnect_test.go b/cli/command/network/disconnect_test.go index e3920e9777..9c1bc0906f 100644 --- a/cli/command/network/disconnect_test.go +++ b/cli/command/network/disconnect_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" + "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" "golang.org/x/net/context" ) @@ -36,6 +36,6 @@ func TestNetworkDisconnectErrors(t *testing.T) { ) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/node/demote_test.go b/cli/command/node/demote_test.go index f96dedd18e..d3bfd43474 100644 --- a/cli/command/node/demote_test.go +++ b/cli/command/node/demote_test.go @@ -10,7 +10,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" ) func TestNodeDemoteErrors(t *testing.T) { @@ -46,7 +45,7 @@ func TestNodeDemoteErrors(t *testing.T) { })) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/node/inspect_test.go b/cli/command/node/inspect_test.go index fed37b9b79..42a78f8555 100644 --- a/cli/command/node/inspect_test.go +++ b/cli/command/node/inspect_test.go @@ -11,7 +11,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/golden" ) @@ -76,7 +75,7 @@ func TestNodeInspectErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/node/promote_test.go b/cli/command/node/promote_test.go index 4cefcba79e..39c5000301 100644 --- a/cli/command/node/promote_test.go +++ b/cli/command/node/promote_test.go @@ -10,7 +10,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" ) func TestNodePromoteErrors(t *testing.T) { @@ -46,7 +45,7 @@ func TestNodePromoteErrors(t *testing.T) { })) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/node/remove_test.go b/cli/command/node/remove_test.go index 0620103d2e..498a827999 100644 --- a/cli/command/node/remove_test.go +++ b/cli/command/node/remove_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" ) @@ -34,7 +33,7 @@ func TestNodeRemoveErrors(t *testing.T) { })) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/node/update_test.go b/cli/command/node/update_test.go index d929c6a13d..c9a2f2108b 100644 --- a/cli/command/node/update_test.go +++ b/cli/command/node/update_test.go @@ -10,7 +10,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" ) func TestNodeUpdateErrors(t *testing.T) { @@ -66,7 +65,7 @@ func TestNodeUpdateErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/plugin/create_test.go b/cli/command/plugin/create_test.go index 793a439d09..a43e5dc6a7 100644 --- a/cli/command/plugin/create_test.go +++ b/cli/command/plugin/create_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -39,7 +38,7 @@ func TestCreateErrors(t *testing.T) { cmd := newCreateCommand(cli) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -51,7 +50,7 @@ func TestCreateErrorOnFileAsContextDir(t *testing.T) { cmd := newCreateCommand(cli) cmd.SetArgs([]string{"plugin-foo", tmpFile.Path()}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "context must be a directory") + assert.ErrorContains(t, cmd.Execute(), "context must be a directory") } func TestCreateErrorOnContextDirWithoutConfig(t *testing.T) { @@ -62,7 +61,7 @@ func TestCreateErrorOnContextDirWithoutConfig(t *testing.T) { cmd := newCreateCommand(cli) cmd.SetArgs([]string{"plugin-foo", tmpDir.Path()}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "config.json: no such file or directory") + assert.ErrorContains(t, cmd.Execute(), "config.json: no such file or directory") } func TestCreateErrorOnInvalidConfig(t *testing.T) { @@ -75,7 +74,7 @@ func TestCreateErrorOnInvalidConfig(t *testing.T) { cmd := newCreateCommand(cli) cmd.SetArgs([]string{"plugin-foo", tmpDir.Path()}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "invalid") + assert.ErrorContains(t, cmd.Execute(), "invalid") } func TestCreateErrorFromDaemon(t *testing.T) { @@ -93,7 +92,7 @@ func TestCreateErrorFromDaemon(t *testing.T) { cmd := newCreateCommand(cli) cmd.SetArgs([]string{"plugin-foo", tmpDir.Path()}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "Error creating plugin") + assert.ErrorContains(t, cmd.Execute(), "Error creating plugin") } func TestCreatePlugin(t *testing.T) { diff --git a/cli/command/plugin/disable_test.go b/cli/command/plugin/disable_test.go index c9876f574a..ab18bef060 100644 --- a/cli/command/plugin/disable_test.go +++ b/cli/command/plugin/disable_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -42,7 +41,7 @@ func TestPluginDisableErrors(t *testing.T) { })) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/plugin/enable_test.go b/cli/command/plugin/enable_test.go index f994830a68..7606ec5bec 100644 --- a/cli/command/plugin/enable_test.go +++ b/cli/command/plugin/enable_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -53,7 +52,7 @@ func TestPluginEnableErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/plugin/remove_test.go b/cli/command/plugin/remove_test.go index 8053f3a308..7ce02c6a6c 100644 --- a/cli/command/plugin/remove_test.go +++ b/cli/command/plugin/remove_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -39,7 +38,7 @@ func TestRemoveErrors(t *testing.T) { cmd := newRemoveCommand(cli) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/secret/create_test.go b/cli/command/secret/create_test.go index 8870c9a14b..33b077b2d1 100644 --- a/cli/command/secret/create_test.go +++ b/cli/command/secret/create_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/assert" @@ -46,7 +45,7 @@ func TestSecretCreateErrors(t *testing.T) { ) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/secret/inspect_test.go b/cli/command/secret/inspect_test.go index 8aadb1bc1f..adee2bcf5f 100644 --- a/cli/command/secret/inspect_test.go +++ b/cli/command/secret/inspect_test.go @@ -11,7 +11,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/golden" ) @@ -62,7 +61,7 @@ func TestSecretInspectErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/secret/ls_test.go b/cli/command/secret/ls_test.go index 513988d66c..4e62fc74f8 100644 --- a/cli/command/secret/ls_test.go +++ b/cli/command/secret/ls_test.go @@ -12,7 +12,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/gotestyourself/gotestyourself/golden" @@ -43,7 +42,7 @@ func TestSecretListErrors(t *testing.T) { ) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/secret/remove_test.go b/cli/command/secret/remove_test.go index f9b4477baa..80b7b96a80 100644 --- a/cli/command/secret/remove_test.go +++ b/cli/command/secret/remove_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pkg/errors" @@ -38,7 +37,7 @@ func TestSecretRemoveErrors(t *testing.T) { ) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/service/rollback_test.go b/cli/command/service/rollback_test.go index bc97b349c0..e76eb68a47 100644 --- a/cli/command/service/rollback_test.go +++ b/cli/command/service/rollback_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/assert" @@ -100,6 +99,6 @@ func TestRollbackWithErrors(t *testing.T) { cmd.SetArgs(tc.args) cmd.Flags().Set("quiet", "true") cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/service/update_test.go b/cli/command/service/update_test.go index 04e6e24edf..a4cc53385c 100644 --- a/cli/command/service/update_test.go +++ b/cli/command/service/update_test.go @@ -7,7 +7,6 @@ import ( "testing" "time" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" mounttypes "github.com/docker/docker/api/types/mount" @@ -167,7 +166,7 @@ func TestUpdateDNSConfig(t *testing.T) { // IPv6 flags.Set("dns-add", "2001:db8:abc8::1") // Invalid dns record - testutil.ErrorContains(t, flags.Set("dns-add", "x.y.z.w"), "x.y.z.w is not an ip address") + assert.ErrorContains(t, flags.Set("dns-add", "x.y.z.w"), "x.y.z.w is not an ip address") // domains with duplicates flags.Set("dns-search-add", "example.com") @@ -175,7 +174,7 @@ func TestUpdateDNSConfig(t *testing.T) { flags.Set("dns-search-add", "example.org") flags.Set("dns-search-rm", "example.org") // Invalid dns search domain - testutil.ErrorContains(t, flags.Set("dns-search-add", "example$com"), "example$com is not a valid domain") + assert.ErrorContains(t, flags.Set("dns-search-add", "example$com"), "example$com is not a valid domain") flags.Set("dns-option-add", "ndots:9") flags.Set("dns-option-rm", "timeout:3") @@ -364,7 +363,7 @@ func TestUpdateHosts(t *testing.T) { // just hostname should work as well flags.Set("host-rm", "example.net") // bad format error - testutil.ErrorContains(t, flags.Set("host-add", "$example.com$"), `bad format for add-host: "$example.com$"`) + assert.ErrorContains(t, flags.Set("host-add", "$example.com$"), `bad format for add-host: "$example.com$"`) hosts := []string{"1.2.3.4 example.com", "4.3.2.1 example.org", "2001:db8:abc8::1 example.net"} expected := []string{"1.2.3.4 example.com", "4.3.2.1 example.org", "2001:db8:abc8::1 ipv6.net"} diff --git a/cli/command/stack/list_test.go b/cli/command/stack/list_test.go index add6667ecd..569093bf16 100644 --- a/cli/command/stack/list_test.go +++ b/cli/command/stack/list_test.go @@ -7,7 +7,6 @@ import ( "github.com/docker/cli/internal/test" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/assert" @@ -55,7 +54,7 @@ func TestListErrors(t *testing.T) { for key, value := range tc.flags { cmd.Flags().Set(key, value) } - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/stack/ps_test.go b/cli/command/stack/ps_test.go index 36813ca501..798ad17c15 100644 --- a/cli/command/stack/ps_test.go +++ b/cli/command/stack/ps_test.go @@ -9,7 +9,6 @@ import ( "github.com/docker/cli/internal/test" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/assert" @@ -48,7 +47,7 @@ func TestStackPsErrors(t *testing.T) { })) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/stack/services_test.go b/cli/command/stack/services_test.go index c1d5f99946..a4738549ec 100644 --- a/cli/command/stack/services_test.go +++ b/cli/command/stack/services_test.go @@ -8,7 +8,6 @@ import ( "github.com/docker/cli/internal/test" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/assert" @@ -77,7 +76,7 @@ func TestStackServicesErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/stack/swarm/deploy_composefile_test.go b/cli/command/stack/swarm/deploy_composefile_test.go index fc5c93b3b5..a864c5b658 100644 --- a/cli/command/stack/swarm/deploy_composefile_test.go +++ b/cli/command/stack/swarm/deploy_composefile_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/docker/cli/internal/test/network" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" @@ -59,7 +58,7 @@ func TestValidateExternalNetworks(t *testing.T) { if testcase.expectedMsg == "" { assert.Check(t, err) } else { - testutil.ErrorContains(t, err, testcase.expectedMsg) + assert.ErrorContains(t, err, testcase.expectedMsg) } } } diff --git a/cli/command/swarm/ca_test.go b/cli/command/swarm/ca_test.go index a3ecb5430f..72b20e61e4 100644 --- a/cli/command/swarm/ca_test.go +++ b/cli/command/swarm/ca_test.go @@ -8,7 +8,6 @@ import ( "time" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -97,7 +96,7 @@ PQQDAgNIADBFAiEAqD3Kb2rgsy6NoTk+zEgcUi/aGBCsvQDG3vML1PXN8j0CIBjj })) assert.Check(t, cmd.Flags().Parse(args)) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "flag requires the `--rotate` flag to update the CA") + assert.ErrorContains(t, cmd.Execute(), "flag requires the `--rotate` flag to update the CA") } } diff --git a/cli/command/swarm/join_test.go b/cli/command/swarm/join_test.go index db59b5601a..3e14db18b5 100644 --- a/cli/command/swarm/join_test.go +++ b/cli/command/swarm/join_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/assert" @@ -56,7 +55,7 @@ func TestSwarmJoinErrors(t *testing.T) { })) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/swarm/join_token_test.go b/cli/command/swarm/join_token_test.go index 0860cd4c7f..d69469c64c 100644 --- a/cli/command/swarm/join_token_test.go +++ b/cli/command/swarm/join_token_test.go @@ -11,7 +11,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/golden" ) @@ -101,7 +100,7 @@ func TestSwarmJoinTokenErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/swarm/leave_test.go b/cli/command/swarm/leave_test.go index db33e70d35..8a2db2ce31 100644 --- a/cli/command/swarm/leave_test.go +++ b/cli/command/swarm/leave_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/pkg/errors" @@ -39,7 +38,7 @@ func TestSwarmLeaveErrors(t *testing.T) { })) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/swarm/unlock_key_test.go b/cli/command/swarm/unlock_key_test.go index d8d74e5e6d..cb5e2a9217 100644 --- a/cli/command/swarm/unlock_key_test.go +++ b/cli/command/swarm/unlock_key_test.go @@ -11,7 +11,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/golden" ) @@ -93,7 +92,7 @@ func TestSwarmUnlockKeyErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/swarm/unlock_test.go b/cli/command/swarm/unlock_test.go index 998c302272..b60766ce1c 100644 --- a/cli/command/swarm/unlock_test.go +++ b/cli/command/swarm/unlock_test.go @@ -7,7 +7,6 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/assert" @@ -72,7 +71,7 @@ func TestSwarmUnlockErrors(t *testing.T) { })) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/swarm/update_test.go b/cli/command/swarm/update_test.go index 81a3e19404..8186c5ebaa 100644 --- a/cli/command/swarm/update_test.go +++ b/cli/command/swarm/update_test.go @@ -12,7 +12,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/golden" ) @@ -78,7 +77,7 @@ func TestSwarmUpdateErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/trust/inspect_test.go b/cli/command/trust/inspect_test.go index b9d36de441..7224f1dad9 100644 --- a/cli/command/trust/inspect_test.go +++ b/cli/command/trust/inspect_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/golden" ) @@ -41,7 +40,7 @@ func TestTrustInspectCommandErrors(t *testing.T) { test.NewFakeCli(&fakeClient{})) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -51,14 +50,14 @@ func TestTrustInspectCommandOfflineErrors(t *testing.T) { cmd := newInspectCommand(cli) cmd.SetArgs([]string{"nonexistent-reg-name.io/image"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "No signatures or cannot access nonexistent-reg-name.io/image") + assert.ErrorContains(t, cmd.Execute(), "No signatures or cannot access nonexistent-reg-name.io/image") cli = test.NewFakeCli(&fakeClient{}) cli.SetNotaryClient(getOfflineNotaryRepository) cmd = newInspectCommand(cli) cmd.SetArgs([]string{"nonexistent-reg-name.io/image:tag"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "No signatures or cannot access nonexistent-reg-name.io/image") + assert.ErrorContains(t, cmd.Execute(), "No signatures or cannot access nonexistent-reg-name.io/image") } func TestTrustInspectCommandUninitializedErrors(t *testing.T) { @@ -67,7 +66,7 @@ func TestTrustInspectCommandUninitializedErrors(t *testing.T) { cmd := newInspectCommand(cli) cmd.SetArgs([]string{"reg/unsigned-img"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "No signatures or cannot access reg/unsigned-img") + assert.ErrorContains(t, cmd.Execute(), "No signatures or cannot access reg/unsigned-img") golden.Assert(t, cli.OutBuffer().String(), "trust-inspect-uninitialized.golden") cli = test.NewFakeCli(&fakeClient{}) @@ -75,7 +74,7 @@ func TestTrustInspectCommandUninitializedErrors(t *testing.T) { cmd = newInspectCommand(cli) cmd.SetArgs([]string{"reg/unsigned-img:tag"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "No signatures or cannot access reg/unsigned-img:tag") + assert.ErrorContains(t, cmd.Execute(), "No signatures or cannot access reg/unsigned-img:tag") golden.Assert(t, cli.OutBuffer().String(), "trust-inspect-uninitialized.golden") } diff --git a/cli/command/trust/key_generate_test.go b/cli/command/trust/key_generate_test.go index 8d7b97beae..eadf43ea21 100644 --- a/cli/command/trust/key_generate_test.go +++ b/cli/command/trust/key_generate_test.go @@ -10,7 +10,6 @@ import ( "github.com/docker/cli/cli/config" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/theupdateframework/notary" @@ -46,7 +45,7 @@ func TestTrustKeyGenerateErrors(t *testing.T) { cmd := newKeyGenerateCommand(cli) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/trust/key_load_test.go b/cli/command/trust/key_load_test.go index e4da34e94f..12b7f84d48 100644 --- a/cli/command/trust/key_load_test.go +++ b/cli/command/trust/key_load_test.go @@ -10,7 +10,6 @@ import ( "github.com/docker/cli/cli/config" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/theupdateframework/notary" @@ -61,7 +60,7 @@ func TestTrustKeyLoadErrors(t *testing.T) { cmd := newKeyLoadCommand(cli) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) assert.Check(t, is.Contains(cli.OutBuffer().String(), tc.expectedOutput)) } } diff --git a/cli/command/trust/revoke_test.go b/cli/command/trust/revoke_test.go index 1bb6b0f448..25d579e452 100644 --- a/cli/command/trust/revoke_test.go +++ b/cli/command/trust/revoke_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/theupdateframework/notary/client" @@ -50,7 +49,7 @@ func TestTrustRevokeCommandErrors(t *testing.T) { test.NewFakeCli(&fakeClient{})) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -74,7 +73,7 @@ func TestTrustRevokeCommandOfflineErrors(t *testing.T) { cmd = newRevokeCommand(cli) cmd.SetArgs([]string{"reg-name.io/image:tag"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "could not remove signature for reg-name.io/image:tag: client is offline") + assert.ErrorContains(t, cmd.Execute(), "could not remove signature for reg-name.io/image:tag: client is offline") } func TestTrustRevokeCommandUninitializedErrors(t *testing.T) { @@ -91,14 +90,14 @@ func TestTrustRevokeCommandUninitializedErrors(t *testing.T) { cmd = newRevokeCommand(cli) cmd.SetArgs([]string{"reg-name.io/image", "-y"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "could not remove signature for reg-name.io/image: does not have trust data for") + assert.ErrorContains(t, cmd.Execute(), "could not remove signature for reg-name.io/image: does not have trust data for") cli = test.NewFakeCli(&fakeClient{}) cli.SetNotaryClient(getUninitializedNotaryRepository) cmd = newRevokeCommand(cli) cmd.SetArgs([]string{"reg-name.io/image:tag"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "could not remove signature for reg-name.io/image:tag: does not have trust data for") + assert.ErrorContains(t, cmd.Execute(), "could not remove signature for reg-name.io/image:tag: does not have trust data for") } func TestTrustRevokeCommandEmptyNotaryRepo(t *testing.T) { @@ -115,14 +114,14 @@ func TestTrustRevokeCommandEmptyNotaryRepo(t *testing.T) { cmd = newRevokeCommand(cli) cmd.SetArgs([]string{"reg-name.io/image", "-y"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "could not remove signature for reg-name.io/image: no signed tags to remove") + assert.ErrorContains(t, cmd.Execute(), "could not remove signature for reg-name.io/image: no signed tags to remove") cli = test.NewFakeCli(&fakeClient{}) cli.SetNotaryClient(getEmptyTargetsNotaryRepository) cmd = newRevokeCommand(cli) cmd.SetArgs([]string{"reg-name.io/image:tag"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "could not remove signature for reg-name.io/image:tag: No valid trust data for tag") + assert.ErrorContains(t, cmd.Execute(), "could not remove signature for reg-name.io/image:tag: No valid trust data for tag") } func TestNewRevokeTrustAllSigConfirmation(t *testing.T) { diff --git a/cli/command/trust/sign_test.go b/cli/command/trust/sign_test.go index be6c27afb7..4cc338f10d 100644 --- a/cli/command/trust/sign_test.go +++ b/cli/command/trust/sign_test.go @@ -10,7 +10,6 @@ import ( "github.com/docker/cli/cli/config" "github.com/docker/cli/cli/trust" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/theupdateframework/notary" @@ -69,7 +68,7 @@ func TestTrustSignCommandErrors(t *testing.T) { test.NewFakeCli(&fakeClient{})) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -301,6 +300,6 @@ func TestSignCommandLocalFlag(t *testing.T) { cmd := newSignCommand(cli) cmd.SetArgs([]string{"--local", "reg-name.io/image:red"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "error during connect: Get /images/reg-name.io/image:red/json: unsupported protocol scheme") + assert.ErrorContains(t, cmd.Execute(), "error during connect: Get /images/reg-name.io/image:red/json: unsupported protocol scheme") } diff --git a/cli/command/trust/signer_add_test.go b/cli/command/trust/signer_add_test.go index e11eff5598..e691b10f5c 100644 --- a/cli/command/trust/signer_add_test.go +++ b/cli/command/trust/signer_add_test.go @@ -9,7 +9,6 @@ import ( "github.com/docker/cli/cli/config" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/theupdateframework/notary" @@ -62,7 +61,7 @@ func TestTrustSignerAddErrors(t *testing.T) { cmd := newSignerAddCommand(cli) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/trust/signer_remove_test.go b/cli/command/trust/signer_remove_test.go index f2a33f8ab1..4f625c1dbb 100644 --- a/cli/command/trust/signer_remove_test.go +++ b/cli/command/trust/signer_remove_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/theupdateframework/notary/client" @@ -33,7 +32,7 @@ func TestTrustSignerRemoveErrors(t *testing.T) { test.NewFakeCli(&fakeClient{})) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } testCasesWithOutput := []struct { name string diff --git a/cli/command/trust/view_test.go b/cli/command/trust/view_test.go index 152e87a9e5..7758c94ad1 100644 --- a/cli/command/trust/view_test.go +++ b/cli/command/trust/view_test.go @@ -7,7 +7,6 @@ import ( "github.com/docker/cli/cli/trust" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" dockerClient "github.com/docker/docker/client" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -52,7 +51,7 @@ func TestTrustViewCommandErrors(t *testing.T) { test.NewFakeCli(&fakeClient{})) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -62,14 +61,14 @@ func TestTrustViewCommandOfflineErrors(t *testing.T) { cmd := newViewCommand(cli) cmd.SetArgs([]string{"nonexistent-reg-name.io/image"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "No signatures or cannot access nonexistent-reg-name.io/image") + assert.ErrorContains(t, cmd.Execute(), "No signatures or cannot access nonexistent-reg-name.io/image") cli = test.NewFakeCli(&fakeClient{}) cli.SetNotaryClient(getOfflineNotaryRepository) cmd = newViewCommand(cli) cmd.SetArgs([]string{"nonexistent-reg-name.io/image:tag"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "No signatures or cannot access nonexistent-reg-name.io/image") + assert.ErrorContains(t, cmd.Execute(), "No signatures or cannot access nonexistent-reg-name.io/image") } func TestTrustViewCommandUninitializedErrors(t *testing.T) { @@ -78,14 +77,14 @@ func TestTrustViewCommandUninitializedErrors(t *testing.T) { cmd := newViewCommand(cli) cmd.SetArgs([]string{"reg/unsigned-img"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "No signatures or cannot access reg/unsigned-img") + assert.ErrorContains(t, cmd.Execute(), "No signatures or cannot access reg/unsigned-img") cli = test.NewFakeCli(&fakeClient{}) cli.SetNotaryClient(getUninitializedNotaryRepository) cmd = newViewCommand(cli) cmd.SetArgs([]string{"reg/unsigned-img:tag"}) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), "No signatures or cannot access reg/unsigned-img:tag") + assert.ErrorContains(t, cmd.Execute(), "No signatures or cannot access reg/unsigned-img:tag") } func TestTrustViewCommandEmptyNotaryRepoErrors(t *testing.T) { diff --git a/cli/command/volume/create_test.go b/cli/command/volume/create_test.go index ad8f509d6b..0e70d92e0e 100644 --- a/cli/command/volume/create_test.go +++ b/cli/command/volume/create_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" volumetypes "github.com/docker/docker/api/types/volume" "github.com/gotestyourself/gotestyourself/assert" @@ -51,7 +50,7 @@ func TestVolumeCreateErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/volume/inspect_test.go b/cli/command/volume/inspect_test.go index a2ce14326a..56dbf76be9 100644 --- a/cli/command/volume/inspect_test.go +++ b/cli/command/volume/inspect_test.go @@ -10,7 +10,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/golden" ) @@ -63,7 +62,7 @@ func TestVolumeInspectErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/volume/list_test.go b/cli/command/volume/list_test.go index 0474497dca..b004e349f5 100644 --- a/cli/command/volume/list_test.go +++ b/cli/command/volume/list_test.go @@ -12,7 +12,6 @@ import ( "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/cli/internal/test/builders" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/golden" ) @@ -46,7 +45,7 @@ func TestVolumeListErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/volume/prune_test.go b/cli/command/volume/prune_test.go index 5e21709dc4..79a7d4fc07 100644 --- a/cli/command/volume/prune_test.go +++ b/cli/command/volume/prune_test.go @@ -9,7 +9,6 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/gotestyourself/gotestyourself/assert" @@ -50,7 +49,7 @@ func TestVolumePruneErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/volume/remove_test.go b/cli/command/volume/remove_test.go index 217af55757..5abf026dd7 100644 --- a/cli/command/volume/remove_test.go +++ b/cli/command/volume/remove_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" "github.com/pkg/errors" ) @@ -34,7 +33,7 @@ func TestVolumeRemoveErrors(t *testing.T) { })) cmd.SetArgs(tc.args) cmd.SetOutput(ioutil.Discard) - testutil.ErrorContains(t, cmd.Execute(), tc.expectedError) + assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/compose/loader/volume_test.go b/cli/compose/loader/volume_test.go index d0a6373d62..8eb4c6d991 100644 --- a/cli/compose/loader/volume_test.go +++ b/cli/compose/loader/volume_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/docker/cli/cli/compose/types" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" ) @@ -45,7 +44,7 @@ func TestParseVolumeShortVolumes(t *testing.T) { func TestParseVolumeMissingSource(t *testing.T) { for _, spec := range []string{":foo", "/foo::ro"} { _, err := ParseVolume(spec) - testutil.ErrorContains(t, err, "empty section between colons") + assert.ErrorContains(t, err, "empty section between colons") } } @@ -215,10 +214,10 @@ func TestParseVolumeSplitCases(t *testing.T) { func TestParseVolumeInvalidEmptySpec(t *testing.T) { _, err := ParseVolume("") - testutil.ErrorContains(t, err, "invalid empty volume spec") + assert.ErrorContains(t, err, "invalid empty volume spec") } func TestParseVolumeInvalidSections(t *testing.T) { _, err := ParseVolume("/foo::rw") - testutil.ErrorContains(t, err, "invalid spec") + assert.ErrorContains(t, err, "invalid spec") } diff --git a/cli/config/credentials/native_store_test.go b/cli/config/credentials/native_store_test.go index 337c3bf751..c73ddd1ea3 100644 --- a/cli/config/credentials/native_store_test.go +++ b/cli/config/credentials/native_store_test.go @@ -8,7 +8,6 @@ import ( "strings" "testing" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker-credential-helpers/client" "github.com/docker/docker-credential-helpers/credentials" "github.com/docker/docker/api/types" @@ -129,7 +128,7 @@ func TestNativeStoreAddInvalidCredentials(t *testing.T) { Email: "foo@example.com", ServerAddress: invalidServerAddress, }) - testutil.ErrorContains(t, err, "program failed") + assert.ErrorContains(t, err, "program failed") assert.Check(t, is.Len(f.GetAuthConfigs(), 0)) } @@ -243,7 +242,7 @@ func TestNativeStoreGetInvalidAddress(t *testing.T) { fileStore: NewFileStore(f), } _, err := s.Get(invalidServerAddress) - testutil.ErrorContains(t, err, "program failed") + assert.ErrorContains(t, err, "program failed") } func TestNativeStoreErase(t *testing.T) { @@ -274,5 +273,5 @@ func TestNativeStoreEraseInvalidAddress(t *testing.T) { fileStore: NewFileStore(f), } err := s.Erase(invalidServerAddress) - testutil.ErrorContains(t, err, "program failed") + assert.ErrorContains(t, err, "program failed") } diff --git a/internal/test/testutil/assert.go b/internal/test/testutil/assert.go deleted file mode 100644 index cc7cc886d5..0000000000 --- a/internal/test/testutil/assert.go +++ /dev/null @@ -1,19 +0,0 @@ -package testutil - -import ( - "github.com/gotestyourself/gotestyourself/assert" -) - -type helperT interface { - Helper() -} - -// ErrorContains checks that the error is not nil, and contains the expected -// substring. -// Deprecated: use assert.Assert(t, cmp.ErrorContains(err, expected)) -func ErrorContains(t assert.TestingT, err error, expectedError string) { - if ht, ok := t.(helperT); ok { - ht.Helper() - } - assert.ErrorContains(t, err, expectedError) -} diff --git a/opts/mount_test.go b/opts/mount_test.go index ff9435380d..2262e33713 100644 --- a/opts/mount_test.go +++ b/opts/mount_test.go @@ -4,7 +4,6 @@ import ( "os" "testing" - "github.com/docker/cli/internal/test/testutil" mounttypes "github.com/docker/docker/api/types/mount" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -151,8 +150,8 @@ func TestMountOptVolumeNoCopy(t *testing.T) { func TestMountOptTypeConflict(t *testing.T) { var m MountOpt - testutil.ErrorContains(t, m.Set("type=bind,target=/foo,source=/foo,volume-nocopy=true"), "cannot mix") - testutil.ErrorContains(t, m.Set("type=volume,target=/foo,source=/foo,bind-propagation=rprivate"), "cannot mix") + assert.ErrorContains(t, m.Set("type=bind,target=/foo,source=/foo,volume-nocopy=true"), "cannot mix") + assert.ErrorContains(t, m.Set("type=volume,target=/foo,source=/foo,bind-propagation=rprivate"), "cannot mix") } func TestMountOptSetTmpfsNoError(t *testing.T) { @@ -180,7 +179,7 @@ func TestMountOptSetTmpfsNoError(t *testing.T) { func TestMountOptSetTmpfsError(t *testing.T) { var m MountOpt - testutil.ErrorContains(t, m.Set("type=tmpfs,target=/foo,tmpfs-size=foo"), "invalid value for tmpfs-size") - testutil.ErrorContains(t, m.Set("type=tmpfs,target=/foo,tmpfs-mode=foo"), "invalid value for tmpfs-mode") - testutil.ErrorContains(t, m.Set("type=tmpfs"), "target is required") + assert.ErrorContains(t, m.Set("type=tmpfs,target=/foo,tmpfs-size=foo"), "invalid value for tmpfs-size") + assert.ErrorContains(t, m.Set("type=tmpfs,target=/foo,tmpfs-mode=foo"), "invalid value for tmpfs-mode") + assert.ErrorContains(t, m.Set("type=tmpfs"), "target is required") } diff --git a/opts/network_test.go b/opts/network_test.go index 18857448fc..639bf05e87 100644 --- a/opts/network_test.go +++ b/opts/network_test.go @@ -3,7 +3,6 @@ package opts import ( "testing" - "github.com/docker/cli/internal/test/testutil" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" ) @@ -96,6 +95,6 @@ func TestNetworkOptInvalidSyntax(t *testing.T) { } for _, tc := range testCases { var network NetworkOpt - testutil.ErrorContains(t, network.Set(tc.value), tc.expectedError) + assert.ErrorContains(t, network.Set(tc.value), tc.expectedError) } } diff --git a/opts/port_test.go b/opts/port_test.go index ded63c3182..fc7506fdaa 100644 --- a/opts/port_test.go +++ b/opts/port_test.go @@ -3,7 +3,6 @@ package opts import ( "testing" - "github.com/docker/cli/internal/test/testutil" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" @@ -243,7 +242,7 @@ func TestPortOptInvalidComplexSyntax(t *testing.T) { } for _, tc := range testCases { var port PortOpt - testutil.ErrorContains(t, port.Set(tc.value), tc.expectedError) + assert.ErrorContains(t, port.Set(tc.value), tc.expectedError) } }