Skip to content

Commit 91435ce

Browse files
committed
deflake TestCacheLaggingWatcher by waiting for resync
Signed-off-by: Peter Chang <[email protected]>
1 parent a8822f3 commit 91435ce

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/integration/cache_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,7 @@ func TestCacheLaggingWatcher(t *testing.T) {
10631063
wantExactEventCount int
10641064
wantAtMaxEventCount int
10651065
wantClosed bool
1066+
postGenerateDelay time.Duration
10661067
}{
10671068
{
10681069
name: "all event fit",
@@ -1091,6 +1092,7 @@ func TestCacheLaggingWatcher(t *testing.T) {
10911092
eventCount: 12,
10921093
wantAtMaxEventCount: 1, // Either 0 or 1.
10931094
wantClosed: true,
1095+
postGenerateDelay: 100 * time.Millisecond,
10941096
},
10951097
}
10961098

@@ -1113,6 +1115,11 @@ func TestCacheLaggingWatcher(t *testing.T) {
11131115
ch := c.Watch(t.Context(), prefix, clientv3.WithPrefix())
11141116

11151117
generateEvents(t, client, prefix, tt.eventCount)
1118+
1119+
if tt.postGenerateDelay > 0 {
1120+
time.Sleep(tt.postGenerateDelay)
1121+
}
1122+
11161123
gotEvents, ok := collectAndAssertAtomicEvents(t, ch)
11171124
closed := !ok
11181125

0 commit comments

Comments
 (0)