mirror of https://github.com/docker/cli.git
When nothing found in stack exit with exit code 1
To keep on a consistent behaviour such as in docker-service-ps if docker-stack-ps didn't find a given stack, the command line should exit with exit code 1. Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
This commit is contained in:
parent
65202d669a
commit
79f9af2475
|
@ -57,8 +57,7 @@ func runPS(dockerCli command.Cli, options psOptions) error {
|
|||
}
|
||||
|
||||
if len(tasks) == 0 {
|
||||
fmt.Fprintf(dockerCli.Err(), "Nothing found in stack: %s\n", namespace)
|
||||
return nil
|
||||
return fmt.Errorf("nothing found in stack: %s", namespace)
|
||||
}
|
||||
|
||||
format := options.format
|
||||
|
|
|
@ -60,9 +60,9 @@ func TestStackPsEmptyStack(t *testing.T) {
|
|||
cmd := newPsCommand(fakeCli)
|
||||
cmd.SetArgs([]string{"foo"})
|
||||
|
||||
assert.NoError(t, cmd.Execute())
|
||||
assert.Error(t, cmd.Execute())
|
||||
assert.EqualError(t, cmd.Execute(), "nothing found in stack: foo")
|
||||
assert.Equal(t, "", fakeCli.OutBuffer().String())
|
||||
assert.Equal(t, "Nothing found in stack: foo\n", fakeCli.ErrBuffer().String())
|
||||
}
|
||||
|
||||
func TestStackPsWithQuietOption(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue