Skip to content

Commit

Permalink
Fix flaky TestRESTGet in ipgroupassociation (antrea-io#5031)
Browse files Browse the repository at this point in the history
The test should wait for informers to sync once, instead of using a
short sleep. The test was flaky on slower machines.

Signed-off-by: Antonin Bas <[email protected]>
  • Loading branch information
antoninbas authored May 25, 2023
1 parent 74b203a commit 76c2f0e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,11 @@ func TestRESTGet(t *testing.T) {
eeInformer.Informer().AddIndexers(cache.Indexers{grouping.ExternalEntityIPsIndex: grouping.ExternalEntityIPsIndexFunc})

stopCh := make(chan struct{})
defer close(stopCh)
informerFactory.Start(stopCh)
crdInformerFactory.Start(stopCh)
time.Sleep(10 * time.Millisecond)
informerFactory.WaitForCacheSync(stopCh)
crdInformerFactory.WaitForCacheSync(stopCh)

rest := NewREST(podInformer, eeInformer, fakeIPBQuerier{ipGroupMap: ipGroups}, fakeQuerier{groups: groups})
for _, tt := range tests {
Expand Down

0 comments on commit 76c2f0e

Please sign in to comment.