diff --git a/cli/command/bundlefile/bundlefile_test.go b/cli/command/bundlefile/bundlefile_test.go index 7b3f9bad7b..8837aa1a27 100644 --- a/cli/command/bundlefile/bundlefile_test.go +++ b/cli/command/bundlefile/bundlefile_test.go @@ -38,7 +38,7 @@ func TestLoadFileSyntaxError(t *testing.T) { }`) _, err := LoadFile(reader) - assert.Check(t, is.Error(err, "JSON syntax error at byte 37: invalid character 'u' looking for beginning of value")) + assert.Error(t, err, "JSON syntax error at byte 37: invalid character 'u' looking for beginning of value") } func TestLoadFileTypeError(t *testing.T) { @@ -53,7 +53,7 @@ func TestLoadFileTypeError(t *testing.T) { }`) _, err := LoadFile(reader) - assert.Check(t, is.Error(err, "Unexpected type at byte 94. Expected []string but received string.")) + assert.Error(t, err, "Unexpected type at byte 94. Expected []string but received string.") } func TestPrint(t *testing.T) { diff --git a/cli/command/config/remove_test.go b/cli/command/config/remove_test.go index 2808f878c2..6501210dcf 100644 --- a/cli/command/config/remove_test.go +++ b/cli/command/config/remove_test.go @@ -74,6 +74,6 @@ func TestConfigRemoveContinueAfterError(t *testing.T) { cmd := newConfigRemoveCommand(cli) cmd.SetArgs(names) cmd.SetOutput(ioutil.Discard) - assert.Check(t, is.Error(cmd.Execute(), "error removing config: foo")) + assert.Error(t, cmd.Execute(), "error removing config: foo") assert.Check(t, is.DeepEqual(names, removedConfigs)) } diff --git a/cli/command/container/attach_test.go b/cli/command/container/attach_test.go index 6c021f1b43..9f7831ca06 100644 --- a/cli/command/container/attach_test.go +++ b/cli/command/container/attach_test.go @@ -10,7 +10,6 @@ import ( "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" "github.com/pkg/errors" ) @@ -124,7 +123,7 @@ func TestGetExitStatus(t *testing.T) { if testcase.expectedError == nil { assert.NilError(t, err) } else { - assert.Check(t, is.Error(err, testcase.expectedError.Error())) + assert.Error(t, err, testcase.expectedError.Error()) } } } diff --git a/cli/command/container/cp_test.go b/cli/command/container/cp_test.go index ba45a073a3..78fb3e237f 100644 --- a/cli/command/container/cp_test.go +++ b/cli/command/container/cp_test.go @@ -43,7 +43,7 @@ func TestRunCopyWithInvalidArguments(t *testing.T) { for _, testcase := range testcases { t.Run(testcase.doc, func(t *testing.T) { err := runCopy(test.NewFakeCli(nil), testcase.options) - assert.Check(t, is.Error(err, testcase.expectedErr)) + assert.Error(t, err, testcase.expectedErr) }) } } diff --git a/cli/command/formatter/container_test.go b/cli/command/formatter/container_test.go index abe29f21f0..8b1893f8d5 100644 --- a/cli/command/formatter/container_test.go +++ b/cli/command/formatter/container_test.go @@ -244,7 +244,7 @@ size: 0B testcase.context.Output = out err := ContainerWrite(testcase.context, containers) if err != nil { - assert.Check(t, is.Error(err, testcase.expected)) + assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } diff --git a/cli/command/formatter/diff_test.go b/cli/command/formatter/diff_test.go index 2caf9447a5..c1f6650beb 100644 --- a/cli/command/formatter/diff_test.go +++ b/cli/command/formatter/diff_test.go @@ -52,7 +52,7 @@ D: /usr/app/old_app.js testcase.context.Output = out err := DiffWrite(testcase.context, diffs) if err != nil { - assert.Check(t, is.Error(err, testcase.expected)) + assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } diff --git a/cli/command/formatter/image_test.go b/cli/command/formatter/image_test.go index a514eb7dde..26488f335a 100644 --- a/cli/command/formatter/image_test.go +++ b/cli/command/formatter/image_test.go @@ -294,7 +294,7 @@ image_id: imageID3 testcase.context.Output = out err := ImageWrite(testcase.context, images) if err != nil { - assert.Check(t, is.Error(err, testcase.expected)) + assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } diff --git a/cli/command/formatter/network_test.go b/cli/command/formatter/network_test.go index 1cc6284615..79b5880543 100644 --- a/cli/command/formatter/network_test.go +++ b/cli/command/formatter/network_test.go @@ -162,7 +162,7 @@ foobar_bar 2017-01-01 00:00:00 +0000 UTC testcase.context.Output = out err := NetworkWrite(testcase.context, networks) if err != nil { - assert.Check(t, is.Error(err, testcase.expected)) + assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } diff --git a/cli/command/formatter/node_test.go b/cli/command/formatter/node_test.go index c8bb7a34bd..3fa9ceb785 100644 --- a/cli/command/formatter/node_test.go +++ b/cli/command/formatter/node_test.go @@ -203,7 +203,7 @@ foobar_boo Unknown testcase.context.Output = out err := NodeWrite(testcase.context, nodes, types.Info{Swarm: swarm.Info{Cluster: &testcase.clusterInfo}}) if err != nil { - assert.Check(t, is.Error(err, testcase.expected)) + assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } diff --git a/cli/command/formatter/plugin_test.go b/cli/command/formatter/plugin_test.go index aa4062bae0..ebe615dd13 100644 --- a/cli/command/formatter/plugin_test.go +++ b/cli/command/formatter/plugin_test.go @@ -132,7 +132,7 @@ foobar_bar testcase.context.Output = out err := PluginWrite(testcase.context, plugins) if err != nil { - assert.Check(t, is.Error(err, testcase.expected)) + assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } diff --git a/cli/command/formatter/secret_test.go b/cli/command/formatter/secret_test.go index c58a20b0f4..e62793d3b1 100644 --- a/cli/command/formatter/secret_test.go +++ b/cli/command/formatter/secret_test.go @@ -56,7 +56,7 @@ id_rsa out := bytes.NewBufferString("") testcase.context.Output = out if err := SecretWrite(testcase.context, secrets); err != nil { - assert.Check(t, is.Error(err, testcase.expected)) + assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } diff --git a/cli/command/formatter/service_test.go b/cli/command/formatter/service_test.go index f37459100f..11c00c4b01 100644 --- a/cli/command/formatter/service_test.go +++ b/cli/command/formatter/service_test.go @@ -126,7 +126,7 @@ bar testcase.context.Output = out err := ServiceListWrite(testcase.context, services, info) if err != nil { - assert.Check(t, is.Error(err, testcase.expected)) + assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } diff --git a/cli/command/formatter/stats_test.go b/cli/command/formatter/stats_test.go index a2d023a912..6c88fe8771 100644 --- a/cli/command/formatter/stats_test.go +++ b/cli/command/formatter/stats_test.go @@ -117,7 +117,7 @@ container2 -- te.context.Output = &out err := ContainerStatsWrite(te.context, stats, "linux", false) if err != nil { - assert.Check(t, is.Error(err, te.expected)) + assert.Error(t, err, te.expected) } else { assert.Check(t, is.Equal(te.expected, out.String())) } @@ -183,7 +183,7 @@ container2 -- -- te.context.Output = &out err := ContainerStatsWrite(te.context, stats, "windows", false) if err != nil { - assert.Check(t, is.Error(err, te.expected)) + assert.Error(t, err, te.expected) } else { assert.Check(t, is.Equal(te.expected, out.String())) } diff --git a/cli/command/formatter/task_test.go b/cli/command/formatter/task_test.go index b7d42d2546..9dc8a18bb8 100644 --- a/cli/command/formatter/task_test.go +++ b/cli/command/formatter/task_test.go @@ -75,7 +75,7 @@ foobar_bar foo2 testcase.context.Output = out err := TaskWrite(testcase.context, tasks, names, nodes) if err != nil { - assert.Check(t, is.Error(err, testcase.expected)) + assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } diff --git a/cli/command/formatter/trust_test.go b/cli/command/formatter/trust_test.go index f28fd94300..4f97996a7c 100644 --- a/cli/command/formatter/trust_test.go +++ b/cli/command/formatter/trust_test.go @@ -127,7 +127,7 @@ tag3 bbbbbbbb testcase.context.Output = out err := TrustTagWrite(testcase.context, signedTags) if err != nil { - assert.Check(t, is.Error(err, testcase.expected)) + assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } @@ -231,7 +231,7 @@ eve foobarbazquxquux, key31, key32 testcase.context.Output = out err := SignerInfoWrite(testcase.context, signerInfo) if err != nil { - assert.Check(t, is.Error(err, testcase.expected)) + assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } diff --git a/cli/command/formatter/volume_test.go b/cli/command/formatter/volume_test.go index cb876e1d31..425aaed12d 100644 --- a/cli/command/formatter/volume_test.go +++ b/cli/command/formatter/volume_test.go @@ -133,7 +133,7 @@ foobar_bar testcase.context.Output = out err := VolumeWrite(testcase.context, volumes) if err != nil { - assert.Check(t, is.Error(err, testcase.expected)) + assert.Error(t, err, testcase.expected) } else { assert.Check(t, is.Equal(testcase.expected, out.String())) } diff --git a/cli/command/idresolver/idresolver_test.go b/cli/command/idresolver/idresolver_test.go index 5550a9a4ed..0ef720a95c 100644 --- a/cli/command/idresolver/idresolver_test.go +++ b/cli/command/idresolver/idresolver_test.go @@ -22,7 +22,7 @@ func TestResolveError(t *testing.T) { idResolver := New(cli, false) _, err := idResolver.Resolve(context.Background(), struct{}{}, "nodeID") - assert.Check(t, is.Error(err, "unsupported type")) + assert.Error(t, err, "unsupported type") } func TestResolveWithNoResolveOption(t *testing.T) { diff --git a/cli/command/image/trust_test.go b/cli/command/image/trust_test.go index 85670b8518..9aaa60396f 100644 --- a/cli/command/image/trust_test.go +++ b/cli/command/image/trust_test.go @@ -9,7 +9,6 @@ import ( registrytypes "github.com/docker/docker/api/types/registry" "github.com/docker/docker/registry" "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" @@ -71,5 +70,5 @@ func TestAddTargetToAllSignableRolesError(t *testing.T) { assert.NilError(t, err) target := client.Target{} err = AddTargetToAllSignableRoles(notaryRepo, &target) - assert.Check(t, is.Error(err, "client is offline")) + assert.Error(t, err, "client is offline") } diff --git a/cli/command/manifest/create_test.go b/cli/command/manifest/create_test.go index d3c040e5fb..378aa86041 100644 --- a/cli/command/manifest/create_test.go +++ b/cli/command/manifest/create_test.go @@ -89,7 +89,7 @@ func TestManifestCreateRefuseAmend(t *testing.T) { cmd.SetArgs([]string{"example.com/list:v1", "example.com/alpine:3.0"}) cmd.SetOutput(ioutil.Discard) err = cmd.Execute() - assert.Check(t, is.Error(err, "refusing to amend an existing manifest list with no --amend flag")) + assert.Error(t, err, "refusing to amend an existing manifest list with no --amend flag") } // attempt to make a manifest list without valid images @@ -112,5 +112,5 @@ func TestManifestCreateNoManifest(t *testing.T) { cmd.SetArgs([]string{"example.com/list:v1", "example.com/alpine:3.0"}) cmd.SetOutput(ioutil.Discard) err := cmd.Execute() - assert.Check(t, is.Error(err, "No such image: example.com/alpine:3.0")) + assert.Error(t, err, "No such image: example.com/alpine:3.0") } diff --git a/cli/command/manifest/inspect_test.go b/cli/command/manifest/inspect_test.go index 0f879f3c9b..9ba503a80e 100644 --- a/cli/command/manifest/inspect_test.go +++ b/cli/command/manifest/inspect_test.go @@ -15,7 +15,7 @@ import ( "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/gotestyourself/gotestyourself/golden" - "github.com/opencontainers/go-digest" + digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" "golang.org/x/net/context" ) @@ -65,7 +65,7 @@ func TestInspectCommandLocalManifestNotFound(t *testing.T) { cmd.SetOutput(ioutil.Discard) cmd.SetArgs([]string{"example.com/list:v1", "example.com/alpine:3.0"}) err := cmd.Execute() - assert.Check(t, is.Error(err, "No such manifest: example.com/alpine:3.0")) + assert.Error(t, err, "No such manifest: example.com/alpine:3.0") } func TestInspectCommandNotFound(t *testing.T) { @@ -87,7 +87,7 @@ func TestInspectCommandNotFound(t *testing.T) { cmd.SetOutput(ioutil.Discard) cmd.SetArgs([]string{"example.com/alpine:3.0"}) err := cmd.Execute() - assert.Check(t, is.Error(err, "No such manifest: example.com/alpine:3.0")) + assert.Error(t, err, "No such manifest: example.com/alpine:3.0") } func TestInspectCommandLocalManifest(t *testing.T) { diff --git a/cli/command/node/list_test.go b/cli/command/node/list_test.go index dc4790eab0..2d56af8377 100644 --- a/cli/command/node/list_test.go +++ b/cli/command/node/list_test.go @@ -49,7 +49,7 @@ func TestNodeListErrorOnAPIFailure(t *testing.T) { }) cmd := newListCommand(cli) cmd.SetOutput(ioutil.Discard) - assert.Check(t, is.Error(cmd.Execute(), tc.expectedError)) + assert.Error(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/node/ps_test.go b/cli/command/node/ps_test.go index 49b5391a2c..2a8533fb08 100644 --- a/cli/command/node/ps_test.go +++ b/cli/command/node/ps_test.go @@ -13,7 +13,6 @@ import ( // 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" ) @@ -61,7 +60,7 @@ func TestNodePsErrors(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - assert.Check(t, is.Error(cmd.Execute(), tc.expectedError)) + assert.Error(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/secret/remove_test.go b/cli/command/secret/remove_test.go index cf37ed2f86..349f47b387 100644 --- a/cli/command/secret/remove_test.go +++ b/cli/command/secret/remove_test.go @@ -74,6 +74,6 @@ func TestSecretRemoveContinueAfterError(t *testing.T) { cmd := newSecretRemoveCommand(cli) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(names) - assert.Check(t, is.Error(cmd.Execute(), "error removing secret: foo")) + assert.Error(t, cmd.Execute(), "error removing secret: foo") assert.Check(t, is.DeepEqual(names, removedSecrets)) } diff --git a/cli/command/service/opts_test.go b/cli/command/service/opts_test.go index 34d19554c2..a84072382b 100644 --- a/cli/command/service/opts_test.go +++ b/cli/command/service/opts_test.go @@ -88,7 +88,7 @@ func TestHealthCheckOptionsToHealthConfigConflict(t *testing.T) { noHealthcheck: true, } _, err := opt.toHealthConfig() - assert.Check(t, is.Error(err, "--no-healthcheck conflicts with --health-* options")) + assert.Error(t, err, "--no-healthcheck conflicts with --health-* options") } func TestResourceOptionsToResourceRequirements(t *testing.T) { diff --git a/cli/command/service/ps_test.go b/cli/command/service/ps_test.go index 0f50edc0d0..bb66849f55 100644 --- a/cli/command/service/ps_test.go +++ b/cli/command/service/ps_test.go @@ -60,7 +60,7 @@ func TestCreateFilterWithAmbiguousIDPrefixError(t *testing.T) { filter: opts.NewFilterOpt(), } _, _, err := createFilter(context.Background(), client, options) - assert.Check(t, is.Error(err, "multiple services found with provided prefix: aaa")) + assert.Error(t, err, "multiple services found with provided prefix: aaa") } func TestCreateFilterNoneFound(t *testing.T) { @@ -70,7 +70,7 @@ func TestCreateFilterNoneFound(t *testing.T) { filter: opts.NewFilterOpt(), } _, _, err := createFilter(context.Background(), client, options) - assert.Check(t, is.Error(err, "no such service: foo\nno such service: notfound")) + assert.Error(t, err, "no such service: foo\nno such service: notfound") } func TestRunPSWarnsOnNotFound(t *testing.T) { @@ -89,7 +89,7 @@ func TestRunPSWarnsOnNotFound(t *testing.T) { format: "{{.ID}}", } err := runPS(cli, options) - assert.Check(t, is.Error(err, "no such service: bar")) + assert.Error(t, err, "no such service: bar") } func TestRunPSQuiet(t *testing.T) { diff --git a/cli/command/service/update_test.go b/cli/command/service/update_test.go index 863d612a48..d647093254 100644 --- a/cli/command/service/update_test.go +++ b/cli/command/service/update_test.go @@ -344,7 +344,7 @@ func TestUpdateHealthcheckTable(t *testing.T) { } err := updateHealthcheck(flags, cspec) if c.err != "" { - assert.Check(t, is.Error(err, c.err)) + assert.Error(t, err, c.err) } else { assert.NilError(t, err) if !reflect.DeepEqual(cspec.Healthcheck, c.expected) { @@ -626,14 +626,14 @@ func TestUpdateNetworks(t *testing.T) { err = flags.Set(flagNetworkAdd, "aaa-network") assert.NilError(t, err) err = updateService(ctx, client, flags, &svc) - assert.Check(t, is.Error(err, "service is already attached to network aaa-network")) + assert.Error(t, err, "service is already attached to network aaa-network") assert.Check(t, is.DeepEqual([]swarm.NetworkAttachmentConfig{{Target: "id555"}, {Target: "id999"}}, svc.TaskTemplate.Networks)) flags = newUpdateCommand(nil).Flags() err = flags.Set(flagNetworkAdd, "id555") assert.NilError(t, err) err = updateService(ctx, client, flags, &svc) - assert.Check(t, is.Error(err, "service is already attached to network id555")) + assert.Error(t, err, "service is already attached to network id555") assert.Check(t, is.DeepEqual([]swarm.NetworkAttachmentConfig{{Target: "id555"}, {Target: "id999"}}, svc.TaskTemplate.Networks)) flags = newUpdateCommand(nil).Flags() diff --git a/cli/command/stack/ps_test.go b/cli/command/stack/ps_test.go index 2f33f16078..b3cce8d58a 100644 --- a/cli/command/stack/ps_test.go +++ b/cli/command/stack/ps_test.go @@ -61,7 +61,7 @@ func TestStackPsEmptyStack(t *testing.T) { cmd.SetArgs([]string{"foo"}) cmd.SetOutput(ioutil.Discard) - assert.Check(t, is.Error(cmd.Execute(), "nothing found in stack: foo")) + assert.Error(t, cmd.Execute(), "nothing found in stack: foo") assert.Check(t, is.Equal("", fakeCli.OutBuffer().String())) } diff --git a/cli/command/stack/remove_test.go b/cli/command/stack/remove_test.go index 72daf15f0b..5f27a9b32a 100644 --- a/cli/command/stack/remove_test.go +++ b/cli/command/stack/remove_test.go @@ -150,7 +150,7 @@ func TestRemoveContinueAfterError(t *testing.T) { cmd.SetOutput(ioutil.Discard) cmd.SetArgs([]string{"foo", "bar"}) - assert.Check(t, is.Error(cmd.Execute(), "Failed to remove some resources from stack: foo")) + assert.Error(t, cmd.Execute(), "Failed to remove some resources from stack: foo") assert.Check(t, is.DeepEqual(allServiceIDs, removedServices)) assert.Check(t, is.DeepEqual(allNetworkIDs, cli.removedNetworks)) assert.Check(t, is.DeepEqual(allSecretIDs, cli.removedSecrets)) diff --git a/cli/command/swarm/ca_test.go b/cli/command/swarm/ca_test.go index 37e18655a9..d11739ec37 100644 --- a/cli/command/swarm/ca_test.go +++ b/cli/command/swarm/ca_test.go @@ -34,7 +34,7 @@ func swarmSpecWithFullCAConfig() *swarm.Spec { func TestDisplayTrustRootNoRoot(t *testing.T) { buffer := new(bytes.Buffer) err := displayTrustRoot(buffer, swarm.Swarm{}) - assert.Check(t, is.Error(err, "No CA information available")) + assert.Error(t, err, "No CA information available") } func TestDisplayTrustRootInvalidFlags(t *testing.T) { diff --git a/cli/command/swarm/init_test.go b/cli/command/swarm/init_test.go index 68435819ff..22712726ca 100644 --- a/cli/command/swarm/init_test.go +++ b/cli/command/swarm/init_test.go @@ -9,7 +9,6 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" "github.com/gotestyourself/gotestyourself/golden" "github.com/pkg/errors" ) @@ -75,7 +74,7 @@ func TestSwarmInitErrorOnAPIFailure(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) - assert.Check(t, is.Error(cmd.Execute(), tc.expectedError)) + assert.Error(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/swarm/opts_test.go b/cli/command/swarm/opts_test.go index da8a89ca1d..6aa12b89c4 100644 --- a/cli/command/swarm/opts_test.go +++ b/cli/command/swarm/opts_test.go @@ -34,7 +34,7 @@ func TestNodeAddrOptionSetPortOnly(t *testing.T) { func TestNodeAddrOptionSetInvalidFormat(t *testing.T) { opt := NewListenAddrOption() - assert.Check(t, is.Error(opt.Set("http://localhost:4545"), "Invalid proto, expected tcp: http://localhost:4545")) + assert.Error(t, opt.Set("http://localhost:4545"), "Invalid proto, expected tcp: http://localhost:4545") } func TestExternalCAOptionErrors(t *testing.T) { @@ -65,7 +65,7 @@ func TestExternalCAOptionErrors(t *testing.T) { } for _, tc := range testCases { opt := &ExternalCAOption{} - assert.Check(t, is.Error(opt.Set(tc.externalCA), tc.expectedError)) + assert.Error(t, opt.Set(tc.externalCA), tc.expectedError) } } diff --git a/cli/command/trust/helpers_test.go b/cli/command/trust/helpers_test.go index ba70df6e39..216ae5ce9d 100644 --- a/cli/command/trust/helpers_test.go +++ b/cli/command/trust/helpers_test.go @@ -6,7 +6,6 @@ import ( "testing" "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" @@ -21,5 +20,5 @@ func TestGetOrGenerateNotaryKeyAndInitRepo(t *testing.T) { assert.NilError(t, err) err = getOrGenerateRootKeyAndInitRepo(notaryRepo) - assert.Check(t, is.Error(err, "client is offline")) + assert.Error(t, err, "client is offline") } diff --git a/cli/command/trust/revoke_test.go b/cli/command/trust/revoke_test.go index fcf4a989a5..adc20f5074 100644 --- a/cli/command/trust/revoke_test.go +++ b/cli/command/trust/revoke_test.go @@ -143,5 +143,5 @@ func TestGetSignableRolesForTargetAndRemoveError(t *testing.T) { assert.NilError(t, err) target := client.Target{} err = getSignableRolesForTargetAndRemove(target, notaryRepo) - assert.Check(t, is.Error(err, "client is offline")) + assert.Error(t, err, "client is offline") } diff --git a/cli/command/trust/sign_test.go b/cli/command/trust/sign_test.go index 514abf2869..523b2792e4 100644 --- a/cli/command/trust/sign_test.go +++ b/cli/command/trust/sign_test.go @@ -220,7 +220,7 @@ func TestGetSignedManifestHashAndSize(t *testing.T) { assert.NilError(t, err) target := &client.Target{} target.Hashes, target.Length, err = getSignedManifestHashAndSize(notaryRepo, "test") - assert.Check(t, is.Error(err, "client is offline")) + assert.Error(t, err, "client is offline") } func TestGetReleasedTargetHashAndSize(t *testing.T) { @@ -231,7 +231,7 @@ func TestGetReleasedTargetHashAndSize(t *testing.T) { oneReleasedTgt = append(oneReleasedTgt, client.TargetSignedStruct{Role: mockDelegationRoleWithName(unreleasedRole), Target: unreleasedTgt}) } _, _, err := getReleasedTargetHashAndSize(oneReleasedTgt, "unreleased") - assert.Check(t, is.Error(err, "No valid trust data for unreleased")) + assert.Error(t, err, "No valid trust data for unreleased") releasedTgt := client.Target{Name: "released", Hashes: data.Hashes{notary.SHA256: []byte("released-hash")}} oneReleasedTgt = append(oneReleasedTgt, client.TargetSignedStruct{Role: mockDelegationRoleWithName("targets/releases"), Target: releasedTgt}) hash, _, _ := getReleasedTargetHashAndSize(oneReleasedTgt, "unreleased") @@ -247,9 +247,9 @@ func TestCreateTarget(t *testing.T) { notaryRepo, err := client.NewFileCachedRepository(tmpDir, "gun", "https://localhost", nil, passphrase.ConstantRetriever(passwd), trustpinning.TrustPinConfig{}) assert.NilError(t, err) _, err = createTarget(notaryRepo, "") - assert.Check(t, is.Error(err, "No tag specified")) + assert.Error(t, err, "No tag specified") _, err = createTarget(notaryRepo, "1") - assert.Check(t, is.Error(err, "client is offline")) + assert.Error(t, err, "client is offline") } func TestGetExistingSignatureInfoForReleasedTag(t *testing.T) { @@ -260,7 +260,7 @@ func TestGetExistingSignatureInfoForReleasedTag(t *testing.T) { notaryRepo, err := client.NewFileCachedRepository(tmpDir, "gun", "https://localhost", nil, passphrase.ConstantRetriever(passwd), trustpinning.TrustPinConfig{}) assert.NilError(t, err) _, err = getExistingSignatureInfoForReleasedTag(notaryRepo, "test") - assert.Check(t, is.Error(err, "client is offline")) + assert.Error(t, err, "client is offline") } func TestPrettyPrintExistingSignatureInfo(t *testing.T) { diff --git a/cli/command/trust/signer_add_test.go b/cli/command/trust/signer_add_test.go index 0d4f879d01..d2e1e21481 100644 --- a/cli/command/trust/signer_add_test.go +++ b/cli/command/trust/signer_add_test.go @@ -81,7 +81,7 @@ func TestSignerAddCommandNoTargetsKey(t *testing.T) { cmd.SetArgs([]string{"--key", tmpfile.Name(), "alice", "alpine", "linuxkit/alpine"}) cmd.SetOutput(ioutil.Discard) - assert.Check(t, is.Error(cmd.Execute(), fmt.Sprintf("could not parse public key from file: %s: no valid public key found", tmpfile.Name()))) + assert.Error(t, cmd.Execute(), fmt.Sprintf("could not parse public key from file: %s: no valid public key found", tmpfile.Name())) } func TestSignerAddCommandBadKeyPath(t *testing.T) { @@ -96,7 +96,7 @@ func TestSignerAddCommandBadKeyPath(t *testing.T) { cmd.SetArgs([]string{"--key", "/path/to/key.pem", "alice", "alpine"}) cmd.SetOutput(ioutil.Discard) - assert.Check(t, is.Error(cmd.Execute(), "unable to read public key from file: open /path/to/key.pem: no such file or directory")) + assert.Error(t, cmd.Execute(), "unable to read public key from file: open /path/to/key.pem: no such file or directory") } func TestSignerAddCommandInvalidRepoName(t *testing.T) { @@ -118,7 +118,7 @@ func TestSignerAddCommandInvalidRepoName(t *testing.T) { cmd.SetArgs([]string{"--key", pubKeyFilepath, "alice", imageName}) cmd.SetOutput(ioutil.Discard) - assert.Check(t, is.Error(cmd.Execute(), "Failed to add signer to: 870d292919d01a0af7e7f056271dc78792c05f55f49b9b9012b6d89725bd9abd")) + assert.Error(t, cmd.Execute(), "Failed to add signer to: 870d292919d01a0af7e7f056271dc78792c05f55f49b9b9012b6d89725bd9abd") expectedErr := fmt.Sprintf("invalid repository name (%s), cannot specify 64-byte hexadecimal strings\n\n", imageName) assert.Check(t, is.Equal(expectedErr, cli.ErrBuffer().String())) @@ -127,11 +127,11 @@ func TestSignerAddCommandInvalidRepoName(t *testing.T) { func TestIngestPublicKeys(t *testing.T) { // Call with a bad path _, err := ingestPublicKeys([]string{"foo", "bar"}) - assert.Check(t, is.Error(err, "unable to read public key from file: open foo: no such file or directory")) + assert.Error(t, err, "unable to read public key from file: open foo: no such file or directory") // Call with real file path tmpfile, err := ioutil.TempFile("", "pemfile") assert.NilError(t, err) defer os.Remove(tmpfile.Name()) _, err = ingestPublicKeys([]string{tmpfile.Name()}) - assert.Check(t, is.Error(err, fmt.Sprintf("could not parse public key from file: %s: no valid public key found", tmpfile.Name()))) + assert.Error(t, err, fmt.Sprintf("could not parse public key from file: %s: no valid public key found", tmpfile.Name())) } diff --git a/cli/command/trust/signer_remove_test.go b/cli/command/trust/signer_remove_test.go index d283d650a8..660d7264b5 100644 --- a/cli/command/trust/signer_remove_test.go +++ b/cli/command/trust/signer_remove_test.go @@ -71,16 +71,16 @@ func TestRemoveSingleSigner(t *testing.T) { cli := test.NewFakeCli(&fakeClient{}) cli.SetNotaryClient(getLoadedNotaryRepository) err := removeSingleSigner(cli, "signed-repo", "test", true) - assert.Check(t, is.Error(err, "No signer test for repository signed-repo")) + assert.Error(t, err, "No signer test for repository signed-repo") err = removeSingleSigner(cli, "signed-repo", "releases", true) - assert.Check(t, is.Error(err, "releases is a reserved keyword and cannot be removed")) + assert.Error(t, err, "releases is a reserved keyword and cannot be removed") } func TestRemoveMultipleSigners(t *testing.T) { cli := test.NewFakeCli(&fakeClient{}) cli.SetNotaryClient(getLoadedNotaryRepository) err := removeSigner(cli, signerRemoveOptions{signer: "test", repos: []string{"signed-repo", "signed-repo"}, forceYes: true}) - assert.Check(t, is.Error(err, "Error removing signer from: signed-repo, signed-repo")) + assert.Error(t, err, "Error removing signer from: signed-repo, signed-repo") assert.Check(t, is.Contains(cli.ErrBuffer().String(), "No signer test for repository signed-repo")) assert.Check(t, is.Contains(cli.OutBuffer().String(), "Removing signer \"test\" from signed-repo...\n")) diff --git a/cli/compose/convert/service_test.go b/cli/compose/convert/service_test.go index b4de57a25d..044b4e3e30 100644 --- a/cli/compose/convert/service_test.go +++ b/cli/compose/convert/service_test.go @@ -26,7 +26,7 @@ func TestConvertRestartPolicyFromNone(t *testing.T) { func TestConvertRestartPolicyFromUnknown(t *testing.T) { _, err := convertRestartPolicy("unknown", nil) - assert.Check(t, is.Error(err, "unknown restart policy: unknown")) + assert.Error(t, err, "unknown restart policy: unknown") } func TestConvertRestartPolicyFromAlways(t *testing.T) { @@ -161,7 +161,7 @@ func TestConvertHealthcheckDisableWithTest(t *testing.T) { Test: []string{"EXEC", "touch"}, } _, err := convertHealthcheck(source) - assert.Check(t, is.Error(err, "test and disable can't be set at the same time")) + assert.Error(t, err, "test and disable can't be set at the same time") } func TestConvertEndpointSpec(t *testing.T) { diff --git a/cli/compose/convert/volume_test.go b/cli/compose/convert/volume_test.go index 13e910fde5..d7d45eedf5 100644 --- a/cli/compose/convert/volume_test.go +++ b/cli/compose/convert/volume_test.go @@ -32,7 +32,7 @@ func TestConvertVolumeToMountAnonymousBind(t *testing.T) { }, } _, err := convertVolumeToMount(config, volumes{}, NewNamespace("foo")) - assert.Check(t, is.Error(err, "invalid bind source, source cannot be empty")) + assert.Error(t, err, "invalid bind source, source cannot be empty") } func TestConvertVolumeToMountUnapprovedType(t *testing.T) { @@ -41,7 +41,7 @@ func TestConvertVolumeToMountUnapprovedType(t *testing.T) { Target: "/foo/bar", } _, err := convertVolumeToMount(config, volumes{}, NewNamespace("foo")) - assert.Check(t, is.Error(err, "volume type must be volume, bind, or tmpfs")) + assert.Error(t, err, "volume type must be volume, bind, or tmpfs") } func TestConvertVolumeToMountConflictingOptionsBindInVolume(t *testing.T) { @@ -56,7 +56,7 @@ func TestConvertVolumeToMountConflictingOptionsBindInVolume(t *testing.T) { }, } _, err := convertVolumeToMount(config, volumes{}, namespace) - assert.Check(t, is.Error(err, "bind options are incompatible with type volume")) + assert.Error(t, err, "bind options are incompatible with type volume") } func TestConvertVolumeToMountConflictingOptionsTmpfsInVolume(t *testing.T) { @@ -71,7 +71,7 @@ func TestConvertVolumeToMountConflictingOptionsTmpfsInVolume(t *testing.T) { }, } _, err := convertVolumeToMount(config, volumes{}, namespace) - assert.Check(t, is.Error(err, "tmpfs options are incompatible with type volume")) + assert.Error(t, err, "tmpfs options are incompatible with type volume") } func TestConvertVolumeToMountConflictingOptionsVolumeInBind(t *testing.T) { @@ -86,7 +86,7 @@ func TestConvertVolumeToMountConflictingOptionsVolumeInBind(t *testing.T) { }, } _, err := convertVolumeToMount(config, volumes{}, namespace) - assert.Check(t, is.Error(err, "volume options are incompatible with type bind")) + assert.Error(t, err, "volume options are incompatible with type bind") } func TestConvertVolumeToMountConflictingOptionsTmpfsInBind(t *testing.T) { @@ -101,7 +101,7 @@ func TestConvertVolumeToMountConflictingOptionsTmpfsInBind(t *testing.T) { }, } _, err := convertVolumeToMount(config, volumes{}, namespace) - assert.Check(t, is.Error(err, "tmpfs options are incompatible with type bind")) + assert.Error(t, err, "tmpfs options are incompatible with type bind") } func TestConvertVolumeToMountConflictingOptionsBindInTmpfs(t *testing.T) { @@ -115,7 +115,7 @@ func TestConvertVolumeToMountConflictingOptionsBindInTmpfs(t *testing.T) { }, } _, err := convertVolumeToMount(config, volumes{}, namespace) - assert.Check(t, is.Error(err, "bind options are incompatible with type tmpfs")) + assert.Error(t, err, "bind options are incompatible with type tmpfs") } func TestConvertVolumeToMountConflictingOptionsVolumeInTmpfs(t *testing.T) { @@ -129,7 +129,7 @@ func TestConvertVolumeToMountConflictingOptionsVolumeInTmpfs(t *testing.T) { }, } _, err := convertVolumeToMount(config, volumes{}, namespace) - assert.Check(t, is.Error(err, "volume options are incompatible with type tmpfs")) + assert.Error(t, err, "volume options are incompatible with type tmpfs") } func TestConvertVolumeToMountNamedVolume(t *testing.T) { @@ -309,7 +309,7 @@ func TestConvertVolumeToMountVolumeDoesNotExist(t *testing.T) { ReadOnly: true, } _, err := convertVolumeToMount(config, volumes{}, namespace) - assert.Check(t, is.Error(err, "undefined volume \"unknown\"")) + assert.Error(t, err, "undefined volume \"unknown\"") } func TestConvertTmpfsToMountVolume(t *testing.T) { @@ -341,5 +341,5 @@ func TestConvertTmpfsToMountVolumeWithSource(t *testing.T) { } _, err := convertVolumeToMount(config, volumes{}, NewNamespace("foo")) - assert.Check(t, is.Error(err, "invalid tmpfs source, source must be empty")) + assert.Error(t, err, "invalid tmpfs source, source must be empty") } diff --git a/cli/compose/interpolation/interpolation_test.go b/cli/compose/interpolation/interpolation_test.go index ca3d5f4993..42ea55ff1f 100644 --- a/cli/compose/interpolation/interpolation_test.go +++ b/cli/compose/interpolation/interpolation_test.go @@ -58,7 +58,7 @@ func TestInvalidInterpolation(t *testing.T) { }, } _, err := Interpolate(services, Options{LookupValue: defaultMapping}) - assert.Check(t, is.Error(err, `invalid interpolation format for servicea.image: "${". You may need to escape any $ with another $.`)) + assert.Error(t, err, `invalid interpolation format for servicea.image: "${". You may need to escape any $ with another $.`) } func TestInterpolateWithDefaults(t *testing.T) { diff --git a/cli/compose/loader/volume_test.go b/cli/compose/loader/volume_test.go index 636696af8a..5e96b0aeff 100644 --- a/cli/compose/loader/volume_test.go +++ b/cli/compose/loader/volume_test.go @@ -29,7 +29,7 @@ func TestParseVolumeAnonymousVolumeWindows(t *testing.T) { func TestParseVolumeTooManyColons(t *testing.T) { _, err := ParseVolume("/foo:/foo:ro:foo") - assert.Check(t, is.Error(err, "invalid spec: /foo:/foo:ro:foo: too many colons")) + assert.Error(t, err, "invalid spec: /foo:/foo:ro:foo: too many colons") } func TestParseVolumeShortVolumes(t *testing.T) { diff --git a/cli/manifest/store/store_test.go b/cli/manifest/store/store_test.go index bd3ba419a7..669b81e7c5 100644 --- a/cli/manifest/store/store_test.go +++ b/cli/manifest/store/store_test.go @@ -96,7 +96,7 @@ func TestStoreSaveAndGet(t *testing.T) { t.Run(testcase.manifestRef.String(), func(t *testing.T) { actual, err := store.Get(testcase.listRef, testcase.manifestRef) if testcase.expectedErr != "" { - assert.Check(t, is.Error(err, testcase.expectedErr)) + assert.Error(t, err, testcase.expectedErr) assert.Check(t, IsNotFound(err)) return } @@ -131,6 +131,6 @@ func TestStoreGetListDoesNotExist(t *testing.T) { listRef := ref("list") _, err := store.GetList(listRef) - assert.Check(t, is.Error(err, "No such manifest: list")) + assert.Error(t, err, "No such manifest: list") assert.Check(t, IsNotFound(err)) } diff --git a/cli/trust/trust_test.go b/cli/trust/trust_test.go index 9cb7f48af6..67e181ba20 100644 --- a/cli/trust/trust_test.go +++ b/cli/trust/trust_test.go @@ -57,5 +57,5 @@ func TestGetSignableRolesError(t *testing.T) { assert.NilError(t, err) target := client.Target{} _, err = GetSignableRoles(notaryRepo, &target) - assert.Check(t, is.Error(err, "client is offline")) + assert.Error(t, err, "client is offline") } diff --git a/cmd/docker/docker_test.go b/cmd/docker/docker_test.go index c0613bb1ae..22a157a8be 100644 --- a/cmd/docker/docker_test.go +++ b/cmd/docker/docker_test.go @@ -29,5 +29,5 @@ func TestExitStatusForInvalidSubcommandWithHelpFlag(t *testing.T) { cmd := newDockerCommand(command.NewDockerCli(os.Stdin, discard, discard)) cmd.SetArgs([]string{"help", "invalid"}) err := cmd.Execute() - assert.Check(t, is.Error(err, "unknown help topic: invalid")) + assert.Error(t, err, "unknown help topic: invalid") } diff --git a/opts/duration_test.go b/opts/duration_test.go index 0fa3b79ee0..937585d89e 100644 --- a/opts/duration_test.go +++ b/opts/duration_test.go @@ -26,5 +26,5 @@ func TestPositiveDurationOptSetAndValue(t *testing.T) { var duration PositiveDurationOpt assert.NilError(t, duration.Set("300s")) assert.Check(t, is.Equal(time.Duration(300*10e8), *duration.Value())) - assert.Check(t, is.Error(duration.Set("-300s"), "duration cannot be negative")) + assert.Error(t, duration.Set("-300s"), "duration cannot be negative") } diff --git a/opts/mount_test.go b/opts/mount_test.go index bddd4396f2..bf7b0f2012 100644 --- a/opts/mount_test.go +++ b/opts/mount_test.go @@ -82,23 +82,23 @@ func TestMountOptDefaultType(t *testing.T) { func TestMountOptSetErrorNoTarget(t *testing.T) { var mount MountOpt - assert.Check(t, is.Error(mount.Set("type=volume,source=/foo"), "target is required")) + assert.Error(t, mount.Set("type=volume,source=/foo"), "target is required") } func TestMountOptSetErrorInvalidKey(t *testing.T) { var mount MountOpt - assert.Check(t, is.Error(mount.Set("type=volume,bogus=foo"), "unexpected key 'bogus' in 'bogus=foo'")) + assert.Error(t, mount.Set("type=volume,bogus=foo"), "unexpected key 'bogus' in 'bogus=foo'") } func TestMountOptSetErrorInvalidField(t *testing.T) { var mount MountOpt - assert.Check(t, is.Error(mount.Set("type=volume,bogus"), "invalid field 'bogus' must be a key=value pair")) + assert.Error(t, mount.Set("type=volume,bogus"), "invalid field 'bogus' must be a key=value pair") } func TestMountOptSetErrorInvalidReadOnly(t *testing.T) { var mount MountOpt - assert.Check(t, is.Error(mount.Set("type=volume,readonly=no"), "invalid value for readonly: no")) - assert.Check(t, is.Error(mount.Set("type=volume,readonly=invalid"), "invalid value for readonly: invalid")) + assert.Error(t, mount.Set("type=volume,readonly=no"), "invalid value for readonly: no") + assert.Error(t, mount.Set("type=volume,readonly=invalid"), "invalid value for readonly: invalid") } func TestMountOptDefaultEnableReadOnly(t *testing.T) { diff --git a/opts/port_test.go b/opts/port_test.go index ae33fbff24..7f07a86cfe 100644 --- a/opts/port_test.go +++ b/opts/port_test.go @@ -278,7 +278,7 @@ func TestPortOptInvalidSimpleSyntax(t *testing.T) { } for _, tc := range testCases { var port PortOpt - assert.Check(t, is.Error(port.Set(tc.value), tc.expectedError)) + assert.Error(t, port.Set(tc.value), tc.expectedError) } } diff --git a/service/logs/parse_logs_test.go b/service/logs/parse_logs_test.go index e0aee51bd7..a8f612ce4a 100644 --- a/service/logs/parse_logs_test.go +++ b/service/logs/parse_logs_test.go @@ -25,7 +25,7 @@ func TestParseLogDetails(t *testing.T) { t.Run(testcase.line, func(t *testing.T) { actual, err := ParseLogDetails(testcase.line) if testcase.err != nil { - assert.Check(t, is.Error(err, testcase.err.Error())) + assert.Error(t, err, testcase.err.Error()) return } assert.Check(t, is.DeepEqual(testcase.expected, actual))