A controller that no longer ships networking refuses it, which would stop genesis where the hub joins the private network.
34 lines
1.2 KiB
Go
34 lines
1.2 KiB
Go
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)
|
|
}
|
|
}
|
|
}
|