From 3f9c808ea1c5d662a947e37e973e6ce9e737d5d5 Mon Sep 17 00:00:00 2001 From: Simeng He Date: Wed, 9 Jun 2021 10:13:11 -0400 Subject: [PATCH] tstest/integration: fix TestAddPingRequest flaking Added a ticker to readd PingRequests if the previous one was stuck Signed-off-by: Simeng He --- tstest/integration/integration_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tstest/integration/integration_test.go b/tstest/integration/integration_test.go index d2f3e6189..9d2546cfe 100644 --- a/tstest/integration/integration_test.go +++ b/tstest/integration/integration_test.go @@ -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") }