host: ingress drain auto-restart witness checks the box, not the HA tenant
After a SIGKILL the fixture's HA tenant has no clean marker, so the same box cannot re-acquire it until expiry plus proof (region HA §9.4/§9.6, W6 §7), and "waking elsewhere" is the right answer. The automatic restart case now checks the new agent listens, its fixed admission opens and the drain unit is active again, alongside the unchanged drain-order checks. Clean restarts keep the tenant-serving check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+26
−4
internal/host/ingressdrain_rootrunner_linux_test.go+26 −4
Intent
Attributed to this commit: 6.67 g CO₂e (867,320 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on w6-ingress-drain, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/internal/host/ingressdrain_rootrunner_linux_test.go b/internal/host/ingressdrain_rootrunner_linux_test.go| index ab624d91d..de7386ad3 100644 |
| --- a/internal/host/ingressdrain_rootrunner_linux_test.go |
| +++ b/internal/host/ingressdrain_rootrunner_linux_test.go |
| @@ -307,7 +307,15 @@ func (x *ingressRootFixture) awaitServing(why string, since time.Time) { |
| } |
| time.Sleep(time.Second) |
| } |
| - deadline = time.Now().Add(30 * time.Second) |
| + ingressRootAwaitDrainActive(t, why) |
| + t.Logf("%s: tenant serving, drain unit active", why) |
| +} |
| + |
| +// ingressRootAwaitDrainActive waits for the drain unit to be active, which |
| +// Upholds= on the edge brings about after every start of the edge. |
| +func ingressRootAwaitDrainActive(t *testing.T, why string) { |
| + t.Helper() |
| + deadline := time.Now().Add(30 * time.Second) |
| for { |
| out, _ := exec.Command("systemctl", "is-active", ingressRootDrainUnit).Output() |
| if strings.TrimSpace(string(out)) == "active" { |
| @@ -319,7 +327,6 @@ func (x *ingressRootFixture) awaitServing(why string, since time.Time) { |
| } |
| time.Sleep(200 * time.Millisecond) |
| } |
| - t.Logf("%s: tenant serving, drain unit active", why) |
| } |
| // ingressRootAwaitAdmission fails fast when fixed admission does not open |
| @@ -804,6 +811,20 @@ func (x *ingressRootFixture) afterRestart(why string, since time.Time) { |
| x.awaitServing(why, since) |
| } |
| +// afterUncleanRestart is the same after the agent was killed, without the |
| +// tenant: the fixture's tenant is an HA host, and a holder killed without |
| +// its clean marker cannot take its own lock back until the lock expires |
| +// and its termination is proven (region HA §9.4, §9.6; W6 spec §7), so |
| +// a 503 "waking elsewhere" is the product's answer then, not a fault. The |
| +// box is checked instead: the new agent listens and its fixed admission |
| +// opens, and the drain unit is active again. |
| +func (x *ingressRootFixture) afterUncleanRestart(why string, since time.Time) { |
| + x.f.waitLeo() |
| + ingressRootAwaitAdmission(x.t, why, since) |
| + ingressRootAwaitDrainActive(x.t, why) |
| + x.t.Logf("%s: edge listening, admission open, drain unit active", why) |
| +} |
| + |
| // TestRootIngressDrainOrderRestart: `systemctl restart carlos-edge` on a |
| // fixed box with one awake tenant serving a request loop through the edge. |
| func TestRootIngressDrainOrderRestart(t *testing.T) { |
| @@ -823,7 +844,8 @@ func TestRootIngressDrainOrderRestart(t *testing.T) { |
| // edge's main process) and systemd restarts it (Restart=always, which the |
| // fixture otherwise turns off). The drain unit, stopped because its edge |
| // stopped (BindsTo=), finds the socket dead and exits within 1 s, still |
| -// ahead of the tenants; Upholds= starts it again with the edge. |
| +// ahead of the tenants; Upholds= starts it again with the edge. The tenant |
| +// is not asked to serve afterwards (afterUncleanRestart). |
| func TestRootIngressDrainOrderAutoRestart(t *testing.T) { |
| x := newIngressRootFixture(t) |
| dropin := "/run/systemd/system/" + ingressRootEdgeUnit + ".d/20-w6-auto-restart.conf" |
| @@ -857,7 +879,7 @@ func TestRootIngressDrainOrderAutoRestart(t *testing.T) { |
| } |
| time.Sleep(200 * time.Millisecond) |
| } |
| - x.afterRestart("after automatic restart", since) |
| + x.afterUncleanRestart("after automatic restart", since) |
| ingressRootOrder(t, ingressRootJournal(t, since), tenants, true) |
| } |