mirror of https://github.com/docker/cli.git
cli/command/volume: suppress err output in tests
These tests were deliberately producing errors as part of the test, but printing those errors could be confusing / make it more difficult to find actual test-failures. Before this patch: === RUN TestVolumeCreateErrors Error: conflicting options: either specify --name or provide positional arg, not both Error: "create" requires at most 1 argument. See 'create --help'. Usage: create [OPTIONS] [VOLUME] [flags] Create a volume Error: error creating volume --- PASS: TestVolumeCreateErrors (0.00s) PASS With this patch applied: === RUN TestVolumeCreateErrors --- PASS: TestVolumeCreateErrors (0.00s) PASS Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
166de0ec97
commit
db827d583b
|
@ -50,6 +50,7 @@ func TestVolumeCreateErrors(t *testing.T) {
|
|||
cmd.Flags().Set(key, value)
|
||||
}
|
||||
cmd.SetOut(io.Discard)
|
||||
cmd.SetErr(io.Discard)
|
||||
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ func TestVolumeInspectErrors(t *testing.T) {
|
|||
cmd.Flags().Set(key, value)
|
||||
}
|
||||
cmd.SetOut(io.Discard)
|
||||
cmd.SetErr(io.Discard)
|
||||
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ func TestVolumeListErrors(t *testing.T) {
|
|||
cmd.Flags().Set(key, value)
|
||||
}
|
||||
cmd.SetOut(io.Discard)
|
||||
cmd.SetErr(io.Discard)
|
||||
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ func TestVolumePruneErrors(t *testing.T) {
|
|||
cmd.Flags().Set(key, value)
|
||||
}
|
||||
cmd.SetOut(io.Discard)
|
||||
cmd.SetErr(io.Discard)
|
||||
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ func TestVolumeRemoveErrors(t *testing.T) {
|
|||
}))
|
||||
cmd.SetArgs(tc.args)
|
||||
cmd.SetOut(io.Discard)
|
||||
cmd.SetErr(io.Discard)
|
||||
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue