Skip to content

Commit 0c56a6f

Browse files
committed
Fix a race condition in recorder tests
When we switch the filesystem under a running recorder during failure tests, we don't want the garbage collection deleteObsoleteFiles() to run at the same time, since he may well be traversing the filesystem being replaced. And using the real expected type/unit (time) is always better.
1 parent e73eba1 commit 0c56a6f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/recorder/recorder_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestRecorder(t *testing.T) {
2828
conf := &config.KfConfig{
2929
Logger: log.New("info", "", "test"),
3030
LocalDir: "/tmp/ktest", // fake dir (in memory fs provided by Afero)
31-
ResyncIntv: 60,
31+
ResyncIntv: 60 * time.Second,
3232
}
3333

3434
rec := New(conf, evt).Start()
@@ -71,7 +71,7 @@ func TestDryRunRecorder(t *testing.T) {
7171
conf := &config.KfConfig{
7272
Logger: log.New("info", "", "test"),
7373
LocalDir: "/tmp/ktest",
74-
ResyncIntv: 60,
74+
ResyncIntv: 60 * time.Second,
7575
}
7676

7777
conf.DryRun = true
@@ -106,7 +106,7 @@ func TestFailingFSRecorder(t *testing.T) {
106106
conf := &config.KfConfig{
107107
Logger: log.New("info", "", "test"),
108108
LocalDir: "/tmp/ktest", // fake dir (in memory fs provided by Afero)
109-
ResyncIntv: 60,
109+
ResyncIntv: 60 * time.Second,
110110
}
111111

112112
rec := New(conf, evt).Start()

0 commit comments

Comments
 (0)