carlos / platform Public

tests: wait for background work in replica activator tests

Adopts main's waitBackground (27d3f501) in the four Service
constructions this branch's activator tests build without a rig
(stateless_holdwake_test.go). The other branch tests use
newReleaseRig or newWakeRelRig, which already wait.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 20a40dd6a15d816a37cc22ceb0f622ac72d3ee8d parent 0b9b7dd
1 file changed, +4 −0
  • internal/activator/stateless_holdwake_test.go +4 −0
diff --git a/internal/activator/stateless_holdwake_test.go b/internal/activator/stateless_holdwake_test.go
index 815cdcda2..7b116fb1b 100644
--- a/internal/activator/stateless_holdwake_test.go
+++ b/internal/activator/stateless_holdwake_test.go
@@ -31,6 +31,7 @@ func TestStatelessHoldWakeRebasesPreparation(t *testing.T) {
prepare := func(now registry.Route) (*Service, *statelessPreparation) {
t.Helper()
a := &Service{Routes: startupRoutes{began.Host: began}}
+ t.Cleanup(func() { waitBackground(t, a) })
a.cfg.ReplicaRecord = func(registry.Route) (RecordFacts, error) { return facts, nil }
observed, err := a.statelessObservation(context.Background(), began, id, "canonical")
if err != nil {
@@ -203,6 +204,7 @@ func TestReplicaStepRefusalNoBackoff(t *testing.T) {
t.Fatalf("%v counts as a resident failure", err)
}
a := &Service{now: func() time.Time { return now }}
+ t.Cleanup(func() { waitBackground(t, a) })
e := &actEntry{host: rt.Host, route: rt}
a.mu.Lock()
for i := 0; i < 3; i++ {
@@ -244,6 +246,7 @@ func TestReplicaReleaseStepFailuresSayWhatIsKnown(t *testing.T) {
now := time.Unix(1000, 0)
failures := func(err error) int {
a := &Service{now: func() time.Time { return now }}
+ t.Cleanup(func() { waitBackground(t, a) })
e := &actEntry{host: rt.Host, route: rt}
a.mu.Lock()
defer a.mu.Unlock()
@@ -342,6 +345,7 @@ func TestReplicaReleaseNotStartedSaysSo(t *testing.T) {
now := time.Unix(1000, 0)
failures := func(err error) int {
a := &Service{now: func() time.Time { return now }}
+ t.Cleanup(func() { waitBackground(t, a) })
e := &actEntry{host: rt.Host, route: rt}
a.mu.Lock()
defer a.mu.Unlock()