tstest/integration: reenable TestAddPingRequest

Failure understood now; see:
https://github.com/tailscale/tailscale/pull/2088#issuecomment-859896598

As of 333e9e75d4, PingRequest is
now safe for the server to send multiple times, without fear
of the client handling it multiple times.

Fixes #2079

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/2135/head
Brad Fitzpatrick 3 years ago
parent 333e9e75d4
commit 082cc1b0a7

@ -230,7 +230,6 @@ func TestNodeAddressIPFields(t *testing.T) {
} }
func TestAddPingRequest(t *testing.T) { func TestAddPingRequest(t *testing.T) {
t.Skip("flaky in CI, tailscale/issues/2079")
t.Parallel() t.Parallel()
bins := BuildTestBinaries(t) bins := BuildTestBinaries(t)
@ -257,28 +256,34 @@ func TestAddPingRequest(t *testing.T) {
} }
nodeKey := nodes[0].Key nodeKey := nodes[0].Key
for i := 0; i < 10; i++ {
t.Logf("ping %v ...", i) // Check that we get at least one ping reply after 10 tries.
for try := 1; try <= 10; try++ {
t.Logf("ping %v ...", try)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
if err := env.Control.AwaitNodeInMapRequest(ctx, nodeKey); err != nil { if err := env.Control.AwaitNodeInMapRequest(ctx, nodeKey); err != nil {
t.Fatal(err) t.Fatal(err)
} }
cancel() cancel()
pr := &tailcfg.PingRequest{URL: fmt.Sprintf("%s/ping-%d", waitPing.URL, i), Log: true}
ok := env.Control.AddPingRequest(nodeKey, pr) pr := &tailcfg.PingRequest{URL: fmt.Sprintf("%s/ping-%d", waitPing.URL, try), Log: true}
if !ok { if !env.Control.AddPingRequest(nodeKey, pr) {
t.Fatalf("no node found with NodeKey %v in AddPingRequest", nodeKey) t.Logf("failed to AddPingRequest")
continue
} }
// Wait for PingRequest to come back // Wait for PingRequest to come back
pingTimeout := time.NewTimer(2 * time.Second) pingTimeout := time.NewTimer(2 * time.Second)
defer pingTimeout.Stop()
select { select {
case <-gotPing: case <-gotPing:
pingTimeout.Stop() t.Logf("got ping; success")
return
case <-pingTimeout.C: case <-pingTimeout.C:
t.Fatal("didn't get PingRequest from tailscaled") // Try again.
} }
} }
t.Error("all ping attempts failed")
} }
// testEnv contains the test environment (set of servers) used by one // testEnv contains the test environment (set of servers) used by one

Loading…
Cancel
Save