Skip to content

Commit 8124276

Browse files
committed
tracing: fix tests for simple flight recorder
We weren't returning errors correctly in SucceedsSoon. First failure would fail the test instead of retrying. Resolves: #149450 Release note: None
1 parent 1e8ab10 commit 8124276

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

pkg/util/tracing/goexectrace/simple_flight_recorder_test.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,22 @@ func TestSimpleFlightRecorder(t *testing.T) {
5656
return errors.New("flight recorder is not enabled")
5757
}
5858
files, err := os.ReadDir(dir)
59-
require.NoError(t, err)
60-
require.Greater(t, len(files), 0)
59+
if err != nil {
60+
return err
61+
}
62+
if len(files) == 0 {
63+
return errors.New("no files written")
64+
}
6165
fi, err := os.Stat(filepath.Join(dir, files[0].Name()))
62-
require.NoError(t, err)
63-
require.Greater(t, fi.Size(), int64(0))
64-
require.Regexp(t, fileMatchRegexp, files[0].Name())
66+
if err != nil {
67+
return err
68+
}
69+
if fi.Size() == 0 {
70+
return errors.New("file is empty")
71+
}
72+
if !fileMatchRegexp.MatchString(files[0].Name()) {
73+
return errors.New("file name does not match expected pattern")
74+
}
6575
return nil
6676
})
6777
})

0 commit comments

Comments
 (0)