Files
mesh-delivery/modules/mesh-delivery-builder/cmd/mesh-delivery-builder-tools/build_test.go
T
jschoubben 12e3f2dc48 BL17d: builder_build answers a module's build keys whole; builder_builds_since takes module; builder_stuck's fingerprint pinned whole
builder_build reads the builds and asked states, and the tools bundle follows the catalog half itself (registrations for the
watched branches, revision per branch) for `newest`; the manifest names the tool and the two seat verbs.

Builds: design 47 G §589, A-87
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:28:08 +01:00

33 lines
1.5 KiB
Go

package main
import (
"encoding/json"
"strings"
"testing"
"git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
)
// Design 47 G §589, A-87: the tools bundle reads each watched branch's newest catalog graph entry of the module from the catalog
// half itself: the verb registrations for the branches, the verb revision for each branch's view.
func TestNewestIsReadFromTheCatalogHalfOfEachWatchedBranch(t *testing.T) {
fp := map[string]string{"main": "src2:" + strings.Repeat("1", 64), "feature": "src2:" + strings.Repeat("2", 64)}
ask := func(key string, body any) (json.RawMessage, error) {
switch key {
case meshcatalogclient.RegistrationsVerb:
return json.Marshal(meshcatalog.RegistrationsAnswer{Registrations: []meshcatalog.Registration{{Module: "m", Branches: []string{"main", "feature"}}}})
case meshcatalogclient.RevisionVerb:
in := body.(meshcatalog.RevisionInput)
return json.Marshal(meshcatalog.RevisionAnswer{Revision: &meshcatalog.CatalogRevision{Revision: 3, Kind: meshcatalogclient.KindTrunk},
Entries: []meshcatalog.CatalogEntry{{Module: "m", Fp: fp[in.Branch]}, {Module: "z", Fp: "src2:" + strings.Repeat("9", 64)}}})
}
t.Fatalf("asked %s", key)
return nil, nil
}
got, err := newestVia(ask)("m")
if err != nil || len(got) != 2 || got["main"] != fp["main"] || got["feature"] != fp["feature"] {
t.Fatalf("newest = %v, %v, want each branch's entry fingerprint whole", got, err)
}
}