carlos / platform Public

activator: the resident ceiling test opens its held starts on failure, so a broken ceiling fails fast instead of hanging Shutdown

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev c71ba3829b199c1767e5ee1cad4f671f069f85f0 parent 7975936
1 file changed, +9 −2
  • internal/activator/rootfs_resident_test.go +9 −2
diff --git a/internal/activator/rootfs_resident_test.go b/internal/activator/rootfs_resident_test.go
index ae7707c07..472f80905 100644
--- a/internal/activator/rootfs_resident_test.go
+++ b/internal/activator/rootfs_resident_test.go
@@ -340,6 +340,13 @@ func TestResidentStartCeilingIsFour(t *testing.T) {
var maxSeen atomic.Int64
stop := make(chan struct{})
sampled := make(chan struct{})
+ // A failure below still opens the gate and ends the sampler before the
+ // cleanup's Shutdown waits on the held wakes (cleanups run last first).
+ var openGate, endSampler sync.Once
+ t.Cleanup(func() {
+ openGate.Do(func() { close(gate) })
+ endSampler.Do(func() { close(stop) })
+ })
go func() {
defer close(sampled)
for {
@@ -363,7 +370,7 @@ func TestResidentStartCeilingIsFour(t *testing.T) {
if n, s := b.startCount(), a.startingNow(); n != 4 || s != 4 {
t.Fatalf("with starts held: %d starts, %d reserved; want 4 and 4", n, s)
}
- close(gate)
+ openGate.Do(func() { close(gate) })
for i := 0; i < 50 && b.startCount() < 10; i++ {
a.rootfsTick()
if s := a.startingNow(); s > residentStartCeiling {
@@ -379,7 +386,7 @@ func TestResidentStartCeilingIsFour(t *testing.T) {
}
return true
})
- close(stop)
+ endSampler.Do(func() { close(stop) })
<-sampled
if n := b.startCount(); n != 10 {
t.Fatalf("starts = %d, want 10", n)