Files
mesh-host/internal/bootstrap/build_test.go
T
jschoubben 121367319d Rename mesh-control -> mesh-controller, substrate -> foundation
One name per thing, per the HQ glossary: the module/container/image/binary/repo
becomes mesh-controller, the seat the-controller, and the store+broker pair the
foundation (embedded base bundles, default template and example lock renamed with
their go:embed directives). No behaviour change — a pure vocabulary rename.

Claude-Session: https://claude.ai/code/session_01D6qtiYU3P9jk3pnAXyAFyx
2026-09-16 18:40:40 +02:00

42 lines
1.6 KiB
Go

package bootstrap
import (
"strings"
"testing"
)
// An installer that carries a builder and was told nothing refuses, and says what is missing.
//
// **Exercised rather than assumed.** This is the refusal that stands between a person and a
// machine left holding a store, a broker and no control plane — the failure the whole preflight
// exists to prevent — and a refusal nothing tests is a refusal nobody has read.
func TestAnInstallerWithNothingToBuildRefuses(t *testing.T) {
err := Source{}.Check()
if err == nil {
t.Fatal("a source naming no repository was accepted; nothing would have been built")
}
for _, want := range []string{"--source", "--source-ref"} {
if !strings.Contains(err.Error(), want) {
t.Errorf("the refusal does not name %s, so it does not say how to fix it: %v", want, err)
}
}
}
// A repository without a commit refuses too, because a branch is somebody else's moving target.
func TestABranchIsNotACommit(t *testing.T) {
err := Source{Repository: "https://example.invalid/mesh-controller.git"}.Check()
if err == nil {
t.Fatal("a source with no ref was accepted; genesis would have built whatever a branch pointed at")
}
if !strings.Contains(err.Error(), "--source-ref") {
t.Errorf("the refusal does not name the flag that fixes it: %v", err)
}
}
// And a repository with a commit is enough.
func TestARepositoryAndACommitIsEnough(t *testing.T) {
if err := (Source{Repository: "https://example.invalid/mesh-controller.git", Ref: "a1b2c3d4"}).Check(); err != nil {
t.Fatalf("a repository and a commit were refused: %v", err)
}
}