| index c707d755d..a5727d5f5 100644 |
| --- a/internal/activator/haleaseloss_test.go |
| +++ b/internal/activator/haleaseloss_test.go |
| @@ -721,3 +721,39 @@ func TestHALostRecoveryFailedPostCheckStopsEntry(t *testing.T) { |
| } |
| assertLossLatched(t, s) |
| } |
| + |
| +func TestHALostRestartOutsidePoolForwardsAfterOwedRelease(t *testing.T) { |
| + for _, latched := range []bool{false, true} { |
| + t.Run(fmt.Sprint(latched), func(t *testing.T) { |
| + s, e, r := lostTestEntry(t) |
| + s.failMarkerPuts(1) |
| + finishLostTestEntry(t, s, e, r) |
| + s2 := s.restart(t) |
| + if len(lease.PendingObligations()) != 1 { |
| + t.Fatal("missing startup obligation") |
| + } |
| + if latched { |
| + s2.a.mu.Lock() |
| + _ = s2.a.haLeaseRefusalLocked(s2.rt) |
| + s2.a.mu.Unlock() |
| + } |
| + s2.b.ServedPools = func() edgesfile.PoolEvidence { return edgesfile.PoolEvidence(`["another-pool"]`) } |
| + s2.a.retryOwedMarkers() |
| + deadline := time.Now().Add(3 * time.Second) |
| + for s2.a.markers.running.Load() && time.Now().Before(deadline) { |
| + time.Sleep(time.Millisecond) |
| + } |
| + if s2.a.markers.running.Load() || len(lease.PendingObligations()) != 0 { |
| + t.Fatal("owed release did not settle") |
| + } |
| + putLockFor(t, s2.b, s2.rt, leaseBody(t, heldByB, time.Now().Add(time.Minute))) |
| + before := len(lockWriteLogOf(s2)) |
| + if d := s2.a.ForwardTarget(t.Context(), s2.rt, nil); d.Ref != "b" || d.Unavailable { |
| + t.Fatalf("ineligible restarted ingress: %+v", d) |
| + } |
| + if len(lockWriteLogOf(s2)) != before || s2.a.entries[s2.rt.Host] != nil { |
| + t.Fatal("ineligible ingress acquired or woke locally") |
| + } |
| + }) |
| + } |
| +} |