Files
mesh-delivery/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/names_test.go
T
jschoubben 94d3f02f76 B-src: the builder's floor wakes on the indexer's take-in.taken
The seat mesh-catalog defines no manifest-accepted any more: the builder
consumes the indexer's take-in.taken in its place (module.json, names.go's
patterns) and wakes its floor on every one, looking at every module again as
before (versions.go, the wake take-in.taken). With the in-progress commit
before it the builder reads no source stamp and its untagged suite is green.

Builds: design 47 H §764 (the indexer: its events manifest-refused and manifest-accepted, with their reader); lead answers H-A-48, H-A-49, H-A-66, H-A-116 (hq 508faf0c)

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-20 04:48:48 +01:00

62 lines
2.3 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{
"seat:node-build-go.steps", "seat:node-build-image.steps", "seat: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; the indexer's
// event take-in.taken wakes the floor (design 47 H H-A-116).
if !slices.Contains(m.Consumes, "mesh-delivery-indexer.take-in.taken") {
t.Errorf("the builder's floor wakes on no take-in.taken: its manifest consumes %v", m.Consumes)
}
for _, c := range m.Consumes {
if strings.HasPrefix(c, "mesh-delivery-indexer.") && c != "mesh-delivery-indexer.take-in.taken" {
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", "seat:mesh-module-assigner.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"),
ownBucketsOf("acme-builder").toolchainsHeard: "acme-builder_toolchains-heard",
ownBucketsOf("acme-builder").bounds: "acme-builder_bounds",
ownBucketsOf("acme-builder").versions: "acme-builder_versions",
ownBucketsOf("acme-builder").instances: "acme-builder_instances",
} {
if want != got {
t.Errorf("a bucket is %q, want %q", got, want)
}
}
}