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>
This commit is contained in:
committed by
GitHub
parent
dfc2667f8f
commit
ec86f0ff93
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user