mirror of
https://github.com/docker/cli.git
synced 2026-01-23 15:21:32 +03:00
Replace deprecated Cobra command.SetOutput() with command.SetOut()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
func TestDeployWithEmptyName(t *testing.T) {
|
||||
cmd := newDeployCommand(test.NewFakeCli(&fakeClient{}), nil)
|
||||
cmd.SetArgs([]string{"' '"})
|
||||
cmd.SetOutput(ioutil.Discard)
|
||||
cmd.SetOut(ioutil.Discard)
|
||||
|
||||
assert.ErrorContains(t, cmd.Execute(), `invalid stack name: "' '"`)
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ func TestListErrors(t *testing.T) {
|
||||
serviceListFunc: tc.serviceListFunc,
|
||||
}), &orchestrator)
|
||||
cmd.SetArgs(tc.args)
|
||||
cmd.SetOutput(ioutil.Discard)
|
||||
cmd.SetOut(ioutil.Discard)
|
||||
for key, value := range tc.flags {
|
||||
cmd.Flags().Set(key, value)
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func TestStackPsErrors(t *testing.T) {
|
||||
taskListFunc: tc.taskListFunc,
|
||||
}), &orchestrator)
|
||||
cmd.SetArgs(tc.args)
|
||||
cmd.SetOutput(ioutil.Discard)
|
||||
cmd.SetOut(ioutil.Discard)
|
||||
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@ func TestStackPs(t *testing.T) {
|
||||
for key, value := range tc.flags {
|
||||
cmd.Flags().Set(key, value)
|
||||
}
|
||||
cmd.SetOutput(ioutil.Discard)
|
||||
cmd.SetOut(ioutil.Discard)
|
||||
|
||||
if tc.expectedErr != "" {
|
||||
assert.Error(t, cmd.Execute(), tc.expectedErr)
|
||||
|
||||
@@ -44,7 +44,7 @@ func fakeClientForRemoveStackTest(version string) *fakeClient {
|
||||
func TestRemoveWithEmptyName(t *testing.T) {
|
||||
cmd := newRemoveCommand(test.NewFakeCli(&fakeClient{}), &orchestrator)
|
||||
cmd.SetArgs([]string{"good", "' '", "alsogood"})
|
||||
cmd.SetOutput(ioutil.Discard)
|
||||
cmd.SetOut(ioutil.Discard)
|
||||
|
||||
assert.ErrorContains(t, cmd.Execute(), `invalid stack name: "' '"`)
|
||||
}
|
||||
@@ -155,7 +155,7 @@ func TestRemoveContinueAfterError(t *testing.T) {
|
||||
},
|
||||
}
|
||||
cmd := newRemoveCommand(test.NewFakeCli(cli), &orchestrator)
|
||||
cmd.SetOutput(ioutil.Discard)
|
||||
cmd.SetOut(ioutil.Discard)
|
||||
cmd.SetArgs([]string{"foo", "bar"})
|
||||
|
||||
assert.Error(t, cmd.Execute(), "Failed to remove some resources from stack: foo")
|
||||
|
||||
@@ -79,7 +79,7 @@ func TestStackServicesErrors(t *testing.T) {
|
||||
for key, value := range tc.flags {
|
||||
cmd.Flags().Set(key, value)
|
||||
}
|
||||
cmd.SetOutput(ioutil.Discard)
|
||||
cmd.SetOut(ioutil.Discard)
|
||||
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
|
||||
})
|
||||
}
|
||||
@@ -88,7 +88,7 @@ func TestStackServicesErrors(t *testing.T) {
|
||||
func TestRunServicesWithEmptyName(t *testing.T) {
|
||||
cmd := newServicesCommand(test.NewFakeCli(&fakeClient{}), &orchestrator)
|
||||
cmd.SetArgs([]string{"' '"})
|
||||
cmd.SetOutput(ioutil.Discard)
|
||||
cmd.SetOut(ioutil.Discard)
|
||||
|
||||
assert.ErrorContains(t, cmd.Execute(), `invalid stack name: "' '"`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user