Files
mesh-delivery/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/names_test.go
T
jschoubben a2dfbec30d The builder no longer watches the gate's source for candidate base merges
A candidate comes by the runner's build step ask (A-97), so the builder's trunkSource watch of the gate's source, its
sourceHeads, the wake it gave a floor, its read mesh-delivery-gate.source and the bed's source bucket go.

Builds: design 47 G A-97, A-84
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 00:10:29 +01:00

56 lines
1.9 KiB
Go

package main
import (
"encoding/json"
"os"
"slices"
"strings"
"testing"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/buildrun"
)
// TestTheNamesAreTheManifests: the holders and buckets the builder names are its manifest's `reads` (the gate's source, the
// build modules' steps and toolchains) and its `consumes` of the indexer's and assigner's views, since no contract names a
// holder (novox/hq ADR 0634 §1).
func TestTheNamesAreTheManifests(t *testing.T) {
raw, err := os.ReadFile("../../module.json")
if err != nil {
t.Fatal(err)
}
var m struct {
Reads []string `json:"reads"`
Consumes []string `json:"consumes"`
}
if err := json.Unmarshal(raw, &m); err != nil {
t.Fatal(err)
}
for _, read := range []string{
"node-build-go.steps", "node-build-image.steps", "node-build-node.steps",
} {
if !slices.Contains(m.Reads, read) {
t.Errorf("the builder reads %s, its manifest's reads are %v", read, m.Reads)
}
}
// The catalog half (design 47 G §348, §614) is followed through the seat, and no state of the indexer is.
for _, c := range m.Consumes {
if strings.HasPrefix(c, indexerModule+".") {
t.Errorf("the builder follows %s, an indexer state, its manifest consumes it", c)
}
}
for _, view := range []string{"mesh-catalog.catalog-revision", "mesh-catalog.registration-changed", "mesh-delivery.source-moved", assignerModule + ".views.assignments"} {
if !slices.Contains(m.Consumes, view) {
t.Errorf("the builder follows %s, its manifest consumes %v", view, m.Consumes)
}
}
for want, got := range map[string]string{
"mesh-build-go_steps": buildrun.StepsBucket("mesh-build-go"),
buildrun.ToolchainsHeardBucket: "mesh-delivery-builder_toolchains-heard",
"mesh-delivery-assigner_assignments": buildrun.AssignmentsBucket,
} {
if want != got {
t.Errorf("a bucket is %q, want %q", got, want)
}
}
}