Files
mesh-catalog/modules/distribution/cmd/distribution/builds_test.go
T
jschoubben 0be81ae036 Join 11: the merged heads compile where no area's fix is owed
The join's importers name the delivery repository's moved contracts and sdk
(MV1), node-tools' tests use mesh-sdk's gate, the duplicate node-engine claim
rule of the reader release gives way to G's, and the assigner names its first
watched branch, never a constant. The seat holders' AnswerSeat callers are
area 6's.

Builds: design 47 G join 11 (merge of fix round 11)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 10:41:44 +01:00

38 lines
1.3 KiB
Go

package main
import (
"encoding/json"
"reflect"
"testing"
catalog "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
)
func entry(claims ...string) catalog.CatalogEntry {
var cs []any
for _, c := range claims {
cs = append(cs, map[string]any{"name": c, "scope": "node"})
}
return catalog.CatalogEntry{Manifest: map[string]any{"claims": cs}}
}
// Design 47 G §610, A-156: the build modules the driver counts are the modules claiming a `node-build-*` seat in the
// catalog half, whatever their names; no list of names is kept.
func TestBuildModulesAreTheClaimantsOfBuildSeats(t *testing.T) {
entries := map[string]catalog.CatalogEntry{
"a-compiler": entry("node-build-go"), "an-imager": entry("node-build-image", "something"),
"gitea": entry("git"), "mesh-build-go": entry("not-a-build-seat"), "no-claims": {Manifest: map[string]any{}},
}
if got, want := buildModulesOf(entries), []string{"a-compiler", "an-imager"}; !reflect.DeepEqual(got, want) {
t.Errorf("build modules = %v, want %v", got, want)
}
raw, _ := json.Marshal(entry("node-build-node"))
if !claimsBuildSeat("m", raw) {
t.Error("an entry claiming a build seat is not told as one")
}
raw, _ = json.Marshal(entry("git"))
if claimsBuildSeat("m", raw) {
t.Error("an entry claiming no build seat wakes the driver")
}
}