tsnet: fail the test instead of panicking when a ping times out in test helpers

setupTwoClientTest and TestDialThroughExitNode used
must.Get(lc.Ping(...)) to wait for the TSMP path to come up. When that
ping timed out, must.Get panicked, killing the whole tsnet test binary.
The flakes dashboard then blamed every test that was running or paused
at the time (TestPacketFilterFromNetmap, TestListenService, TestListen*,
TestDialUDP, ...), not just the one whose ping failed.

Use t.Fatalf instead so a failed ping fails only its own test.

The underlying ping failure was the wireguard-go duplicate handshake
initiation race, fixed by the wireguard-go bump in #22537.

Updates #22551

Change-Id: I227852aaa576e500df036bb1700fe6c7589b0a25
Signed-off-by: Brad Fitzpatrick <[email protected]>
This commit is contained in:
Brad Fitzpatrick authored and Brad Fitzpatrick committed 2026-11-23 08:50:06 -08:00
1 parent 0345103edd
commit 7294a69dfd
1 file changed
+6 -2
+6 -2
View File
@@ -615,7 +615,9 @@ func TestDialThroughExitNode(t *testing.T) {
// Ping to make sure the connection is up.
pingCtx, cancelPing := pingTimeout(ctx)
defer cancelPing()
must.Get(lc2.Ping(pingCtx, s1ip, tailcfg.PingTSMP))
if _, err := lc2.Ping(pingCtx, s1ip, tailcfg.PingTSMP); err != nil {
t.Fatalf("TSMP ping s2 -> s1: %v", err)
}
must.Get(lc2.EditPrefs(ctx, &ipn.MaskedPrefs{
Prefs: ipn.Prefs{
@@ -2923,7 +2925,9 @@ func setupTwoClientTest(t *testing.T, useTUN bool) *listenTest {
pingCtx, cancelPing := pingTimeout(ctx)
defer cancelPing()
must.Get(lc1.Ping(pingCtx, s2ip4, tailcfg.PingTSMP))
if _, err := lc1.Ping(pingCtx, s2ip4, tailcfg.PingTSMP); err != nil {
t.Fatalf("TSMP ping s1 -> s2: %v", err)
}
return &listenTest{
control: control,