summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJames 'zofrex' Sanderson <jsanderson@tailscale.com>2026-04-20 15:58:21 +0100
committerGitHub <noreply@github.com>2026-04-20 15:58:21 +0100
commitec86f0ff93f571478af1277712f74558db0325fd (patch)
treefe6f4bec5791a137dcc0c062aa231dd933518e7d
parentdfc2667f8f35cd0496c7dd732b7b042ea5c9a1e6 (diff)
downloadtailscale-ec86f0ff93f571478af1277712f74558db0325fd.tar.xz
tailscale-ec86f0ff93f571478af1277712f74558db0325fd.zip
ipn/ipnlocal: make TestStateMachine less flaky (#19434)
TestStateMachine & TestStateMachineSeamless both flake a lot asserting the "Shutdown" call on cc after a Logout. This is because Shutdown is called on a goroutine to avoid a deadlock if it's called while holding the LocalBackend lock (#18052). This fixes that cause of flakes by waiting for LocalBackend's goroutine tracker to have no goroutines running (so the goroutine that calls Shutdown must have finished). This does not make TestStateMachine non-flaky because it can flake later in the test, too: the assertion on "unpause" after clearing the netmap between "Start4" and "Start4 -> netmap" sometimes fails. Updates tailscale/corp#36230 Updates #19377 Updates #18052 Signed-off-by: James Sanderson <jsanderson@tailscale.com>
-rw-r--r--ipn/ipnlocal/state_test.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/ipn/ipnlocal/state_test.go b/ipn/ipnlocal/state_test.go
index 428949a61..5d29e3d2a 100644
--- a/ipn/ipnlocal/state_test.go
+++ b/ipn/ipnlocal/state_test.go
@@ -700,6 +700,7 @@ func runTestStateMachine(t *testing.T, seamless bool) {
notifies.expect(5)
b.Logout(context.Background(), ipnauth.Self)
{
+ b.awaitNoGoroutinesInTest()
nn := notifies.drain(5)
previousCC.assertCalls("pause", "Logout", "unpause", "Shutdown")
// nn[0] is state notification (Stopped)