region HA: take always-on workers; bound a take's wait on a first wake
Fix round 1 of Task 4 (T4-1, T4-2). - T4-1: a take for an always-on worker resolved only through the HTTP route table, which holds no sidecars, so it was refused no_route. The edge now falls back to the host's own sidecar row in its registry (status ready or empty), and the activator wakes it through the worker wake; sidecars stay out of HTTP routing. The same pool, admission, drain and lifetime checks run first. - T4-2: a take's wait could be extended by a first wake's budget. It now waits under its own wakeWaitBound context (takeWake); WakeWorker's body moves to wakeWorker(ctx, rt) so a worker take is bounded too, while WakeWorker and ordinary request waiters keep the extension and the detached wake is never cancelled.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/activator/activator.go+11 −1internal/activator/hatake.go+34 −8internal/activator/hatake_test.go+164 −0internal/edge/hatake.go+30 −6internal/edge/hatake_test.go+43 −3
Intent
<task-notification> <task-id>a890e20fe29e249dd</task-id> <tool-use-id>toolu_01C3LN8C2wCYReNx9zAKdVmo</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/283be278-5c6a-4a71-a8d6-b3d32c668985/tasks/a890e20fe29e249dd.output</output-file> <status>completed</status> <summary>Agent "Implement Task 4: take endpoint" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: DONE_WITH_CONCERNS Commits on region-ha-held-build, not pushed: - `171c1024` the take request (edge, activator, host) - `8cb1b3e1` census overlay - `bde2d5d3` one extra test case Tests: all the new take tests pass in activator, edge and host. All 17 mutations fail a test, including M1, where the take skips DecideAcquire (I1). Neighbouring tests in lease, activator, edge and host still pass. The census test passes, gofmt and vet are clean, and the darwin and windows builds work. The client call for Task 5 is `Edge.Take(ctx, peer, host, lifetime, markerGen, txn) (holderRef, lockGen, err)`, with `Edge.PeerTakes(ref)` for choosing successors. Concerns: 1. No test runs a real Edge against a real activator Service. The edge tests use a fake, and the activator tests use the real lease against the lock fixture. The wiring between them is only a compile-time check, so the two-activator integration test is still owed in Task 5 or 6. 2. If the draining box stops waiting (40 s), the successor's wake still finishes. The successor may then hold the host while the drain records a failed take. This is safe, but the report will call it a failure. 3. Census: re-proposed with NAME=region-ha-held-build (seal `8caa7d24`). The cross-family verdict on #280 is still owed. Small change: the drain path's signature-refusal log line now names the path; nothing matched the old text. Report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-held-build/.superpowers/sdd/2026-11-08-region-ha-held-requests/task-4-report.md</result> <usage><subagent_tokens>277365</subagent_tokens><tool_uses>96</tool_uses><duration_ms>1717569</duration_ms></usage> </task-notification>
diff --git a/internal/activator/activator.go b/internal/activator/activator.go| index cb1c8eeb4..3486d329c 100644 |
| --- a/internal/activator/activator.go |
| +++ b/internal/activator/activator.go |
| @@ -4029,6 +4029,14 @@ func (a *Service) awaitWorkerSettle(ctx context.Context, e *actEntry, proc Proc) |
| // Idempotent: concurrent and repeated calls coalesce on the ONE wake, exactly |
| // as concurrent requests do — three calls produce one child. |
| func (a *Service) WakeWorker(rt registry.Route) error { |
| + return a.wakeWorker(context.Background(), rt) |
| +} |
| + |
| +// wakeWorker is WakeWorker whose waits also end with ctx: a take |
| +// (hatake.go) bounds its wait with it, and WakeWorker passes Background, |
| +// so its own waits are unchanged. ctx never reaches the wake, which runs |
| +// detached and cleans up on its own. |
| +func (a *Service) wakeWorker(ctx context.Context, rt registry.Route) error { |
| if !a.TenantAdmitted() && !a.TenantAdmissionExempt(rt) { |
| return ErrTenantAdmission |
| } |
| @@ -4113,7 +4121,7 @@ func (a *Service) WakeWorker(rt registry.Route) error { |
| // request does (Astra R3 flag triage T10): without it a |
| // fallback that succeeds after the ordinary bound was reported |
| // as a timeout. |
| - if err := a.awaitWake(context.Background(), e, ready, deadline, arrival, &extended); err != nil { |
| + if err := a.awaitWake(ctx, e, ready, deadline, arrival, &extended); err != nil { |
| return err |
| } |
| // A failed wake reports to every coalesced caller; retrying |
| @@ -4127,6 +4135,8 @@ func (a *Service) WakeWorker(rt registry.Route) error { |
| select { |
| case <-stopped: |
| continue // entry is gone; loop wakes it fresh |
| + case <-ctx.Done(): |
| + return ctx.Err() |
| case <-deadline.C: |
| return errWakeTimeout |
| } |
diff --git a/internal/activator/hatake.go b/internal/activator/hatake.go| index 82a884020..882e0b3f6 100644 |
| --- a/internal/activator/hatake.go |
| +++ b/internal/activator/hatake.go |
| @@ -19,8 +19,8 @@ import ( |
| // and so hafresh.DecideAcquire (I1). Nothing here reads or writes the lock |
| // itself, and nothing the request carries is an input to the acquire: the |
| // marker generation it names is reported, never trusted. A lock in any |
| -// state other than that marker gets the normal acquire decision. begin |
| -// never forwards, and bounds its wait by wakeWaitBound. |
| +// state other than that marker gets the normal acquire decision. The wake |
| +// never forwards, and its wait is bounded by wakeWaitBound (takeWake). |
| var _ edge.HATaker = (*Service)(nil) |
| @@ -65,10 +65,12 @@ func (b *ExecBackend) haAcquiredGeneration(host string) (int64, bool) { |
| // any lock request, unless this box serves rt's pool, is admitted (an |
| // admission exemption does not count), is not draining, and classifies rt |
| // as HA (isHA, the one classification) with the lifetime the take names: |
| -// a host only marked HA, with no lifetime, has no valid record. Then it wakes rt as a request |
| -// would, without counting activity, and answers the owner the acquire read |
| -// or wrote: this box at the generation it wrote, another box that holds |
| -// the lease at the generation the acquire read, or none with the reason. |
| +// a host only marked HA, with no lifetime, has no valid record. Then it |
| +// wakes rt (takeWake: as a request wakes an instance, or as the sweep |
| +// wakes a worker), without counting activity, and answers the owner the |
| +// acquire read or wrote: this box at the generation it wrote, another box |
| +// that holds the lease at the generation the acquire read, or none with |
| +// the reason. |
| func (a *Service) TakeHost(ctx context.Context, rt registry.Route, lifetime string, markerGen int64) edge.TakeAnswer { |
| tb := takeBackendFor(a.backend, rt) |
| self, _ := boxSelfRef(a.backend) |
| @@ -86,9 +88,8 @@ func (a *Service) TakeHost(ctx context.Context, rt registry.Route, lifetime stri |
| if err != nil || !ha || got == "" || got != lifetime { |
| return edge.TakeAnswer{Refused: edge.TakeRefusedRecord} |
| } |
| - release, err := a.begin(ctx, rt, false, nil) |
| + err = a.takeWake(ctx, rt) |
| if err == nil { |
| - release() |
| gen, ok := tb.haAcquiredGeneration(rt.Host) |
| if !ok { |
| return edge.TakeAnswer{Reason: "the host is awake here without an HA lease"} |
| @@ -103,3 +104,28 @@ func (a *Service) TakeHost(ctx context.Context, rt registry.Route, lifetime stri |
| } |
| return edge.TakeAnswer{Reason: fmt.Sprintf("the wake failed (marker generation %d): %v", markerGen, err)} |
| } |
| + |
| +// takeWake is the take's wake of rt: the ordinary request wake (begin, |
| +// with no activity stamp and no request) for an instance, or the worker |
| +// wake for an always-on worker (a sidecar row), as the sweep starts one. |
| +// Its wait has its own wakeWaitBound, which a first wake's extension |
| +// (awaitWake) cannot lengthen: the bound is a context, and the extension |
| +// only resets begin's timer. The wake itself runs detached and is not |
| +// cancelled. A wait that reaches the bound is errWakeTimeout. |
| +func (a *Service) takeWake(ctx context.Context, rt registry.Route) error { |
| + wctx, cancel := context.WithTimeout(ctx, wakeWaitBound) |
| + defer cancel() |
| + var err error |
| + if rt.IsSidecar() { |
| + err = a.wakeWorker(wctx, rt) |
| + } else { |
| + var release func() |
| + if release, err = a.begin(wctx, rt, false, nil); err == nil { |
| + release() |
| + } |
| + } |
| + if err != nil && ctx.Err() == nil && errors.Is(err, context.DeadlineExceeded) { |
| + err = errWakeTimeout |
| + } |
| + return err |
| +} |
diff --git a/internal/activator/hatake_test.go b/internal/activator/hatake_test.go| index 0504a9536..9daf14cc1 100644 |
| --- a/internal/activator/hatake_test.go |
| +++ b/internal/activator/hatake_test.go |
| @@ -3,6 +3,7 @@ package activator |
| import ( |
| "context" |
| "encoding/json" |
| + "errors" |
| "strings" |
| "sync" |
| "testing" |
| @@ -344,3 +345,166 @@ func TestTakeWithinTheWakeBound(t *testing.T) { |
| t.Fatalf("take: %+v, want no holder: the wake timed out", ans) |
| } |
| } |
| + |
| +// An always-on worker (a sidecar row) is taken through the worker wake, |
| +// on the real HA lease, and so under the duty rule (§7.1) as well as the |
| +// HA acquire. A marker this box released: the worker wake acquires it, |
| +// the worker runs, and the answer names this box at the generation it |
| +// wrote, for one lock GET and one conditional PUT. A marker another box |
| +// released: the duty rule drops the duty, so the take names no holder and |
| +// writes nothing (see the fix report: a planned handover of a worker |
| +// needs a ruling on §7.1). |
| +func TestTakeAlwaysOnWorker(t *testing.T) { |
| + for name, tc := range map[string]struct { |
| + box, iid string |
| + want edge.TakeAnswer |
| + reason string |
| + }{ |
| + "a marker this box released": {"a", "i-a", edge.TakeAnswer{Holder: "a", Gen: 7}, ""}, |
| + "a marker another box released": {"x", "i-x", edge.TakeAnswer{}, "ha_duty"}, |
| + } { |
| + t.Run(name, func(t *testing.T) { |
| + s := haSidecarService(t) |
| + if !s.rt.IsSidecar() || !s.rt.HA { |
| + t.Fatalf("not a born HA worker: %+v", s.rt) |
| + } |
| + e, ok := s.b.Lifetimes.Lookup(s.rt.Host) |
| + if !ok || e.ID == "" { |
| + t.Fatalf("no lifetime for the worker: %+v", e) |
| + } |
| + body, err := hafresh.MarkerBody(6, hafresh.Marker{V: 1, Box: tc.box, IID: tc.iid, Lifetime: e.ID, TXID: 3, Clean: true}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + putLockFor(t, s.b, s.rt, body) |
| + before := len(s.lockReqs()) |
| + ans := s.a.TakeHost(context.Background(), s.rt, e.ID, 6) |
| + if tc.reason != "" { |
| + if ans.Holder != "" || ans.Refused != "" || !strings.Contains(ans.Reason, tc.reason) { |
| + t.Fatalf("worker take: %+v, want no holder for %q", ans, tc.reason) |
| + } |
| + if string(lockBodyOf(s.b, s.rt)) != string(body) || s.a.HoldsAwake(s.rt.Host) { |
| + t.Fatal("a deferred worker take wrote the lock or started the worker") |
| + } |
| + for _, r := range s.lockReqs()[before:] { |
| + if !strings.HasPrefix(r, "GET ") { |
| + t.Fatalf("a deferred worker take wrote: %v", s.lockReqs()[before:]) |
| + } |
| + } |
| + return |
| + } |
| + if ans != tc.want { |
| + t.Fatalf("worker take: %+v, want %+v", ans, tc.want) |
| + } |
| + if !s.a.HoldsAwake(s.rt.Host) { |
| + t.Fatal("the worker is not running after the take") |
| + } |
| + s.a.mu.Lock() |
| + worker := s.a.entries[s.rt.Host].worker |
| + s.a.mu.Unlock() |
| + if !worker { |
| + t.Fatal("the worker was woken through the instance path") |
| + } |
| + l := s.lockNow(t) |
| + if o, ok := hafresh.ParseOwner(l.Owner); !ok || o.Ref != "a" || !o.HA || l.Generation != 7 || l.Release != nil { |
| + t.Fatalf("the lock is %+v, want a's HA lease at generation 7", l) |
| + } |
| + if got := s.lockReqs()[before:]; len(got) != 2 || !strings.HasPrefix(got[0], "GET ") || !strings.HasPrefix(got[1], "PUT ") { |
| + t.Fatalf("lock requests %v, want exactly one GET and one PUT", got) |
| + } |
| + n := len(s.lockReqs()) |
| + if got := s.a.TakeHost(context.Background(), s.rt, "L-other", 6); got.Refused != edge.TakeRefusedRecord { |
| + t.Fatalf("another lifetime: %+v", got) |
| + } |
| + if len(s.lockReqs()) != n { |
| + t.Fatal("a refused worker take made lock requests") |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// A take's wait is held to wakeWaitBound even on a first wake, whose |
| +// waiters awaitWake gives an extended budget; ordinary waiters on the same |
| +// wake still get the extension, and the wake itself is not cancelled. |
| +func TestTakeBoundOnAFirstWake(t *testing.T) { |
| + for name, worker := range map[string]bool{"an instance": false, "a worker": true} { |
| + t.Run(name, func(t *testing.T) { |
| + var s *haSvc |
| + if worker { |
| + s = haSidecarService(t) |
| + } else { |
| + s = haService(t, "shop.example.com") |
| + } |
| + lifetime := haFixOf(s.b).lifetime |
| + if worker { |
| + e, _ := s.b.Lifetimes.Lookup(s.rt.Host) |
| + lifetime = e.ID |
| + } |
| + old := wakeWaitBound |
| + wakeWaitBound = 200 * time.Millisecond |
| + t.Cleanup(func() { wakeWaitBound = old }) |
| + extendedCh := make(chan struct{}, 4) |
| + oldHook := wakeBoundExtended |
| + wakeBoundExtended = func() { extendedCh <- struct{}{} } |
| + t.Cleanup(func() { wakeBoundExtended = oldHook }) |
| + // A first wake under way: never ready until the test ends it. |
| + var e *actEntry |
| + s.a.mu.Lock() |
| + if worker { |
| + e = s.a.newWorkerEntry(s.rt) |
| + } else { |
| + e = &actEntry{host: s.rt.Host, route: s.rt, state: actWaking, ready: make(chan struct{})} |
| + } |
| + e.firstWake = true |
| + s.a.putEntryLocked(s.rt.Host, e) |
| + s.a.mu.Unlock() |
| + t.Cleanup(func() { |
| + s.a.mu.Lock() |
| + e.err = errors.New("test over") |
| + close(e.ready) |
| + delete(s.a.entries, s.rt.Host) |
| + s.a.mu.Unlock() |
| + }) |
| + // An ordinary waiter: extended past the bound. |
| + ordinary := make(chan error, 1) |
| + go func() { |
| + if worker { |
| + ordinary <- s.a.WakeWorker(s.rt) |
| + } else { |
| + _, err := s.a.beginRequest(context.Background(), s.rt) |
| + ordinary <- err |
| + } |
| + }() |
| + took := make(chan edge.TakeAnswer, 1) |
| + began := time.Now() |
| + go func() { took <- s.a.TakeHost(context.Background(), s.rt, lifetime, 6) }() |
| + select { |
| + case ans := <-took: |
| + if d := time.Since(began); d > 2*time.Second { |
| + t.Fatalf("the take answered after %s", d) |
| + } |
| + if ans.Holder != "" || !strings.Contains(ans.Reason, errWakeTimeout.Error()) { |
| + t.Fatalf("take: %+v, want the wake timeout", ans) |
| + } |
| + case <-time.After(5 * time.Second): |
| + t.Fatal("the take's wait was extended past the wake wait bound") |
| + } |
| + select { |
| + case <-extendedCh: |
| + case <-time.After(2 * time.Second): |
| + t.Fatal("no waiter's bound was extended: not a first wake") |
| + } |
| + select { |
| + case err := <-ordinary: |
| + t.Fatalf("the ordinary waiter lost its first-wake extension: %v", err) |
| + case <-time.After(300 * time.Millisecond): |
| + } |
| + s.a.mu.Lock() |
| + still := s.a.entries[s.rt.Host] == e && e.state == actWaking |
| + s.a.mu.Unlock() |
| + if !still { |
| + t.Fatal("the take ended the wake it waited on") |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/edge/hatake.go b/internal/edge/hatake.go| index b4a2db36b..80395db09 100644 |
| --- a/internal/edge/hatake.go |
| +++ b/internal/edge/hatake.go |
| @@ -154,22 +154,46 @@ func takeLogPart(name, v string) string { |
| return "; " + name + ": " + v |
| } |
| -// takeHost is the take's route and activator: the host's own route on this |
| -// box, exactly (no catch-all, no alias), hibernate-managed here. Whether |
| -// it is HA is the activator's classification, from record facts. |
| +// takeHost is the take's route and activator. An instance is the host's |
| +// own row in the in-memory route table, exactly (no catch-all, no alias: |
| +// the row's Host must equal the asked host), hibernate-managed here and |
| +// not tunnelled. An always-on worker is a sidecar row, which that table |
| +// never holds (sidecars serve no traffic), so it is read from the |
| +// registry the table is built from (takeWorker). Whether the host is HA, |
| +// and every other check, is the activator's. |
| func (e *Edge) takeHost(ctx context.Context, ask haTakeAsk) TakeAnswer { |
| taker, ok := e.act.(HATaker) |
| if !ok { |
| return TakeAnswer{Refused: TakeRefusedNoTaker} |
| } |
| - up, ok := e.current()[ask.Host] |
| - if !ok || up.route.Host != ask.Host || !up.hibernating || up.viaTunnel { |
| + var rt registry.Route |
| + if up, ok := e.current()[ask.Host]; ok && up.route.Host == ask.Host && up.hibernating && !up.viaTunnel { |
| + rt = up.route |
| + } else if w, ok := e.takeWorker(ask.Host); ok { |
| + rt = w |
| + } else { |
| return TakeAnswer{Refused: TakeRefusedNoRoute} |
| } |
| if takeHook != nil { |
| takeHook(ask.Host) |
| } |
| - return taker.TakeHost(ctx, up.route, ask.Lifetime, ask.MarkerGen) |
| + return taker.TakeHost(ctx, rt, ask.Lifetime, ask.MarkerGen) |
| +} |
| + |
| +// takeWorker is host's sidecar row in this edge's registry, when it is one |
| +// the activator may start (status ready, or the legacy empty status, as |
| +// AlwaysOnWorkers selects). One local registry read, made only for a take |
| +// the route table did not answer. A sidecar stays out of HTTP routing: |
| +// this is the take's lookup alone. |
| +func (e *Edge) takeWorker(host string) (registry.Route, bool) { |
| + if e.reg == nil { |
| + return registry.Route{}, false |
| + } |
| + rt, err := e.reg.Get(host) |
| + if err != nil || rt == nil || rt.Host != host || !rt.IsSidecar() || (rt.Status != "" && rt.Status != "ready") { |
| + return registry.Route{}, false |
| + } |
| + return *rt, true |
| } |
| // TakeRefusedError is a take the successor refused before any acquire. |
diff --git a/internal/edge/hatake_test.go b/internal/edge/hatake_test.go| index 3496757f6..219bba9f2 100644 |
| --- a/internal/edge/hatake_test.go |
| +++ b/internal/edge/hatake_test.go |
| @@ -26,9 +26,15 @@ const takeHostName = "moving.example.com" |
| var takeRoute = registry.Route{Host: takeHostName, Kind: "instance", HA: true, Hibernate: true, Provisioned: true, |
| Socket: "/nonexistent/take.sock", Status: "ready", Account: "bdk", App: "shop", Pool: "ha"} |
| +// takeWorkerRoute is an always-on worker's row on the successor: a |
| +// sidecar, which the HTTP route table never holds. |
| +var takeWorkerRoute = registry.Route{Host: "bot.shop.bdk.sidecar.internal", Kind: "sidecar", HA: true, Provisioned: true, |
| + Status: "ready", Account: "bdk", App: "shop", Pool: "ha"} |
| + |
| type takeCall struct { |
| host, lifetime string |
| markerGen int64 |
| + sidecar bool |
| } |
| // takerAct is an Activator with a take half. |
| @@ -42,7 +48,7 @@ type takerAct struct { |
| func (f *takerAct) TakeHost(_ context.Context, rt registry.Route, lifetime string, markerGen int64) TakeAnswer { |
| f.mu.Lock() |
| defer f.mu.Unlock() |
| - f.calls = append(f.calls, takeCall{rt.Host, lifetime, markerGen}) |
| + f.calls = append(f.calls, takeCall{rt.Host, lifetime, markerGen, rt.IsSidecar()}) |
| return f.answer |
| } |
| @@ -79,7 +85,9 @@ func newTakeScene(t *testing.T) *takeScene { |
| s := &takeScene{drainScene: newDrainScene(t), bettyAct: &takerAct{}, carolAct: &takerAct{}} |
| s.extra = map[string]map[string]any{"betty": {"ha_take": 1}, "carol": {"ha_take": 1}} |
| s.annie = s.add(t, "annie", "127.0.0.11", "shop.example.com", "eu-west-1") |
| - s.betty = s.addWith(t, "betty", "127.0.0.12", "blog.example.com", "eu-west-1", s.bettyAct, takeRoute) |
| + failed := takeWorkerRoute |
| + failed.Host, failed.Status = "failed.shop.bdk.sidecar.internal", "failed" |
| + s.betty = s.addWith(t, "betty", "127.0.0.12", "blog.example.com", "eu-west-1", s.bettyAct, takeRoute, takeWorkerRoute, failed) |
| s.carol = s.addWith(t, "carol", "127.0.0.13", "news.example.com", "eu-west-1", s.carolAct, takeRoute) |
| for _, x := range []*drainBox{s.annie, s.betty, s.carol} { |
| s.file(t, x, drainGen0, notDrain) |
| @@ -113,7 +121,7 @@ func TestTakeAnswersTheHolder(t *testing.T) { |
| if err != nil || holder != tc.holder || gen != tc.gen { |
| t.Fatalf("take: %q %d %v, want %s at %d", holder, gen, err, tc.holder, tc.gen) |
| } |
| - if got := s.bettyAct.taken(); len(got) != 1 || got[0] != (takeCall{takeHostName, "L-1", 6}) { |
| + if got := s.bettyAct.taken(); len(got) != 1 || got[0] != (takeCall{takeHostName, "L-1", 6, false}) { |
| t.Fatalf("betty's activator was asked %+v", got) |
| } |
| }) |
| @@ -125,6 +133,38 @@ func TestTakeAnswersTheHolder(t *testing.T) { |
| } |
| } |
| +// An always-on worker is a sidecar row, never in the HTTP route table: a |
| +// signed take still reaches the activator with the worker's own row, while |
| +// an ordinary request for the worker's name is served by nothing. |
| +func TestTakeAlwaysOnWorker(t *testing.T) { |
| + s := newTakeScene(t) |
| + s.bettyAct.answer = TakeAnswer{Holder: "betty", Gen: 3} |
| + holder, gen, err := s.annie.edge().Take(context.Background(), "betty", takeWorkerRoute.Host, "L-w", 2, "txn-1") |
| + if err != nil || holder != "betty" || gen != 3 { |
| + t.Fatalf("worker take: %q %d %v", holder, gen, err) |
| + } |
| + if got := s.bettyAct.taken(); len(got) != 1 || got[0] != (takeCall{takeWorkerRoute.Host, "L-w", 2, true}) { |
| + t.Fatalf("betty's activator was asked %+v", got) |
| + } |
| + _, _, err = s.annie.edge().Take(context.Background(), "betty", "failed.shop.bdk.sidecar.internal", "L-w", 2, "txn-1") |
| + var re *TakeRefusedError |
| + if !errors.As(err, &re) || re.Reason != TakeRefusedNoRoute { |
| + t.Fatalf("a worker row not ready: %v, want refused %s", err, TakeRefusedNoRoute) |
| + } |
| + if _, ok := s.betty.edge().current()[takeWorkerRoute.Host]; ok { |
| + t.Fatal("the worker entered the HTTP route table") |
| + } |
| + r := httptest.NewRequest(http.MethodGet, "http://"+takeWorkerRoute.Host+"/", nil) |
| + w := httptest.NewRecorder() |
| + s.betty.edge().ServeHTTP(w, r) |
| + if s.bettyAct.served() != 0 || len(s.betty.appSaw()) != 0 || w.Code == http.StatusOK { |
| + t.Fatalf("an ordinary request for the worker was served: %d", w.Code) |
| + } |
| + if n := len(s.bettyAct.taken()); n != 1 { |
| + t.Fatalf("takes reached the activator %d times, want 1", n) |
| + } |
| +} |
| + |
| // What the asker makes of each answer that names no confirmed holder. |
| func TestTakeAnswersWithoutAHolder(t *testing.T) { |
| s := newTakeScene(t) |