Skip to content

Commit

Permalink
we can get double events so double errors; also it can take a while t…
Browse files Browse the repository at this point in the history
…o get events,... so sleep 3s
  • Loading branch information
ldemailly committed Oct 31, 2023
1 parent 4cfcd24 commit 5e50691
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions configmap/loglevel_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ func TestDynamicLogLevelAndBinaryFlag(t *testing.T) {
if err = os.WriteFile(binaryFlag, []byte{1, 2, 3, 4, 5}, 0o644); err != nil {
t.Fatalf("unable to write %v: %v", binaryFlag, err)
}
time.Sleep(2 * time.Second)
assert.Equal(t, u.Errors(), 1, "should have 1 error picked up as we wrote > 4 bytes")
time.Sleep(3 * time.Second)
// We might get more than 1 event for some reasons, so more than 1 error
errCount := u.Errors()
if errCount < 1 {
t.Errorf("Expected at least 1 error because we wrote more than validator accepts, got %d", errCount)
}
}

0 comments on commit 5e50691

Please sign in to comment.