mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-20 11:58:39 +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
|
// 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 {
|
select {
|
||||||
case <-gotPing:
|
case <-gotPing:
|
||||||
pingTimeout.Stop()
|
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:
|
case <-pingTimeout.C:
|
||||||
t.Error("didn't get PingRequest from tailscaled")
|
t.Error("didn't get PingRequest from tailscaled")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user