console: TestHooks.LifetimesOn turns lifetimes on for an end-to-end witness of the self-serve request door
The request door admits only on a console that has turned lifetimes on (selfServeAdmits). The hook reads the cutover marker the witness wrote and activates at a clock past the settle, as the watcher's later tick would. Nothing in production calls it.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 file changed,
+17
−0
internal/console/testhooks.go+17 −0
diff --git a/internal/console/testhooks.go b/internal/console/testhooks.go| index 97c9b6400..49048893a 100644 |
| --- a/internal/console/testhooks.go |
| +++ b/internal/console/testhooks.go |
| @@ -104,3 +104,20 @@ func (h *testHooks) NameConsole(s *Server, id string) { |
| s.selfServeIDOnce.Do(func() {}) |
| s.selfServeConsole = id |
| } |
| + |
| +// LifetimesOn turns lifetimes on for s once the witness has written the |
| +// cutover marker (control/lifetimes-cutover.json): one marker read, as the |
| +// watcher's, then the activation at a clock past the settle, as the |
| +// watcher's later tick would. It reports whether lifetimes are on. A |
| +// witness of the self-serve request door needs it: the door admits only on |
| +// a console that has turned lifetimes on (selfServeAdmits). |
| +func (h *testHooks) LifetimesOn(ctx context.Context, s *Server) bool { |
| + if !s.lifetimesGoverned() { |
| + return false |
| + } |
| + g := s.cutover |
| + m, err := readCutoverMarker(ctx, s.cfg.Releases) |
| + g.observe(m, err, g.clock()) |
| + g.activateWhenDrained(g.clock().Add(lifetimeSettle)) |
| + return s.lifetimesOn() |
| +} |