The controller asks no build of anybody (ADR 0501 §5, ADR 0525 clause 6, ADR 0503 §3). Every module of a walk is taken from the builder's done key; a key not done yet waits, named in the plan, and never fails it. - C2b/C2c: internal/builder and cmd/mesh-controller's asks go (askABuild, onlyTheBuildersOwn, buildOneAsked, takeIn from an outcome, buildAgentsOwn, the builder's say and its fallback, the daemon hearing an outcome). The server follows the retired seats' built subjects only to let go of them, because the installer's carried user list names them. - C2d: replay, queue, cancel, clear, kill, pause, resume, delivery-check, check-here and merge-gate are refused by name. - C3: the check queues (CHECKS_READY, CHECKS_OTHER) and their workers, the checks-running and plans-building buckets and their grants, the build queue and its hold (plans_building.go, queue.go, link/holds.go, builds_nats.go, checks_nats.go). - C4: merge_gate*.go, the pull request's repo-check path, the Checked event and its layers; a pull request asks the controller nothing but to tell mesh-config what its head declares. - C5: the builds bucket is written only by key_takein. - C10 (help and refusals): the terminal's help lists only what is served. Integration tests of the plan's tiers, sends, stops and retries now run on a stand-in builder with a done key for every module (walk_keys_scaffold_integration_test.go); the tests of the asks, the queue, the merge gate and the replays are deleted.
46 lines
1.5 KiB
Go
46 lines
1.5 KiB
Go
package broker
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
)
|
|
|
|
// The catalogue's list of the mesh's own stream names, which a module's stream may not take, is the broker's
|
|
// own list (novox/hq ADR 0363 §1): read from MeshStreams, so a stream added there cannot be forgotten there.
|
|
//
|
|
// **The names of streams the mesh no longer asserts stay reserved** (R4g, ADR 0525 clause 6): the pull requests' two check
|
|
// queues are left on the bus until a cleanup removes them, and no module may take their names meanwhile. So the catalogue
|
|
// reserves every name of the broker's own, and may reserve these retired ones beside them.
|
|
func TestTheCataloguesReservedStreamNamesAreTheMeshsOwn(t *testing.T) {
|
|
retired := []string{"CHECKS_OTHER", "CHECKS_READY"}
|
|
var own []string
|
|
for _, s := range MeshStreams() {
|
|
own = append(own, s.Name)
|
|
}
|
|
reserved := append([]string(nil), catalogue.MeshStreamNames...)
|
|
slices.Sort(own)
|
|
slices.Sort(reserved)
|
|
var extra []string
|
|
for _, name := range reserved {
|
|
if !slices.Contains(own, name) {
|
|
extra = append(extra, name)
|
|
}
|
|
}
|
|
var missing []string
|
|
for _, name := range own {
|
|
if !slices.Contains(reserved, name) {
|
|
missing = append(missing, name)
|
|
}
|
|
}
|
|
for _, name := range extra {
|
|
if !slices.Contains(retired, name) {
|
|
t.Errorf("the catalogue reserves %s, which the broker neither asserts nor names retired", name)
|
|
}
|
|
}
|
|
if len(missing) > 0 {
|
|
t.Fatalf("the broker's own streams %v are not reserved by the catalogue (it reserves %v)", missing, reserved)
|
|
}
|
|
}
|