Skip to content

Commit 4c9f5bd

Browse files
committed
Handle errors
Signed-off-by: Joseph <jvaikath@redhat.com>
1 parent 7845e84 commit 4c9f5bd

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

cmd/root_test.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ func TestReplaceVeleroWithOADP_RunFunctionWrapper(t *testing.T) {
244244

245245
// Read captured output
246246
var buf bytes.Buffer
247-
io.Copy(&buf, r)
247+
_, err := io.Copy(&buf, r)
248+
if err != nil {
249+
t.Errorf("Error copying output: %v", err)
250+
}
248251
output := buf.String()
249252

250253
if !outputCaptured {
@@ -412,9 +415,9 @@ func TestReplaceVeleroWithOADP_PreservesProperNouns(t *testing.T) {
412415
// TestReplaceVeleroWithOADP_RunOutputPreservesProperNouns tests Run wrapper preserves "velero" references
413416
func TestReplaceVeleroWithOADP_RunOutputPreservesProperNouns(t *testing.T) {
414417
tests := []struct {
415-
name string
416-
outputFunc func()
417-
shouldContain []string
418+
name string
419+
outputFunc func()
420+
shouldContain []string
418421
shouldNotContain []string
419422
}{
420423
{
@@ -468,7 +471,10 @@ func TestReplaceVeleroWithOADP_RunOutputPreservesProperNouns(t *testing.T) {
468471

469472
// Read captured output
470473
var buf bytes.Buffer
471-
io.Copy(&buf, r)
474+
_, err := io.Copy(&buf, r)
475+
if err != nil {
476+
t.Errorf("Error copying output: %v", err)
477+
}
472478
output := buf.String()
473479

474480
for _, should := range tt.shouldContain {
@@ -485,4 +491,3 @@ func TestReplaceVeleroWithOADP_RunOutputPreservesProperNouns(t *testing.T) {
485491
})
486492
}
487493
}
488-

0 commit comments

Comments
 (0)