diff --git a/cli/command/checkpoint/create_test.go b/cli/command/checkpoint/create_test.go index a74c9922c0..59fdf9d108 100644 --- a/cli/command/checkpoint/create_test.go +++ b/cli/command/checkpoint/create_test.go @@ -63,7 +63,7 @@ func TestCheckpointCreateWithOptions(t *testing.T) { cmd.SetArgs([]string{"container-foo", checkpoint}) cmd.Flags().Set("leave-running", "true") cmd.Flags().Set("checkpoint-dir", "/dir/foo") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("container-foo", containerID)) assert.Check(t, is.Equal(checkpoint, checkpointID)) assert.Check(t, is.Equal("/dir/foo", checkpointDir)) diff --git a/cli/command/checkpoint/list_test.go b/cli/command/checkpoint/list_test.go index 5e67084479..2523bba566 100644 --- a/cli/command/checkpoint/list_test.go +++ b/cli/command/checkpoint/list_test.go @@ -60,7 +60,7 @@ func TestCheckpointListWithOptions(t *testing.T) { cmd := newListCommand(cli) cmd.SetArgs([]string{"container-foo"}) cmd.Flags().Set("checkpoint-dir", "/dir/foo") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("container-foo", containerID)) assert.Check(t, is.Equal("/dir/foo", checkpointDir)) golden.Assert(t, cli.OutBuffer().String(), "checkpoint-list-with-options.golden") diff --git a/cli/command/checkpoint/remove_test.go b/cli/command/checkpoint/remove_test.go index f73673608e..9816b2f16c 100644 --- a/cli/command/checkpoint/remove_test.go +++ b/cli/command/checkpoint/remove_test.go @@ -58,7 +58,7 @@ func TestCheckpointRemoveWithOptions(t *testing.T) { cmd := newRemoveCommand(cli) cmd.SetArgs([]string{"container-foo", "checkpoint-bar"}) cmd.Flags().Set("checkpoint-dir", "/dir/foo") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("container-foo", containerID)) assert.Check(t, is.Equal("checkpoint-bar", checkpointID)) assert.Check(t, is.Equal("/dir/foo", checkpointDir)) diff --git a/cli/command/config/create_test.go b/cli/command/config/create_test.go index 06617934c2..46515ca524 100644 --- a/cli/command/config/create_test.go +++ b/cli/command/config/create_test.go @@ -70,7 +70,7 @@ func TestConfigCreateWithName(t *testing.T) { cmd := newConfigCreateCommand(cli) cmd.SetArgs([]string{name, filepath.Join("testdata", configDataFile)}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, string(actual), configDataFile) assert.Check(t, is.Equal("ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))) } @@ -109,7 +109,7 @@ func TestConfigCreateWithLabels(t *testing.T) { cmd.SetArgs([]string{name, filepath.Join("testdata", configDataFile)}) cmd.Flags().Set("label", "lbl1=Label-foo") cmd.Flags().Set("label", "lbl2=Label-bar") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))) } @@ -138,6 +138,6 @@ func TestConfigCreateWithTemplatingDriver(t *testing.T) { cmd := newConfigCreateCommand(cli) cmd.SetArgs([]string{name, filepath.Join("testdata", configDataFile)}) cmd.Flags().Set("template-driver", expectedDriver.Name) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))) } diff --git a/cli/command/config/inspect_test.go b/cli/command/config/inspect_test.go index cd4535db3d..b714e95830 100644 --- a/cli/command/config/inspect_test.go +++ b/cli/command/config/inspect_test.go @@ -95,7 +95,7 @@ func TestConfigInspectWithoutFormat(t *testing.T) { cli := test.NewFakeCli(&fakeClient{configInspectFunc: tc.configInspectFunc}) cmd := newConfigInspectCommand(cli) cmd.SetArgs(tc.args) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("config-inspect-without-format.%s.golden", tc.name)) } } @@ -132,7 +132,7 @@ func TestConfigInspectWithFormat(t *testing.T) { cmd := newConfigInspectCommand(cli) cmd.SetArgs(tc.args) cmd.Flags().Set("format", tc.format) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("config-inspect-with-format.%s.golden", tc.name)) } } @@ -166,7 +166,7 @@ func TestConfigInspectPretty(t *testing.T) { cmd.SetArgs([]string{"configID"}) cmd.Flags().Set("pretty", "true") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("config-inspect-pretty.%s.golden", tc.name)) } } diff --git a/cli/command/config/ls_test.go b/cli/command/config/ls_test.go index 4eac2df705..3ef7a91783 100644 --- a/cli/command/config/ls_test.go +++ b/cli/command/config/ls_test.go @@ -72,7 +72,7 @@ func TestConfigList(t *testing.T) { }, }) cmd := newConfigListCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "config-list-sort.golden") } @@ -89,7 +89,7 @@ func TestConfigListWithQuietOption(t *testing.T) { }) cmd := newConfigListCommand(cli) cmd.Flags().Set("quiet", "true") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "config-list-with-quiet-option.golden") } @@ -108,7 +108,7 @@ func TestConfigListWithConfigFormat(t *testing.T) { ConfigFormat: "{{ .Name }} {{ .Labels }}", }) cmd := newConfigListCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "config-list-with-config-format.golden") } @@ -125,7 +125,7 @@ func TestConfigListWithFormat(t *testing.T) { }) cmd := newConfigListCommand(cli) cmd.Flags().Set("format", "{{ .Name }} {{ .Labels }}") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "config-list-with-format.golden") } @@ -153,6 +153,6 @@ func TestConfigListWithFilter(t *testing.T) { cmd := newConfigListCommand(cli) cmd.Flags().Set("filter", "name=foo") cmd.Flags().Set("filter", "label=lbl1=Label-bar") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "config-list-with-filter.golden") } diff --git a/cli/command/config/remove_test.go b/cli/command/config/remove_test.go index bf8e0dcdc4..2808f878c2 100644 --- a/cli/command/config/remove_test.go +++ b/cli/command/config/remove_test.go @@ -52,7 +52,7 @@ func TestConfigRemoveWithName(t *testing.T) { }) cmd := newConfigRemoveCommand(cli) cmd.SetArgs(names) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.DeepEqual(names, strings.Split(strings.TrimSpace(cli.OutBuffer().String()), "\n"))) assert.Check(t, is.DeepEqual(names, removedConfigs)) } diff --git a/cli/command/container/create_test.go b/cli/command/container/create_test.go index 32beaa06ab..aa20678eeb 100644 --- a/cli/command/container/create_test.go +++ b/cli/command/container/create_test.go @@ -25,8 +25,8 @@ func TestCIDFileNoOPWithNoFilename(t *testing.T) { assert.NilError(t, err) assert.DeepEqual(t, &cidFile{}, file, cmp.AllowUnexported(cidFile{})) - assert.Check(t, file.Write("id")) - assert.Check(t, file.Close()) + assert.NilError(t, file.Write("id")) + assert.NilError(t, file.Close()) } func TestNewCIDFileWhenFileAlreadyExists(t *testing.T) { @@ -46,7 +46,7 @@ func TestCIDFileCloseWithNoWrite(t *testing.T) { assert.NilError(t, err) assert.Check(t, is.Equal(file.path, path)) - assert.Check(t, file.Close()) + assert.NilError(t, file.Close()) _, err = os.Stat(path) assert.Check(t, os.IsNotExist(err)) } @@ -60,13 +60,13 @@ func TestCIDFileCloseWithWrite(t *testing.T) { assert.NilError(t, err) content := "id" - assert.Check(t, file.Write(content)) + assert.NilError(t, file.Write(content)) actual, err := ioutil.ReadFile(path) assert.NilError(t, err) assert.Check(t, is.Equal(content, string(actual))) - assert.Check(t, file.Close()) + assert.NilError(t, file.Close()) _, err = os.Stat(path) assert.NilError(t, err) } diff --git a/cli/command/container/list_test.go b/cli/command/container/list_test.go index b4221334c4..9a064eb735 100644 --- a/cli/command/container/list_test.go +++ b/cli/command/container/list_test.go @@ -68,7 +68,7 @@ func TestContainerListWithoutFormat(t *testing.T) { }, }) cmd := newListCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "container-list-without-format.golden") } @@ -83,7 +83,7 @@ func TestContainerListNoTrunc(t *testing.T) { }) cmd := newListCommand(cli) cmd.Flags().Set("no-trunc", "true") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "container-list-without-format-no-trunc.golden") } @@ -99,7 +99,7 @@ func TestContainerListNamesMultipleTime(t *testing.T) { }) cmd := newListCommand(cli) cmd.Flags().Set("format", "{{.Names}} {{.Names}}") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "container-list-format-name-name.golden") } @@ -115,7 +115,7 @@ func TestContainerListFormatTemplateWithArg(t *testing.T) { }) cmd := newListCommand(cli) cmd.Flags().Set("format", `{{.Names}} {{.Label "some.label"}}`) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "container-list-format-with-arg.golden") } @@ -128,7 +128,7 @@ func TestContainerListFormatSizeSetsOption(t *testing.T) { }) cmd := newListCommand(cli) cmd.Flags().Set("format", `{{.Size}}`) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } func TestContainerListWithConfigFormat(t *testing.T) { @@ -144,7 +144,7 @@ func TestContainerListWithConfigFormat(t *testing.T) { PsFormat: "{{ .Names }} {{ .Image }} {{ .Labels }}", }) cmd := newListCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "container-list-with-config-format.golden") } @@ -159,6 +159,6 @@ func TestContainerListWithFormat(t *testing.T) { }) cmd := newListCommand(cli) cmd.Flags().Set("format", "{{ .Names }} {{ .Image }} {{ .Labels }}") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "container-list-with-format.golden") } diff --git a/cli/command/container/ps_test.go b/cli/command/container/ps_test.go index 42e36f3578..4ca11dcb41 100644 --- a/cli/command/container/ps_test.go +++ b/cli/command/container/ps_test.go @@ -10,8 +10,8 @@ import ( func TestBuildContainerListOptions(t *testing.T) { filters := opts.NewFilterOpt() - assert.Check(t, filters.Set("foo=bar")) - assert.Check(t, filters.Set("baz=foo")) + assert.NilError(t, filters.Set("foo=bar")) + assert.NilError(t, filters.Set("baz=foo")) contexts := []struct { psOpts *psOptions diff --git a/cli/command/container/run_test.go b/cli/command/container/run_test.go index 71389bd6cf..e05b120410 100644 --- a/cli/command/container/run_test.go +++ b/cli/command/container/run_test.go @@ -21,5 +21,5 @@ func TestRunLabel(t *testing.T) { cmd := NewRunCommand(cli) cmd.Flags().Set("detach", "true") cmd.SetArgs([]string{"--label", "foo", "busybox"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } diff --git a/cli/command/image/build_test.go b/cli/command/image/build_test.go index 6012a755c4..a178a93cea 100644 --- a/cli/command/image/build_test.go +++ b/cli/command/image/build_test.go @@ -28,7 +28,7 @@ func TestRunBuildResetsUidAndGidInContext(t *testing.T) { defer dest.Remove() fakeImageBuild := func(_ context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) { - assert.Check(t, archive.Untar(context, dest.Path(), nil)) + assert.NilError(t, archive.Untar(context, dest.Path(), nil)) body := new(bytes.Buffer) return types.ImageBuildResponse{Body: ioutil.NopCloser(body)}, nil @@ -67,7 +67,7 @@ func TestRunBuildDockerfileFromStdinWithCompress(t *testing.T) { buffer := new(bytes.Buffer) tee := io.TeeReader(context, buffer) - assert.Check(t, archive.Untar(tee, dest, nil)) + assert.NilError(t, archive.Untar(tee, dest, nil)) dockerfileName = options.Dockerfile header := buffer.Bytes()[:10] @@ -132,7 +132,7 @@ COPY data /data buffer := new(bytes.Buffer) tee := io.TeeReader(context, buffer) - assert.Check(t, archive.Untar(tee, dest, nil)) + assert.NilError(t, archive.Untar(tee, dest, nil)) dockerfileName = options.Dockerfile body := new(bytes.Buffer) diff --git a/cli/command/image/import_test.go b/cli/command/image/import_test.go index 0bab6ae642..2eefe72479 100644 --- a/cli/command/image/import_test.go +++ b/cli/command/image/import_test.go @@ -92,6 +92,6 @@ func TestNewImportCommandSuccess(t *testing.T) { cmd := NewImportCommand(test.NewFakeCli(&fakeClient{imageImportFunc: tc.imageImportFunc})) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } } diff --git a/cli/command/image/push_test.go b/cli/command/image/push_test.go index 8031aa4985..72fefc0bde 100644 --- a/cli/command/image/push_test.go +++ b/cli/command/image/push_test.go @@ -71,6 +71,6 @@ func TestNewPushCommandSuccess(t *testing.T) { cmd := NewPushCommand(cli) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } } diff --git a/cli/command/image/remove_test.go b/cli/command/image/remove_test.go index ee5cfd02e0..2c0cc9b0ac 100644 --- a/cli/command/image/remove_test.go +++ b/cli/command/image/remove_test.go @@ -126,7 +126,7 @@ func TestNewRemoveCommandSuccess(t *testing.T) { cmd := NewRemoveCommand(cli) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal(tc.expectedStderr, cli.ErrBuffer().String())) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("remove-command-success.%s.golden", tc.name)) }) diff --git a/cli/command/image/save_test.go b/cli/command/image/save_test.go index f12ba6d805..b87be3c8af 100644 --- a/cli/command/image/save_test.go +++ b/cli/command/image/save_test.go @@ -95,7 +95,7 @@ func TestNewSaveCommandSuccess(t *testing.T) { })) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) if tc.deferredFunc != nil { tc.deferredFunc() } diff --git a/cli/command/image/tag_test.go b/cli/command/image/tag_test.go index 9db565c8a2..0319cb0522 100644 --- a/cli/command/image/tag_test.go +++ b/cli/command/image/tag_test.go @@ -35,7 +35,7 @@ func TestCliNewTagCommand(t *testing.T) { })) cmd.SetArgs([]string{"image1", "image2"}) cmd.SetOutput(ioutil.Discard) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) value, _ := cmd.Flags().GetBool("interspersed") assert.Check(t, !value) } diff --git a/cli/command/network/connect_test.go b/cli/command/network/connect_test.go index c4cffc7dd9..d4c9654eaf 100644 --- a/cli/command/network/connect_test.go +++ b/cli/command/network/connect_test.go @@ -66,5 +66,5 @@ func TestNetworkConnectWithFlags(t *testing.T) { cmd.Flags().Set("ip-range", "192.168.4.0/24") cmd.Flags().Set("gateway", "192.168.4.1/24") cmd.Flags().Set("subnet", "192.168.4.0/24") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } diff --git a/cli/command/network/create_test.go b/cli/command/network/create_test.go index 8880e467be..6a76695c91 100644 --- a/cli/command/network/create_test.go +++ b/cli/command/network/create_test.go @@ -169,6 +169,6 @@ func TestNetworkCreateWithFlags(t *testing.T) { cmd.Flags().Set("ip-range", "192.168.4.0/24") cmd.Flags().Set("gateway", "192.168.4.1/24") cmd.Flags().Set("subnet", "192.168.4.0/24") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("banana", strings.TrimSpace(cli.OutBuffer().String()))) } diff --git a/cli/command/network/list_test.go b/cli/command/network/list_test.go index 4c1a437c03..558f6cb2ba 100644 --- a/cli/command/network/list_test.go +++ b/cli/command/network/list_test.go @@ -58,6 +58,6 @@ func TestNetworkListWithFlags(t *testing.T) { cmd := newListCommand(cli) cmd.Flags().Set("filter", "image.name=ubuntu") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, strings.TrimSpace(cli.OutBuffer().String()), "network-list.golden") } diff --git a/cli/command/node/demote_test.go b/cli/command/node/demote_test.go index d3bfd43474..5bbc7dae36 100644 --- a/cli/command/node/demote_test.go +++ b/cli/command/node/demote_test.go @@ -63,7 +63,7 @@ func TestNodeDemoteNoChange(t *testing.T) { }, })) cmd.SetArgs([]string{"nodeID"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } func TestNodeDemoteMultipleNode(t *testing.T) { @@ -80,5 +80,5 @@ func TestNodeDemoteMultipleNode(t *testing.T) { }, })) cmd.SetArgs([]string{"nodeID1", "nodeID2"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } diff --git a/cli/command/node/inspect_test.go b/cli/command/node/inspect_test.go index 42a78f8555..73f0a9e872 100644 --- a/cli/command/node/inspect_test.go +++ b/cli/command/node/inspect_test.go @@ -112,7 +112,7 @@ func TestNodeInspectPretty(t *testing.T) { cmd := newInspectCommand(cli) cmd.SetArgs([]string{"nodeID"}) cmd.Flags().Set("pretty", "true") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("node-inspect-pretty.%s.golden", tc.name)) } } diff --git a/cli/command/node/list_test.go b/cli/command/node/list_test.go index 3d57149a08..dc4790eab0 100644 --- a/cli/command/node/list_test.go +++ b/cli/command/node/list_test.go @@ -72,7 +72,7 @@ func TestNodeList(t *testing.T) { }) cmd := newListCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "node-list-sort.golden") } @@ -86,7 +86,7 @@ func TestNodeListQuietShouldOnlyPrintIDs(t *testing.T) { }) cmd := newListCommand(cli) cmd.Flags().Set("quiet", "true") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal(cli.OutBuffer().String(), "nodeID1\n")) } @@ -111,7 +111,7 @@ func TestNodeListDefaultFormatFromConfig(t *testing.T) { NodesFormat: "{{.ID}}: {{.Hostname}} {{.Status}}/{{.ManagerStatus}}", }) cmd := newListCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "node-list-format-from-config.golden") } @@ -136,6 +136,6 @@ func TestNodeListFormat(t *testing.T) { }) cmd := newListCommand(cli) cmd.Flags().Set("format", "{{.Hostname}}: {{.ManagerStatus}}") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "node-list-format-flag.golden") } diff --git a/cli/command/node/promote_test.go b/cli/command/node/promote_test.go index 39c5000301..5d5c105dfe 100644 --- a/cli/command/node/promote_test.go +++ b/cli/command/node/promote_test.go @@ -63,7 +63,7 @@ func TestNodePromoteNoChange(t *testing.T) { }, })) cmd.SetArgs([]string{"nodeID"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } func TestNodePromoteMultipleNode(t *testing.T) { @@ -80,5 +80,5 @@ func TestNodePromoteMultipleNode(t *testing.T) { }, })) cmd.SetArgs([]string{"nodeID1", "nodeID2"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } diff --git a/cli/command/node/ps_test.go b/cli/command/node/ps_test.go index f2a3b59757..49b5391a2c 100644 --- a/cli/command/node/ps_test.go +++ b/cli/command/node/ps_test.go @@ -123,7 +123,7 @@ func TestNodePs(t *testing.T) { for key, value := range tc.flags { cmd.Flags().Set(key, value) } - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("node-ps.%s.golden", tc.name)) } } diff --git a/cli/command/node/remove_test.go b/cli/command/node/remove_test.go index 498a827999..17ebb46f75 100644 --- a/cli/command/node/remove_test.go +++ b/cli/command/node/remove_test.go @@ -40,5 +40,5 @@ func TestNodeRemoveErrors(t *testing.T) { func TestNodeRemoveMultiple(t *testing.T) { cmd := newRemoveCommand(test.NewFakeCli(&fakeClient{})) cmd.SetArgs([]string{"nodeID1", "nodeID2"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } diff --git a/cli/command/node/update_test.go b/cli/command/node/update_test.go index c9a2f2108b..6d3f6f0bd4 100644 --- a/cli/command/node/update_test.go +++ b/cli/command/node/update_test.go @@ -164,6 +164,6 @@ func TestNodeUpdate(t *testing.T) { for key, value := range tc.flags { cmd.Flags().Set(key, value) } - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } } diff --git a/cli/command/plugin/create_test.go b/cli/command/plugin/create_test.go index a43e5dc6a7..87e17d3793 100644 --- a/cli/command/plugin/create_test.go +++ b/cli/command/plugin/create_test.go @@ -109,6 +109,6 @@ func TestCreatePlugin(t *testing.T) { cmd := newCreateCommand(cli) cmd.SetArgs([]string{"plugin-foo", tmpDir.Path()}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("plugin-foo\n", cli.OutBuffer().String())) } diff --git a/cli/command/plugin/disable_test.go b/cli/command/plugin/disable_test.go index ab18bef060..592e0e4951 100644 --- a/cli/command/plugin/disable_test.go +++ b/cli/command/plugin/disable_test.go @@ -53,6 +53,6 @@ func TestPluginDisable(t *testing.T) { }) cmd := newDisableCommand(cli) cmd.SetArgs([]string{"plugin-foo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("plugin-foo\n", cli.OutBuffer().String())) } diff --git a/cli/command/plugin/enable_test.go b/cli/command/plugin/enable_test.go index 7606ec5bec..42ce53576a 100644 --- a/cli/command/plugin/enable_test.go +++ b/cli/command/plugin/enable_test.go @@ -65,6 +65,6 @@ func TestPluginEnable(t *testing.T) { cmd := newEnableCommand(cli) cmd.SetArgs([]string{"plugin-foo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("plugin-foo\n", cli.OutBuffer().String())) } diff --git a/cli/command/plugin/remove_test.go b/cli/command/plugin/remove_test.go index 7ce02c6a6c..813c7615f6 100644 --- a/cli/command/plugin/remove_test.go +++ b/cli/command/plugin/remove_test.go @@ -50,7 +50,7 @@ func TestRemove(t *testing.T) { }) cmd := newRemoveCommand(cli) cmd.SetArgs([]string{"plugin-foo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("plugin-foo\n", cli.OutBuffer().String())) } @@ -65,7 +65,7 @@ func TestRemoveWithForceOption(t *testing.T) { cmd := newRemoveCommand(cli) cmd.SetArgs([]string{"plugin-foo"}) cmd.Flags().Set("force", "true") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, force) assert.Check(t, is.Equal("plugin-foo\n", cli.OutBuffer().String())) } diff --git a/cli/command/secret/create_test.go b/cli/command/secret/create_test.go index b6a8dc22d2..7a9492ca0f 100644 --- a/cli/command/secret/create_test.go +++ b/cli/command/secret/create_test.go @@ -75,7 +75,7 @@ func TestSecretCreateWithName(t *testing.T) { cmd := newSecretCreateCommand(cli) cmd.SetArgs([]string{name, filepath.Join("testdata", secretDataFile)}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))) } @@ -104,7 +104,7 @@ func TestSecretCreateWithDriver(t *testing.T) { cmd := newSecretCreateCommand(cli) cmd.SetArgs([]string{name}) cmd.Flags().Set("driver", expectedDriver.Name) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))) } @@ -133,7 +133,7 @@ func TestSecretCreateWithTemplatingDriver(t *testing.T) { cmd := newSecretCreateCommand(cli) cmd.SetArgs([]string{name}) cmd.Flags().Set("template-driver", expectedDriver.Name) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))) } @@ -164,6 +164,6 @@ func TestSecretCreateWithLabels(t *testing.T) { cmd.SetArgs([]string{name, filepath.Join("testdata", secretDataFile)}) cmd.Flags().Set("label", "lbl1=Label-foo") cmd.Flags().Set("label", "lbl2=Label-bar") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))) } diff --git a/cli/command/secret/inspect_test.go b/cli/command/secret/inspect_test.go index adee2bcf5f..b23d78beb9 100644 --- a/cli/command/secret/inspect_test.go +++ b/cli/command/secret/inspect_test.go @@ -97,7 +97,7 @@ func TestSecretInspectWithoutFormat(t *testing.T) { }) cmd := newSecretInspectCommand(cli) cmd.SetArgs(tc.args) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("secret-inspect-without-format.%s.golden", tc.name)) } } @@ -134,7 +134,7 @@ func TestSecretInspectWithFormat(t *testing.T) { cmd := newSecretInspectCommand(cli) cmd.SetArgs(tc.args) cmd.Flags().Set("format", tc.format) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("secret-inspect-with-format.%s.golden", tc.name)) } } @@ -167,7 +167,7 @@ func TestSecretInspectPretty(t *testing.T) { cmd := newSecretInspectCommand(cli) cmd.SetArgs([]string{"secretID"}) cmd.Flags().Set("pretty", "true") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("secret-inspect-pretty.%s.golden", tc.name)) } } diff --git a/cli/command/secret/ls_test.go b/cli/command/secret/ls_test.go index 4e62fc74f8..371218926c 100644 --- a/cli/command/secret/ls_test.go +++ b/cli/command/secret/ls_test.go @@ -74,7 +74,7 @@ func TestSecretList(t *testing.T) { }, }) cmd := newSecretListCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "secret-list-sort.golden") } @@ -91,7 +91,7 @@ func TestSecretListWithQuietOption(t *testing.T) { }) cmd := newSecretListCommand(cli) cmd.Flags().Set("quiet", "true") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "secret-list-with-quiet-option.golden") } @@ -110,7 +110,7 @@ func TestSecretListWithConfigFormat(t *testing.T) { SecretFormat: "{{ .Name }} {{ .Labels }}", }) cmd := newSecretListCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "secret-list-with-config-format.golden") } @@ -127,7 +127,7 @@ func TestSecretListWithFormat(t *testing.T) { }) cmd := newSecretListCommand(cli) cmd.Flags().Set("format", "{{ .Name }} {{ .Labels }}") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "secret-list-with-format.golden") } @@ -155,6 +155,6 @@ func TestSecretListWithFilter(t *testing.T) { cmd := newSecretListCommand(cli) cmd.Flags().Set("filter", "name=foo") cmd.Flags().Set("filter", "label=lbl1=Label-bar") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "secret-list-with-filter.golden") } diff --git a/cli/command/secret/remove_test.go b/cli/command/secret/remove_test.go index 80b7b96a80..cf37ed2f86 100644 --- a/cli/command/secret/remove_test.go +++ b/cli/command/secret/remove_test.go @@ -52,7 +52,7 @@ func TestSecretRemoveWithName(t *testing.T) { }) cmd := newSecretRemoveCommand(cli) cmd.SetArgs(names) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.DeepEqual(names, strings.Split(strings.TrimSpace(cli.OutBuffer().String()), "\n"))) assert.Check(t, is.DeepEqual(names, removedSecrets)) } diff --git a/cli/command/service/list_test.go b/cli/command/service/list_test.go index 18e8f09fca..6286906f32 100644 --- a/cli/command/service/list_test.go +++ b/cli/command/service/list_test.go @@ -23,6 +23,6 @@ func TestServiceListOrder(t *testing.T) { }) cmd := newListCommand(cli) cmd.Flags().Set("format", "{{.Name}}") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "service-list-sort.golden") } diff --git a/cli/command/service/opts_test.go b/cli/command/service/opts_test.go index 8c5af59b7a..34d19554c2 100644 --- a/cli/command/service/opts_test.go +++ b/cli/command/service/opts_test.go @@ -21,7 +21,7 @@ func TestMemBytesString(t *testing.T) { func TestMemBytesSetAndValue(t *testing.T) { var mem opts.MemBytes - assert.Check(t, mem.Set("5kb")) + assert.NilError(t, mem.Set("5kb")) assert.Check(t, is.Equal(int64(5120), mem.Value())) } @@ -32,7 +32,7 @@ func TestNanoCPUsString(t *testing.T) { func TestNanoCPUsSetAndValue(t *testing.T) { var cpus opts.NanoCPUs - assert.Check(t, cpus.Set("0.35")) + assert.NilError(t, cpus.Set("0.35")) assert.Check(t, is.Equal(int64(350000000), cpus.Value())) } @@ -47,7 +47,7 @@ func TestUint64OptString(t *testing.T) { func TestUint64OptSetAndValue(t *testing.T) { var opt Uint64Opt - assert.Check(t, opt.Set("14445")) + assert.NilError(t, opt.Set("14445")) assert.Check(t, is.Equal(uint64(14445), *opt.Value())) } diff --git a/cli/command/service/rollback_test.go b/cli/command/service/rollback_test.go index e76eb68a47..6e5620cbe7 100644 --- a/cli/command/service/rollback_test.go +++ b/cli/command/service/rollback_test.go @@ -50,7 +50,7 @@ func TestRollback(t *testing.T) { cmd.SetArgs(tc.args) cmd.Flags().Set("quiet", "true") cmd.SetOutput(ioutil.Discard) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal(strings.TrimSpace(cli.ErrBuffer().String()), tc.expectedDockerCliErr)) } } diff --git a/cli/command/stack/list_test.go b/cli/command/stack/list_test.go index 569093bf16..b3a9bdc3b7 100644 --- a/cli/command/stack/list_test.go +++ b/cli/command/stack/list_test.go @@ -71,7 +71,7 @@ func TestListWithFormat(t *testing.T) { }) cmd := newListCommand(cli) cmd.Flags().Set("format", "{{ .Name }}") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "stack-list-with-format.golden") } @@ -87,7 +87,7 @@ func TestListWithoutFormat(t *testing.T) { }, }) cmd := newListCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "stack-list-without-format.golden") } @@ -140,7 +140,7 @@ func TestListOrder(t *testing.T) { }, }) cmd := newListCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), uc.golden) } } diff --git a/cli/command/stack/ps_test.go b/cli/command/stack/ps_test.go index 798ad17c15..2f33f16078 100644 --- a/cli/command/stack/ps_test.go +++ b/cli/command/stack/ps_test.go @@ -74,7 +74,7 @@ func TestStackPsWithQuietOption(t *testing.T) { cmd := newPsCommand(cli) cmd.SetArgs([]string{"foo"}) cmd.Flags().Set("quiet", "true") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "stack-ps-with-quiet-option.golden") } @@ -89,7 +89,7 @@ func TestStackPsWithNoTruncOption(t *testing.T) { cmd.SetArgs([]string{"foo"}) cmd.Flags().Set("no-trunc", "true") cmd.Flags().Set("format", "{{ .ID }}") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "stack-ps-with-no-trunc-option.golden") } @@ -108,7 +108,7 @@ func TestStackPsWithNoResolveOption(t *testing.T) { cmd.SetArgs([]string{"foo"}) cmd.Flags().Set("no-resolve", "true") cmd.Flags().Set("format", "{{ .Node }}") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "stack-ps-with-no-resolve-option.golden") } @@ -121,7 +121,7 @@ func TestStackPsWithFormat(t *testing.T) { cmd := newPsCommand(cli) cmd.SetArgs([]string{"foo"}) cmd.Flags().Set("format", "{{ .Name }}") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "stack-ps-with-format.golden") } @@ -136,7 +136,7 @@ func TestStackPsWithConfigFormat(t *testing.T) { }) cmd := newPsCommand(cli) cmd.SetArgs([]string{"foo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "stack-ps-with-config-format.golden") } @@ -158,6 +158,6 @@ func TestStackPsWithoutFormat(t *testing.T) { }) cmd := newPsCommand(cli) cmd.SetArgs([]string{"foo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "stack-ps-without-format.golden") } diff --git a/cli/command/stack/remove_test.go b/cli/command/stack/remove_test.go index 7770d47145..72daf15f0b 100644 --- a/cli/command/stack/remove_test.go +++ b/cli/command/stack/remove_test.go @@ -46,7 +46,7 @@ func TestRemoveStackVersion124DoesNotRemoveConfigsOrSecrets(t *testing.T) { cmd := newRemoveCommand(test.NewFakeCli(client)) cmd.SetArgs([]string{"foo", "bar"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.DeepEqual(buildObjectIDs(client.services), client.removedServices)) assert.Check(t, is.DeepEqual(buildObjectIDs(client.networks), client.removedNetworks)) assert.Check(t, is.Len(client.removedSecrets, 0)) @@ -58,7 +58,7 @@ func TestRemoveStackVersion125DoesNotRemoveConfigs(t *testing.T) { cmd := newRemoveCommand(test.NewFakeCli(client)) cmd.SetArgs([]string{"foo", "bar"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.DeepEqual(buildObjectIDs(client.services), client.removedServices)) assert.Check(t, is.DeepEqual(buildObjectIDs(client.networks), client.removedNetworks)) assert.Check(t, is.DeepEqual(buildObjectIDs(client.secrets), client.removedSecrets)) @@ -70,7 +70,7 @@ func TestRemoveStackVersion130RemovesEverything(t *testing.T) { cmd := newRemoveCommand(test.NewFakeCli(client)) cmd.SetArgs([]string{"foo", "bar"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.DeepEqual(buildObjectIDs(client.services), client.removedServices)) assert.Check(t, is.DeepEqual(buildObjectIDs(client.networks), client.removedNetworks)) assert.Check(t, is.DeepEqual(buildObjectIDs(client.secrets), client.removedSecrets)) @@ -101,7 +101,7 @@ func TestRemoveStackSkipEmpty(t *testing.T) { cmd := newRemoveCommand(fakeCli) cmd.SetArgs([]string{"foo", "bar"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) expectedList := []string{"Removing service bar_service1", "Removing service bar_service2", "Removing secret bar_secret1", diff --git a/cli/command/stack/services_test.go b/cli/command/stack/services_test.go index a4738549ec..195d65c346 100644 --- a/cli/command/stack/services_test.go +++ b/cli/command/stack/services_test.go @@ -88,7 +88,7 @@ func TestStackServicesEmptyServiceList(t *testing.T) { }) cmd := newServicesCommand(fakeCli) cmd.SetArgs([]string{"foo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("", fakeCli.OutBuffer().String())) assert.Check(t, is.Equal("Nothing found in stack: foo\n", fakeCli.ErrBuffer().String())) } @@ -102,7 +102,7 @@ func TestStackServicesWithQuietOption(t *testing.T) { cmd := newServicesCommand(cli) cmd.Flags().Set("quiet", "true") cmd.SetArgs([]string{"foo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "stack-services-with-quiet-option.golden") } @@ -117,7 +117,7 @@ func TestStackServicesWithFormat(t *testing.T) { cmd := newServicesCommand(cli) cmd.SetArgs([]string{"foo"}) cmd.Flags().Set("format", "{{ .Name }}") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "stack-services-with-format.golden") } @@ -134,7 +134,7 @@ func TestStackServicesWithConfigFormat(t *testing.T) { }) cmd := newServicesCommand(cli) cmd.SetArgs([]string{"foo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "stack-services-with-config-format.golden") } @@ -157,6 +157,6 @@ func TestStackServicesWithoutFormat(t *testing.T) { }) cmd := newServicesCommand(cli) cmd.SetArgs([]string{"foo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "stack-services-without-format.golden") } diff --git a/cli/command/swarm/init_test.go b/cli/command/swarm/init_test.go index f7852ed948..68435819ff 100644 --- a/cli/command/swarm/init_test.go +++ b/cli/command/swarm/init_test.go @@ -120,7 +120,7 @@ func TestSwarmInit(t *testing.T) { for key, value := range tc.flags { cmd.Flags().Set(key, value) } - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("init-%s.golden", tc.name)) } } diff --git a/cli/command/swarm/join_test.go b/cli/command/swarm/join_test.go index 3e14db18b5..7817df1440 100644 --- a/cli/command/swarm/join_test.go +++ b/cli/command/swarm/join_test.go @@ -94,7 +94,7 @@ func TestSwarmJoin(t *testing.T) { }) cmd := newJoinCommand(cli) cmd.SetArgs([]string{"remote"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal(strings.TrimSpace(cli.OutBuffer().String()), tc.expected)) } } diff --git a/cli/command/swarm/join_token_test.go b/cli/command/swarm/join_token_test.go index d69469c64c..ca042671b2 100644 --- a/cli/command/swarm/join_token_test.go +++ b/cli/command/swarm/join_token_test.go @@ -205,7 +205,7 @@ func TestSwarmJoinToken(t *testing.T) { for key, value := range tc.flags { cmd.Flags().Set(key, value) } - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("jointoken-%s.golden", tc.name)) } } diff --git a/cli/command/swarm/leave_test.go b/cli/command/swarm/leave_test.go index 8a2db2ce31..07eac2c4da 100644 --- a/cli/command/swarm/leave_test.go +++ b/cli/command/swarm/leave_test.go @@ -45,6 +45,6 @@ func TestSwarmLeaveErrors(t *testing.T) { func TestSwarmLeave(t *testing.T) { cli := test.NewFakeCli(&fakeClient{}) cmd := newLeaveCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("Node left the swarm.", strings.TrimSpace(cli.OutBuffer().String()))) } diff --git a/cli/command/swarm/opts_test.go b/cli/command/swarm/opts_test.go index 5f31f4cb90..da8a89ca1d 100644 --- a/cli/command/swarm/opts_test.go +++ b/cli/command/swarm/opts_test.go @@ -10,25 +10,25 @@ import ( func TestNodeAddrOptionSetHostAndPort(t *testing.T) { opt := NewNodeAddrOption("old:123") addr := "newhost:5555" - assert.Check(t, opt.Set(addr)) + assert.NilError(t, opt.Set(addr)) assert.Check(t, is.Equal(addr, opt.Value())) } func TestNodeAddrOptionSetHostOnly(t *testing.T) { opt := NewListenAddrOption() - assert.Check(t, opt.Set("newhost")) + assert.NilError(t, opt.Set("newhost")) assert.Check(t, is.Equal("newhost:2377", opt.Value())) } func TestNodeAddrOptionSetHostOnlyIPv6(t *testing.T) { opt := NewListenAddrOption() - assert.Check(t, opt.Set("::1")) + assert.NilError(t, opt.Set("::1")) assert.Check(t, is.Equal("[::1]:2377", opt.Value())) } func TestNodeAddrOptionSetPortOnly(t *testing.T) { opt := NewListenAddrOption() - assert.Check(t, opt.Set(":4545")) + assert.NilError(t, opt.Set(":4545")) assert.Check(t, is.Equal("0.0.0.0:4545", opt.Value())) } @@ -97,15 +97,15 @@ func TestExternalCAOption(t *testing.T) { } for _, tc := range testCases { opt := &ExternalCAOption{} - assert.Check(t, opt.Set(tc.externalCA)) + assert.NilError(t, opt.Set(tc.externalCA)) assert.Check(t, is.Equal(tc.expected, opt.String())) } } func TestExternalCAOptionMultiple(t *testing.T) { opt := &ExternalCAOption{} - assert.Check(t, opt.Set("protocol=cfssl,url=https://example.com")) - assert.Check(t, opt.Set("protocol=CFSSL,url=anything")) + assert.NilError(t, opt.Set("protocol=cfssl,url=https://example.com")) + assert.NilError(t, opt.Set("protocol=CFSSL,url=anything")) assert.Check(t, is.Len(opt.Value(), 2)) assert.Check(t, is.Equal("cfssl: https://example.com, cfssl: anything", opt.String())) } diff --git a/cli/command/swarm/unlock_key_test.go b/cli/command/swarm/unlock_key_test.go index cb5e2a9217..aaade6fe9c 100644 --- a/cli/command/swarm/unlock_key_test.go +++ b/cli/command/swarm/unlock_key_test.go @@ -165,7 +165,7 @@ func TestSwarmUnlockKey(t *testing.T) { for key, value := range tc.flags { cmd.Flags().Set(key, value) } - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("unlockkeys-%s.golden", tc.name)) } } diff --git a/cli/command/swarm/unlock_test.go b/cli/command/swarm/unlock_test.go index b60766ce1c..eb481d13ca 100644 --- a/cli/command/swarm/unlock_test.go +++ b/cli/command/swarm/unlock_test.go @@ -94,5 +94,5 @@ func TestSwarmUnlock(t *testing.T) { }) dockerCli.SetIn(command.NewInStream(ioutil.NopCloser(strings.NewReader(input)))) cmd := newUnlockCommand(dockerCli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } diff --git a/cli/command/swarm/update_test.go b/cli/command/swarm/update_test.go index 8186c5ebaa..60e44ddfe0 100644 --- a/cli/command/swarm/update_test.go +++ b/cli/command/swarm/update_test.go @@ -172,7 +172,7 @@ func TestSwarmUpdate(t *testing.T) { cmd.Flags().Set(key, value) } cmd.SetOutput(cli.OutBuffer()) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("update-%s.golden", tc.name)) } } diff --git a/cli/command/system/prune_test.go b/cli/command/system/prune_test.go index a3133eebb6..b763c480ab 100644 --- a/cli/command/system/prune_test.go +++ b/cli/command/system/prune_test.go @@ -11,7 +11,7 @@ import ( func TestPrunePromptPre131DoesNotIncludeBuildCache(t *testing.T) { cli := test.NewFakeCli(&fakeClient{version: "1.30"}) cmd := newPruneCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) expected := `WARNING! This will remove: - all stopped containers - all networks not used by at least one container diff --git a/cli/command/trust/inspect_test.go b/cli/command/trust/inspect_test.go index 7224f1dad9..5bf41f5487 100644 --- a/cli/command/trust/inspect_test.go +++ b/cli/command/trust/inspect_test.go @@ -84,7 +84,7 @@ func TestTrustInspectCommandEmptyNotaryRepo(t *testing.T) { cmd := newInspectCommand(cli) cmd.SetArgs([]string{"reg/img:unsigned-tag"}) cmd.SetOutput(ioutil.Discard) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "trust-inspect-empty-repo.golden") } @@ -93,7 +93,7 @@ func TestTrustInspectCommandFullRepoWithoutSigners(t *testing.T) { cli.SetNotaryClient(getLoadedWithNoSignersNotaryRepository) cmd := newInspectCommand(cli) cmd.SetArgs([]string{"signed-repo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "trust-inspect-full-repo-no-signers.golden") } @@ -102,7 +102,7 @@ func TestTrustInspectCommandOneTagWithoutSigners(t *testing.T) { cli.SetNotaryClient(getLoadedWithNoSignersNotaryRepository) cmd := newInspectCommand(cli) cmd.SetArgs([]string{"signed-repo:green"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "trust-inspect-one-tag-no-signers.golden") } @@ -111,7 +111,7 @@ func TestTrustInspectCommandFullRepoWithSigners(t *testing.T) { cli.SetNotaryClient(getLoadedNotaryRepository) cmd := newInspectCommand(cli) cmd.SetArgs([]string{"signed-repo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "trust-inspect-full-repo-with-signers.golden") } @@ -120,7 +120,7 @@ func TestTrustInspectCommandMultipleFullReposWithSigners(t *testing.T) { cli.SetNotaryClient(getLoadedNotaryRepository) cmd := newInspectCommand(cli) cmd.SetArgs([]string{"signed-repo", "signed-repo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "trust-inspect-multiple-repos-with-signers.golden") } @@ -129,6 +129,6 @@ func TestTrustInspectCommandUnsignedTagInSignedRepo(t *testing.T) { cli.SetNotaryClient(getLoadedNotaryRepository) cmd := newInspectCommand(cli) cmd.SetArgs([]string{"signed-repo:unsigned"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "trust-inspect-unsigned-tag-with-signers.golden") } diff --git a/cli/command/trust/key_generate_test.go b/cli/command/trust/key_generate_test.go index 38c34863e5..bad5164941 100644 --- a/cli/command/trust/key_generate_test.go +++ b/cli/command/trust/key_generate_test.go @@ -125,7 +125,7 @@ func TestValidateKeyArgs(t *testing.T) { err = validateKeyArgs("-", pubKeyCWD) assert.Error(t, err, "key name \"-\" must start with lowercase alphanumeric characters and can include \"-\" or \"_\" after the first character") - assert.Check(t, ioutil.WriteFile(filepath.Join(pubKeyCWD, "a.pub"), []byte("abc"), notary.PrivExecPerms)) + assert.NilError(t, ioutil.WriteFile(filepath.Join(pubKeyCWD, "a.pub"), []byte("abc"), notary.PrivExecPerms)) err = validateKeyArgs("a", pubKeyCWD) assert.Error(t, err, fmt.Sprintf("public key file already exists: \"%s/a.pub\"", pubKeyCWD)) diff --git a/cli/command/trust/key_load_test.go b/cli/command/trust/key_load_test.go index 3cbbf43d9d..b24f528ef0 100644 --- a/cli/command/trust/key_load_test.go +++ b/cli/command/trust/key_load_test.go @@ -121,7 +121,7 @@ func testLoadKeyFromPath(t *testing.T, privKeyID string, privKeyFixture []byte) assert.NilError(t, err) defer os.RemoveAll(privKeyDir) privKeyFilepath := filepath.Join(privKeyDir, "privkey.pem") - assert.Check(t, ioutil.WriteFile(privKeyFilepath, privKeyFixture, notary.PrivNoExecPerms)) + assert.NilError(t, ioutil.WriteFile(privKeyFilepath, privKeyFixture, notary.PrivNoExecPerms)) keyStorageDir, err := ioutil.TempDir("", "loaded-keys-") assert.NilError(t, err) @@ -175,7 +175,7 @@ func testLoadKeyTooPermissive(t *testing.T, privKeyFixture []byte) { assert.NilError(t, err) defer os.RemoveAll(privKeyDir) privKeyFilepath := filepath.Join(privKeyDir, "privkey477.pem") - assert.Check(t, ioutil.WriteFile(privKeyFilepath, privKeyFixture, 0477)) + assert.NilError(t, ioutil.WriteFile(privKeyFilepath, privKeyFixture, 0477)) keyStorageDir, err := ioutil.TempDir("", "loaded-keys-") assert.NilError(t, err) @@ -187,27 +187,27 @@ func testLoadKeyTooPermissive(t *testing.T, privKeyFixture []byte) { assert.Error(t, err, expected) privKeyFilepath = filepath.Join(privKeyDir, "privkey667.pem") - assert.Check(t, ioutil.WriteFile(privKeyFilepath, privKeyFixture, 0677)) + assert.NilError(t, ioutil.WriteFile(privKeyFilepath, privKeyFixture, 0677)) _, err = getPrivKeyBytesFromPath(privKeyFilepath) expected = fmt.Sprintf("private key file %s must not be readable or writable by others", privKeyFilepath) assert.Error(t, err, expected) privKeyFilepath = filepath.Join(privKeyDir, "privkey777.pem") - assert.Check(t, ioutil.WriteFile(privKeyFilepath, privKeyFixture, 0777)) + assert.NilError(t, ioutil.WriteFile(privKeyFilepath, privKeyFixture, 0777)) _, err = getPrivKeyBytesFromPath(privKeyFilepath) expected = fmt.Sprintf("private key file %s must not be readable or writable by others", privKeyFilepath) assert.Error(t, err, expected) privKeyFilepath = filepath.Join(privKeyDir, "privkey400.pem") - assert.Check(t, ioutil.WriteFile(privKeyFilepath, privKeyFixture, 0400)) + assert.NilError(t, ioutil.WriteFile(privKeyFilepath, privKeyFixture, 0400)) _, err = getPrivKeyBytesFromPath(privKeyFilepath) assert.NilError(t, err) privKeyFilepath = filepath.Join(privKeyDir, "privkey600.pem") - assert.Check(t, ioutil.WriteFile(privKeyFilepath, privKeyFixture, 0600)) + assert.NilError(t, ioutil.WriteFile(privKeyFilepath, privKeyFixture, 0600)) _, err = getPrivKeyBytesFromPath(privKeyFilepath) assert.NilError(t, err) @@ -223,7 +223,7 @@ func TestLoadPubKeyFailure(t *testing.T) { assert.NilError(t, err) defer os.RemoveAll(pubKeyDir) pubKeyFilepath := filepath.Join(pubKeyDir, "pubkey.pem") - assert.Check(t, ioutil.WriteFile(pubKeyFilepath, pubKeyFixture, notary.PrivNoExecPerms)) + assert.NilError(t, ioutil.WriteFile(pubKeyFilepath, pubKeyFixture, notary.PrivNoExecPerms)) keyStorageDir, err := ioutil.TempDir("", "loaded-keys-") assert.NilError(t, err) defer os.RemoveAll(keyStorageDir) diff --git a/cli/command/trust/revoke_test.go b/cli/command/trust/revoke_test.go index f3f94b96b6..fcf4a989a5 100644 --- a/cli/command/trust/revoke_test.go +++ b/cli/command/trust/revoke_test.go @@ -59,7 +59,7 @@ func TestTrustRevokeCommandOfflineErrors(t *testing.T) { cmd := newRevokeCommand(cli) cmd.SetArgs([]string{"reg-name.io/image"}) cmd.SetOutput(ioutil.Discard) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Contains(cli.OutBuffer().String(), "Please confirm you would like to delete all signature data for reg-name.io/image? [y/N] \nAborting action.")) cli = test.NewFakeCli(&fakeClient{}) @@ -82,7 +82,7 @@ func TestTrustRevokeCommandUninitializedErrors(t *testing.T) { cmd := newRevokeCommand(cli) cmd.SetArgs([]string{"reg-name.io/image"}) cmd.SetOutput(ioutil.Discard) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Contains(cli.OutBuffer().String(), "Please confirm you would like to delete all signature data for reg-name.io/image? [y/N] \nAborting action.")) cli = test.NewFakeCli(&fakeClient{}) @@ -106,7 +106,7 @@ func TestTrustRevokeCommandEmptyNotaryRepo(t *testing.T) { cmd := newRevokeCommand(cli) cmd.SetArgs([]string{"reg-name.io/image"}) cmd.SetOutput(ioutil.Discard) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Contains(cli.OutBuffer().String(), "Please confirm you would like to delete all signature data for reg-name.io/image? [y/N] \nAborting action.")) cli = test.NewFakeCli(&fakeClient{}) @@ -129,7 +129,7 @@ func TestNewRevokeTrustAllSigConfirmation(t *testing.T) { cli.SetNotaryClient(getEmptyTargetsNotaryRepository) cmd := newRevokeCommand(cli) cmd.SetArgs([]string{"alpine"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Contains(cli.OutBuffer().String(), "Please confirm you would like to delete all signature data for alpine? [y/N] \nAborting action.")) } diff --git a/cli/command/trust/signer_add_test.go b/cli/command/trust/signer_add_test.go index af1921734b..0d4f879d01 100644 --- a/cli/command/trust/signer_add_test.go +++ b/cli/command/trust/signer_add_test.go @@ -109,7 +109,7 @@ func TestSignerAddCommandInvalidRepoName(t *testing.T) { assert.NilError(t, err) defer os.RemoveAll(pubKeyDir) pubKeyFilepath := filepath.Join(pubKeyDir, "pubkey.pem") - assert.Check(t, ioutil.WriteFile(pubKeyFilepath, pubKeyFixture, notary.PrivNoExecPerms)) + assert.NilError(t, ioutil.WriteFile(pubKeyFilepath, pubKeyFixture, notary.PrivNoExecPerms)) cli := test.NewFakeCli(&fakeClient{}) cli.SetNotaryClient(getUninitializedNotaryRepository) diff --git a/cli/command/trust/view_test.go b/cli/command/trust/view_test.go index 7758c94ad1..535ce4fd55 100644 --- a/cli/command/trust/view_test.go +++ b/cli/command/trust/view_test.go @@ -93,7 +93,7 @@ func TestTrustViewCommandEmptyNotaryRepoErrors(t *testing.T) { cmd := newViewCommand(cli) cmd.SetArgs([]string{"reg/img:unsigned-tag"}) cmd.SetOutput(ioutil.Discard) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Contains(cli.OutBuffer().String(), "No signatures for reg/img:unsigned-tag")) assert.Check(t, is.Contains(cli.OutBuffer().String(), "Administrative keys for reg/img:")) @@ -102,7 +102,7 @@ func TestTrustViewCommandEmptyNotaryRepoErrors(t *testing.T) { cmd = newViewCommand(cli) cmd.SetArgs([]string{"reg/img"}) cmd.SetOutput(ioutil.Discard) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Contains(cli.OutBuffer().String(), "No signatures for reg/img")) assert.Check(t, is.Contains(cli.OutBuffer().String(), "Administrative keys for reg/img:")) } @@ -112,7 +112,7 @@ func TestTrustViewCommandFullRepoWithoutSigners(t *testing.T) { cli.SetNotaryClient(getLoadedWithNoSignersNotaryRepository) cmd := newViewCommand(cli) cmd.SetArgs([]string{"signed-repo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "trust-view-full-repo-no-signers.golden") } @@ -122,7 +122,7 @@ func TestTrustViewCommandOneTagWithoutSigners(t *testing.T) { cli.SetNotaryClient(getLoadedWithNoSignersNotaryRepository) cmd := newViewCommand(cli) cmd.SetArgs([]string{"signed-repo:green"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "trust-view-one-tag-no-signers.golden") } @@ -132,7 +132,7 @@ func TestTrustViewCommandFullRepoWithSigners(t *testing.T) { cli.SetNotaryClient(getLoadedNotaryRepository) cmd := newViewCommand(cli) cmd.SetArgs([]string{"signed-repo"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "trust-view-full-repo-with-signers.golden") } @@ -142,7 +142,7 @@ func TestTrustViewCommandUnsignedTagInSignedRepo(t *testing.T) { cli.SetNotaryClient(getLoadedNotaryRepository) cmd := newViewCommand(cli) cmd.SetArgs([]string{"signed-repo:unsigned"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "trust-view-unsigned-tag-with-signers.golden") } diff --git a/cli/command/volume/create_test.go b/cli/command/volume/create_test.go index 0e70d92e0e..d68d065e27 100644 --- a/cli/command/volume/create_test.go +++ b/cli/command/volume/create_test.go @@ -72,14 +72,14 @@ func TestVolumeCreateWithName(t *testing.T) { // Test by flags cmd := newCreateCommand(cli) cmd.Flags().Set("name", name) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal(name, strings.TrimSpace(buf.String()))) // Then by args buf.Reset() cmd = newCreateCommand(cli) cmd.SetArgs([]string{name}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal(name, strings.TrimSpace(buf.String()))) } @@ -121,6 +121,6 @@ func TestVolumeCreateWithFlags(t *testing.T) { cmd.Flags().Set("opt", "baz=baz") cmd.Flags().Set("label", "lbl1=v1") cmd.Flags().Set("label", "lbl2=v2") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal(name, strings.TrimSpace(cli.OutBuffer().String()))) } diff --git a/cli/command/volume/inspect_test.go b/cli/command/volume/inspect_test.go index 56dbf76be9..c827b7281c 100644 --- a/cli/command/volume/inspect_test.go +++ b/cli/command/volume/inspect_test.go @@ -98,7 +98,7 @@ func TestVolumeInspectWithoutFormat(t *testing.T) { }) cmd := newInspectCommand(cli) cmd.SetArgs(tc.args) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("volume-inspect-without-format.%s.golden", tc.name)) } } @@ -135,7 +135,7 @@ func TestVolumeInspectWithFormat(t *testing.T) { cmd := newInspectCommand(cli) cmd.SetArgs(tc.args) cmd.Flags().Set("format", tc.format) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("volume-inspect-with-format.%s.golden", tc.name)) } } diff --git a/cli/command/volume/list_test.go b/cli/command/volume/list_test.go index b004e349f5..52b3e46603 100644 --- a/cli/command/volume/list_test.go +++ b/cli/command/volume/list_test.go @@ -64,7 +64,7 @@ func TestVolumeListWithoutFormat(t *testing.T) { }, }) cmd := newListCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "volume-list-without-format.golden") } @@ -86,7 +86,7 @@ func TestVolumeListWithConfigFormat(t *testing.T) { VolumesFormat: "{{ .Name }} {{ .Driver }} {{ .Labels }}", }) cmd := newListCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "volume-list-with-config-format.golden") } @@ -106,6 +106,6 @@ func TestVolumeListWithFormat(t *testing.T) { }) cmd := newListCommand(cli) cmd.Flags().Set("format", "{{ .Name }} {{ .Driver }} {{ .Labels }}") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "volume-list-with-format.golden") } diff --git a/cli/command/volume/prune_test.go b/cli/command/volume/prune_test.go index 79a7d4fc07..0d75d3b75d 100644 --- a/cli/command/volume/prune_test.go +++ b/cli/command/volume/prune_test.go @@ -72,7 +72,7 @@ func TestVolumePruneForce(t *testing.T) { }) cmd := NewPruneCommand(cli) cmd.Flags().Set("force", "true") - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("volume-prune.%s.golden", tc.name)) } } @@ -88,7 +88,7 @@ func TestVolumePrunePromptYes(t *testing.T) { cli.SetIn(command.NewInStream(ioutil.NopCloser(strings.NewReader(input)))) cmd := NewPruneCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "volume-prune-yes.golden") } } @@ -104,7 +104,7 @@ func TestVolumePrunePromptNo(t *testing.T) { cli.SetIn(command.NewInStream(ioutil.NopCloser(strings.NewReader(input)))) cmd := NewPruneCommand(cli) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "volume-prune-no.golden") } } diff --git a/cli/command/volume/remove_test.go b/cli/command/volume/remove_test.go index 5abf026dd7..f773a3648e 100644 --- a/cli/command/volume/remove_test.go +++ b/cli/command/volume/remove_test.go @@ -40,5 +40,5 @@ func TestVolumeRemoveErrors(t *testing.T) { func TestNodeRemoveMultiple(t *testing.T) { cmd := newRemoveCommand(test.NewFakeCli(&fakeClient{})) cmd.SetArgs([]string{"volume1", "volume2"}) - assert.Check(t, cmd.Execute()) + assert.NilError(t, cmd.Execute()) } diff --git a/cli/compose/schema/schema_test.go b/cli/compose/schema/schema_test.go index ad1af2d5b8..f80af40113 100644 --- a/cli/compose/schema/schema_test.go +++ b/cli/compose/schema/schema_test.go @@ -18,7 +18,7 @@ func TestValidate(t *testing.T) { }, } - assert.Check(t, Validate(config, "3.0")) + assert.NilError(t, Validate(config, "3.0")) } func TestValidateUndefinedTopLevelOption(t *testing.T) { @@ -99,7 +99,7 @@ func TestValidatePlacement(t *testing.T) { }, } - assert.Check(t, Validate(config, "3.3")) + assert.NilError(t, Validate(config, "3.3")) } func TestValidateIsolation(t *testing.T) { @@ -112,5 +112,5 @@ func TestValidateIsolation(t *testing.T) { }, }, } - assert.Check(t, Validate(config, "3.5")) + assert.NilError(t, Validate(config, "3.5")) } diff --git a/opts/duration_test.go b/opts/duration_test.go index 66db3aaefb..0fa3b79ee0 100644 --- a/opts/duration_test.go +++ b/opts/duration_test.go @@ -16,15 +16,15 @@ func TestDurationOptString(t *testing.T) { func TestDurationOptSetAndValue(t *testing.T) { var duration DurationOpt - assert.Check(t, duration.Set("300s")) + assert.NilError(t, duration.Set("300s")) assert.Check(t, is.Equal(time.Duration(300*10e8), *duration.Value())) - assert.Check(t, duration.Set("-300s")) + assert.NilError(t, duration.Set("-300s")) assert.Check(t, is.Equal(time.Duration(-300*10e8), *duration.Value())) } func TestPositiveDurationOptSetAndValue(t *testing.T) { var duration PositiveDurationOpt - assert.Check(t, duration.Set("300s")) + 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")) } diff --git a/opts/mount_test.go b/opts/mount_test.go index 2262e33713..bddd4396f2 100644 --- a/opts/mount_test.go +++ b/opts/mount_test.go @@ -38,7 +38,7 @@ func TestMountOptSetBindNoErrorBind(t *testing.T) { } { var mount MountOpt - assert.Check(t, mount.Set(testcase)) + assert.NilError(t, mount.Set(testcase)) mounts := mount.Value() assert.Assert(t, is.Len(mounts, 1)) @@ -60,7 +60,7 @@ func TestMountOptSetVolumeNoError(t *testing.T) { } { var mount MountOpt - assert.Check(t, mount.Set(testcase)) + assert.NilError(t, mount.Set(testcase)) mounts := mount.Value() assert.Assert(t, is.Len(mounts, 1)) @@ -76,7 +76,7 @@ func TestMountOptSetVolumeNoError(t *testing.T) { // volume mount. func TestMountOptDefaultType(t *testing.T) { var mount MountOpt - assert.Check(t, mount.Set("target=/target,source=/foo")) + assert.NilError(t, mount.Set("target=/target,source=/foo")) assert.Check(t, is.Equal(mounttypes.TypeVolume, mount.values[0].Type)) } @@ -103,47 +103,47 @@ func TestMountOptSetErrorInvalidReadOnly(t *testing.T) { func TestMountOptDefaultEnableReadOnly(t *testing.T) { var m MountOpt - assert.Check(t, m.Set("type=bind,target=/foo,source=/foo")) + assert.NilError(t, m.Set("type=bind,target=/foo,source=/foo")) assert.Check(t, !m.values[0].ReadOnly) m = MountOpt{} - assert.Check(t, m.Set("type=bind,target=/foo,source=/foo,readonly")) + assert.NilError(t, m.Set("type=bind,target=/foo,source=/foo,readonly")) assert.Check(t, m.values[0].ReadOnly) m = MountOpt{} - assert.Check(t, m.Set("type=bind,target=/foo,source=/foo,readonly=1")) + assert.NilError(t, m.Set("type=bind,target=/foo,source=/foo,readonly=1")) assert.Check(t, m.values[0].ReadOnly) m = MountOpt{} - assert.Check(t, m.Set("type=bind,target=/foo,source=/foo,readonly=true")) + assert.NilError(t, m.Set("type=bind,target=/foo,source=/foo,readonly=true")) assert.Check(t, m.values[0].ReadOnly) m = MountOpt{} - assert.Check(t, m.Set("type=bind,target=/foo,source=/foo,readonly=0")) + assert.NilError(t, m.Set("type=bind,target=/foo,source=/foo,readonly=0")) assert.Check(t, !m.values[0].ReadOnly) } func TestMountOptVolumeNoCopy(t *testing.T) { var m MountOpt - assert.Check(t, m.Set("type=volume,target=/foo,volume-nocopy")) + assert.NilError(t, m.Set("type=volume,target=/foo,volume-nocopy")) assert.Check(t, is.Equal("", m.values[0].Source)) m = MountOpt{} - assert.Check(t, m.Set("type=volume,target=/foo,source=foo")) + assert.NilError(t, m.Set("type=volume,target=/foo,source=foo")) assert.Check(t, m.values[0].VolumeOptions == nil) m = MountOpt{} - assert.Check(t, m.Set("type=volume,target=/foo,source=foo,volume-nocopy=true")) + assert.NilError(t, m.Set("type=volume,target=/foo,source=foo,volume-nocopy=true")) assert.Check(t, m.values[0].VolumeOptions != nil) assert.Check(t, m.values[0].VolumeOptions.NoCopy) m = MountOpt{} - assert.Check(t, m.Set("type=volume,target=/foo,source=foo,volume-nocopy")) + assert.NilError(t, m.Set("type=volume,target=/foo,source=foo,volume-nocopy")) assert.Check(t, m.values[0].VolumeOptions != nil) assert.Check(t, m.values[0].VolumeOptions.NoCopy) m = MountOpt{} - assert.Check(t, m.Set("type=volume,target=/foo,source=foo,volume-nocopy=1")) + assert.NilError(t, m.Set("type=volume,target=/foo,source=foo,volume-nocopy=1")) assert.Check(t, m.values[0].VolumeOptions != nil) assert.Check(t, m.values[0].VolumeOptions.NoCopy) } @@ -162,7 +162,7 @@ func TestMountOptSetTmpfsNoError(t *testing.T) { } { var mount MountOpt - assert.Check(t, mount.Set(testcase)) + assert.NilError(t, mount.Set(testcase)) mounts := mount.Value() assert.Assert(t, is.Len(mounts, 1)) diff --git a/opts/network_test.go b/opts/network_test.go index 639bf05e87..357ac10804 100644 --- a/opts/network_test.go +++ b/opts/network_test.go @@ -23,7 +23,7 @@ func TestNetworkOptLegacySyntax(t *testing.T) { } for _, tc := range testCases { var network NetworkOpt - assert.Check(t, network.Set(tc.value)) + assert.NilError(t, network.Set(tc.value)) assert.Check(t, is.DeepEqual(tc.expected, network.Value())) } } @@ -70,7 +70,7 @@ func TestNetworkOptCompleteSyntax(t *testing.T) { } for _, tc := range testCases { var network NetworkOpt - assert.Check(t, network.Set(tc.value)) + assert.NilError(t, network.Set(tc.value)) assert.Check(t, is.DeepEqual(tc.expected, network.Value())) } } diff --git a/opts/port_test.go b/opts/port_test.go index fc7506fdaa..ae33fbff24 100644 --- a/opts/port_test.go +++ b/opts/port_test.go @@ -99,7 +99,7 @@ func TestPortOptValidSimpleSyntax(t *testing.T) { } for _, tc := range testCases { var port PortOpt - assert.Check(t, port.Set(tc.value)) + assert.NilError(t, port.Set(tc.value)) assert.Check(t, is.Len(port.Value(), len(tc.expected))) for _, expectedPortConfig := range tc.expected { assertContains(t, port.Value(), expectedPortConfig) @@ -190,7 +190,7 @@ func TestPortOptValidComplexSyntax(t *testing.T) { } for _, tc := range testCases { var port PortOpt - assert.Check(t, port.Set(tc.value)) + assert.NilError(t, port.Set(tc.value)) assert.Check(t, is.Len(port.Value(), len(tc.expected))) for _, expectedPortConfig := range tc.expected { assertContains(t, port.Value(), expectedPortConfig) diff --git a/opts/quotedstring_test.go b/opts/quotedstring_test.go index ffef407db0..a23448f1b1 100644 --- a/opts/quotedstring_test.go +++ b/opts/quotedstring_test.go @@ -10,7 +10,7 @@ import ( func TestQuotedStringSetWithQuotes(t *testing.T) { value := "" qs := NewQuotedString(&value) - assert.Check(t, qs.Set(`"something"`)) + assert.NilError(t, qs.Set(`"something"`)) assert.Check(t, is.Equal("something", qs.String())) assert.Check(t, is.Equal("something", value)) } @@ -18,13 +18,13 @@ func TestQuotedStringSetWithQuotes(t *testing.T) { func TestQuotedStringSetWithMismatchedQuotes(t *testing.T) { value := "" qs := NewQuotedString(&value) - assert.Check(t, qs.Set(`"something'`)) + assert.NilError(t, qs.Set(`"something'`)) assert.Check(t, is.Equal(`"something'`, qs.String())) } func TestQuotedStringSetWithNoQuotes(t *testing.T) { value := "" qs := NewQuotedString(&value) - assert.Check(t, qs.Set("something")) + assert.NilError(t, qs.Set("something")) assert.Check(t, is.Equal("something", qs.String())) } diff --git a/opts/secret_test.go b/opts/secret_test.go index 3482ccc32a..95ed752148 100644 --- a/opts/secret_test.go +++ b/opts/secret_test.go @@ -12,7 +12,7 @@ func TestSecretOptionsSimple(t *testing.T) { var opt SecretOpt testCase := "app-secret" - assert.Check(t, opt.Set(testCase)) + assert.NilError(t, opt.Set(testCase)) reqs := opt.Value() assert.Assert(t, is.Len(reqs, 1)) @@ -27,7 +27,7 @@ func TestSecretOptionsSourceTarget(t *testing.T) { var opt SecretOpt testCase := "source=foo,target=testing" - assert.Check(t, opt.Set(testCase)) + assert.NilError(t, opt.Set(testCase)) reqs := opt.Value() assert.Assert(t, is.Len(reqs, 1)) @@ -40,7 +40,7 @@ func TestSecretOptionsShorthand(t *testing.T) { var opt SecretOpt testCase := "src=foo,target=testing" - assert.Check(t, opt.Set(testCase)) + assert.NilError(t, opt.Set(testCase)) reqs := opt.Value() assert.Assert(t, is.Len(reqs, 1)) @@ -52,7 +52,7 @@ func TestSecretOptionsCustomUidGid(t *testing.T) { var opt SecretOpt testCase := "source=foo,target=testing,uid=1000,gid=1001" - assert.Check(t, opt.Set(testCase)) + assert.NilError(t, opt.Set(testCase)) reqs := opt.Value() assert.Assert(t, is.Len(reqs, 1)) @@ -67,7 +67,7 @@ func TestSecretOptionsCustomMode(t *testing.T) { var opt SecretOpt testCase := "source=foo,target=testing,uid=1000,gid=1001,mode=0444" - assert.Check(t, opt.Set(testCase)) + assert.NilError(t, opt.Set(testCase)) reqs := opt.Value() assert.Assert(t, is.Len(reqs, 1)) diff --git a/templates/templates_test.go b/templates/templates_test.go index e2f5df642f..fa4d773395 100644 --- a/templates/templates_test.go +++ b/templates/templates_test.go @@ -14,7 +14,7 @@ func TestParseJSONFunctions(t *testing.T) { assert.NilError(t, err) var b bytes.Buffer - assert.Check(t, tm.Execute(&b, map[string]string{"Ports": "0.0.0.0:2->8/udp"})) + assert.NilError(t, tm.Execute(&b, map[string]string{"Ports": "0.0.0.0:2->8/udp"})) want := "\"0.0.0.0:2->8/udp\"" assert.Check(t, is.Equal(want, b.String())) } @@ -24,7 +24,7 @@ func TestParseStringFunctions(t *testing.T) { assert.NilError(t, err) var b bytes.Buffer - assert.Check(t, tm.Execute(&b, "text:with:colon")) + assert.NilError(t, tm.Execute(&b, "text:with:colon")) want := "text/with/colon" assert.Check(t, is.Equal(want, b.String())) } @@ -34,7 +34,7 @@ func TestNewParse(t *testing.T) { assert.NilError(t, err) var b bytes.Buffer - assert.Check(t, tm.Execute(&b, "string")) + assert.NilError(t, tm.Execute(&b, "string")) want := "this is a string" assert.Check(t, is.Equal(want, b.String())) } @@ -70,13 +70,13 @@ func TestParseTruncateFunction(t *testing.T) { t.Run("Non Empty Source Test with template: "+testCase.template, func(t *testing.T) { var b bytes.Buffer - assert.Check(t, tm.Execute(&b, source)) + assert.NilError(t, tm.Execute(&b, source)) assert.Check(t, is.Equal(testCase.expected, b.String())) }) t.Run("Empty Source Test with template: "+testCase.template, func(t *testing.T) { var c bytes.Buffer - assert.Check(t, tm.Execute(&c, "")) + assert.NilError(t, tm.Execute(&c, "")) assert.Check(t, is.Equal("", c.String())) })