Twelve steps made a mesh that RUNS and then said "what remains is somebody else's". The seven things that turn it into a mesh that WORKS — the shared base, a database provider, the catalogue, the private network, the packet filter — were typed afterwards, which is how they went missing for weeks without anything complaining. Six more steps now: base, store, catalogue, network, filter, extras. Everything in them is module add, build, assign and push — the same verbs a person types, through the same commands, so the installer and an operator remain one act. Where a human must choose, the installer asks. A choice resolves in the order a person expects: the flag wins; a lone option answers itself ALOUD, because "it chose for me" and "there was nothing to choose" read identically afterwards unless one speaks; a terminal is asked; a default fills in; and a required choice nothing answered refuses naming its flag — a guessed packet filter is a machine somebody else configured. The filter is required, so the question is which, not whether. A run without a terminal (the lab, --json) is never left waiting on a prompt nobody will answer. Placement is part of the network step, not a separate act — a lesson paid for: the module installed, the names file was written with no names in it, and everything reported success because nobody had said where the machine IS. The hub endpoint derives from the broker address when unsaid: the host other machines dial is one fact, not two that drift. Extras fail the run rather than soft-fail: somebody asked for them by name, and a mesh reporting success minus one thing is reporting the wrong thing. Claude-Session: https://claude.ai/code/session_01D6qtiYU3P9jk3pnAXyAFyx
26 lines
966 B
Go
26 lines
966 B
Go
package bootstrap
|
|
|
|
import "testing"
|
|
|
|
// The endpoint other machines dial defaults to the host they already dial — the broker's — on
|
|
// WireGuard's port. One fact, not two that drift.
|
|
func TestTheEndpointDerivesFromTheBrokerAddress(t *testing.T) {
|
|
if got := derivedEndpoint("192.0.2.10:5671"); got != "192.0.2.10:51820" {
|
|
t.Fatalf("derived %q", got)
|
|
}
|
|
if got := derivedEndpoint(""); got != "" {
|
|
t.Fatalf("an endpoint was invented from nothing: %q", got)
|
|
}
|
|
}
|
|
|
|
// A manifest with artifacts builds; one without does not — which is what separates postgres (a
|
|
// bundle to compile) from nftables (a package and a service).
|
|
func TestOnlyAManifestWithArtifactsBuilds(t *testing.T) {
|
|
if !builds([]byte(`{"build":{"artifacts":[{"name":"x"}]}}`)) {
|
|
t.Fatal("a manifest with artifacts was not built")
|
|
}
|
|
if builds([]byte(`{"resources":[{"id":"p","type":"package","package":"nftables"}]}`)) {
|
|
t.Fatal("a manifest with nothing to build was built anyway")
|
|
}
|
|
}
|