Files
mesh-controller/internal/link/builds_current_test.go
T
jochen bde4b61b3b The build role is the node-scoped seat node-build-agent, and its work is shared by every holder (hq ADR 0190)
One build machine built everything, in a queue of one, because the seat was mesh-scoped and a
mesh seat has one holder. ADR 0190 makes building a node role: node-build-agent, held on every
machine that builds, with the work asked of the role and taken by whichever holder is idle. The
work subject of a node-scoped seat carries no node — that token is for a seat's tools, asked of
one machine (design 33 §4) — so holders on several machines read one queue; a test now says so.

The retired mesh-build-machine row stays while the builder module's registered manifest claims
it: a claim to a seat the mesh no longer defines is refused, and the machine holding it would be
unresolvable until build-agent replaces it. Removed once no manifest claims it.

The installer's genesis template (in the host's repository) still grants the controller the old
seat's subjects; its test here says so until that template names node-build-agent.
2026-10-02 22:31:55 +02:00

37 lines
1.7 KiB
Go

package link
import (
"strings"
"testing"
)
// **The old bus announces a build under both names, and that is not belt-and-braces.**
//
// A build's outcome belongs to the role now, so a catalogue built from the current manifests listens
// for the role's name — and a catalogue already running listens for the module's, because that is what
// it was told when it was installed. A rename on a live bus needs publisher and subscriber to change
// together, which a deployment cannot promise: one arrives first, and in that window the module graph
// silently stops being updated.
//
// Caught by asking what merging this would do to the mesh that is actually running, which is the only
// place the question could have been asked — the tests were green and both buses were self-consistent.
func TestTheOldBusAnnouncesABuildUnderBothNames(t *testing.T) {
// The routing key a catalogue installed before the change is bound to.
if KeyModuleBuilt != "module.builder.built" {
t.Fatalf("the module's own name is %q; a catalogue already running is bound to the old one",
KeyModuleBuilt)
}
// And the local name a catalogue built from the current manifests declares, which the old bus's
// client turns into `module.<role>.built`.
if KeyRoleBuilt != "built" {
t.Fatalf("the role's event is %q, and a holder emits its verbs bare", KeyRoleBuilt)
}
if TheBuildMachine != "node-build-agent" {
t.Fatalf("the role is %q", TheBuildMachine)
}
// The two must differ, or one publish would serve both and this doubling would be pointless.
if strings.HasSuffix(KeyModuleBuilt, "."+TheBuildMachine+"."+KeyRoleBuilt) {
t.Fatal("the two names are the same, so nothing was renamed and this is dead weight")
}
}