Skip to content

Commit

Permalink
test: Fix flaky test by adding wait
Browse files Browse the repository at this point in the history
Signed-off-by: morimoto-cybozu <kenji_morimoto@cybozu.co.jp>
  • Loading branch information
morimoto-cybozu committed Nov 22, 2024
1 parent 6b4b060 commit da6cc4d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions models/etcd/dhcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ func testSetupConfig(t *testing.T, d *driver, ch <-chan struct{}) {
t.Fatal(err)
}
<-ch

// extra wait; the stateless watcher may send one additional message to the channel in rare cases
for {
_, err := d.getDHCPConfig()
if err == nil {
return
}
time.Sleep(100 * time.Millisecond)
}
}

func testDHCPLease(t *testing.T) {
Expand Down

0 comments on commit da6cc4d

Please sign in to comment.