activator: the take-bound test waits for its wake's release marker
CI 82997fbf: the detached take wake's release marker could land after the wake ended and after this test's fixture state was restored, so it was owed into later tests (TestTakeoverLiveOwnerDiagnostic and five more failed acquiring). The cleanup now waits, bounded, until the lock shows the release, while this test's fixture still serves.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+13
−0
internal/activator/hatake_test.go+13 −0
CI cancelled — superseded by a newer push — run details
diff --git a/internal/activator/hatake_test.go b/internal/activator/hatake_test.go| index 1fd92796f..15dfbfa79 100644 |
| --- a/internal/activator/hatake_test.go |
| +++ b/internal/activator/hatake_test.go |
| @@ -359,6 +359,19 @@ func TestTakeWithinTheWakeBound(t *testing.T) { |
| case <-time.After(5 * time.Second): |
| t.Error("the take's detached wake outlived the service's shutdown") |
| } |
| + // The wake's end is not its release: the marker PUT that gives the |
| + // lease back can land after it. Wait for it here, while this test's |
| + // fixture still serves, so it is never owed into a later test's |
| + // (CI 82997fbf: TestTakeoverLiveOwnerDiagnostic and five more). |
| + prefix := s.b.Cfg.hibernatePrefix(s.rt.Host) |
| + deadline := time.Now().Add(10 * time.Second) |
| + for !strings.HasPrefix(haFixOf(s.b).fx.LockOwner(prefix), "released/") { |
| + if time.Now().After(deadline) { |
| + t.Errorf("the take's wake never gave its lease back: owner %q", haFixOf(s.b).fx.LockOwner(prefix)) |
| + break |
| + } |
| + time.Sleep(10 * time.Millisecond) |
| + } |
| }) |
| release := make(chan struct{}) |
| t.Cleanup(func() { close(release) }) |