Skip to content

Commit db827d5

Browse files
committed
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 <[email protected]>
1 parent 166de0e commit db827d5

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

cli/command/volume/create_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func TestVolumeCreateErrors(t *testing.T) {
5050
cmd.Flags().Set(key, value)
5151
}
5252
cmd.SetOut(io.Discard)
53+
cmd.SetErr(io.Discard)
5354
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
5455
}
5556
}

cli/command/volume/inspect_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func TestVolumeInspectErrors(t *testing.T) {
6262
cmd.Flags().Set(key, value)
6363
}
6464
cmd.SetOut(io.Discard)
65+
cmd.SetErr(io.Discard)
6566
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
6667
}
6768
}

cli/command/volume/list_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func TestVolumeListErrors(t *testing.T) {
4343
cmd.Flags().Set(key, value)
4444
}
4545
cmd.SetOut(io.Discard)
46+
cmd.SetErr(io.Discard)
4647
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
4748
}
4849
}

cli/command/volume/prune_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func TestVolumePruneErrors(t *testing.T) {
4949
cmd.Flags().Set(key, value)
5050
}
5151
cmd.SetOut(io.Discard)
52+
cmd.SetErr(io.Discard)
5253
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
5354
}
5455
}

cli/command/volume/remove_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func TestVolumeRemoveErrors(t *testing.T) {
3333
}))
3434
cmd.SetArgs(tc.args)
3535
cmd.SetOut(io.Discard)
36+
cmd.SetErr(io.Discard)
3637
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
3738
}
3839
}

0 commit comments

Comments
 (0)