Skip to content

Commit

Permalink
Work around a race from duplicate events in test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaqx0r committed Oct 13, 2020
1 parent 8a57510 commit 0601c73
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/watcher/log_watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ func TestWatcherNewFile(t *testing.T) {
}
w.Close()
expected := []Event{{Op: Create, Pathname: path.Join(tmpDir, "log")}}
if diff := testutil.Diff(expected, s.Events); diff != "" {
// Fetching the start of the slice is a hack because we get duplicate events.
if diff := testutil.Diff(expected, s.Events[0:1]); diff != "" {
t.Errorf("event unexpected: diff:\n%s", diff)
t.Logf("received:\n%v", s.Events)
}
Expand Down

0 comments on commit 0601c73

Please sign in to comment.