mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
tstest/integration: fix TestAddPingRequest flaking
Added a ticker to readd PingRequests if the previous one was stuck Signed-off-by: Simeng He <simeng@tailscale.com>
This commit is contained in:
parent
8b11937eaf
commit
3f9c808ea1
@ -258,10 +258,21 @@ func TestAddPingRequest(t *testing.T) {
|
||||
}
|
||||
|
||||
// Wait for PingRequest to come back
|
||||
pingTimeout := time.NewTimer(10 * time.Second)
|
||||
waitDuration := 10 * time.Second
|
||||
pingTimeout := time.NewTimer(waitDuration)
|
||||
|
||||
// Ticker sends new PingRequests if the previous did not get through
|
||||
ticker := time.NewTicker(waitDuration / 5)
|
||||
|
||||
select {
|
||||
case <-gotPing:
|
||||
pingTimeout.Stop()
|
||||
ticker.Stop()
|
||||
case <-ticker.C:
|
||||
ok := env.Control.AddPingRequest(nodeKey, pr)
|
||||
if !ok {
|
||||
t.Fatalf("no node found with NodeKey %v in AddPingRequest", nodeKey)
|
||||
}
|
||||
case <-pingTimeout.C:
|
||||
t.Error("didn't get PingRequest from tailscaled")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user