diff --git a/internal/bootstrap/network_module_test.go b/internal/bootstrap/network_module_test.go new file mode 100644 index 0000000..51c496b --- /dev/null +++ b/internal/bootstrap/network_module_test.go @@ -0,0 +1,33 @@ +package bootstrap + +import ( + "context" + "strconv" + "strings" + "testing" + "time" +) + +// Genesis assigns the private network by its own module's name (novox/hq ADR 0226). The +// `networking` bundle that only required it is retired, and a controller that no longer ships it +// refuses an assignment of it — which would stop genesis at the step that puts the hub on the +// network. +func TestGenesisAssignsThePrivateNetworkByItsOwnName(t *testing.T) { + rec := &controlRecorder{settings: map[string]string{}} + control := controlPlane{container: "mesh-controller", run: rec.run, timeout: time.Second} + o := Options{Node: "anchor", Site: "home", Wait: time.Second, Answers: map[string]string{ + "private-network": "wireguard", + "endpoint": "203.0.113.10:" + strconv.Itoa(DefaultPorts().Hub), + }} + if err := PlaceOnTheNetwork(context.Background(), o, control, "203.0.113.10:4222", quietly); err != nil { + t.Fatal(err) + } + if rec.index("assign anchor mesh-wireguard") < 0 || rec.index("overlay place anchor") < 0 { + t.Fatalf("genesis did not assign mesh-wireguard: %v", rec.told) + } + for _, said := range rec.told { + if strings.HasPrefix(said, "assign") && strings.HasSuffix(said, " networking") { + t.Fatalf("genesis assigned the retired bundle: %v", rec.told) + } + } +} diff --git a/internal/bootstrap/phase2.go b/internal/bootstrap/phase2.go index ede6305..615191a 100644 --- a/internal/bootstrap/phase2.go +++ b/internal/bootstrap/phase2.go @@ -116,9 +116,10 @@ func PlaceOnTheNetwork(ctx context.Context, o Options, control controlPlane, if err != nil { return err } - // Today the one provider is the control plane's own computed module. The choice exists so - // that the day there are two, this asks instead of assuming. - module := "networking" + // Today the one provider is the control plane's own computed module, assigned by its own name: + // the `networking` bundle that only required it is retired (novox/hq ADR 0226). The choice + // exists so that the day there are two, this asks instead of assuming. + module := "mesh-wireguard" _ = network endpoint, err := decide(Choice{