Take the foundation's ports as genesis inputs, check them free, and hand them to the controller as the node's settings (hq ADR 0100)
This commit is contained in:
@@ -164,3 +164,29 @@ func TestTheNodeNameCanBeSaid(t *testing.T) {
|
||||
t.Errorf("--catalog parsed as %q", opts.Catalogue)
|
||||
}
|
||||
}
|
||||
|
||||
// Defends novox/hq ADR 0100: the foundation's ports are inputs to genesis, and the registry's port
|
||||
// and the address nodes pull from say one port.
|
||||
func TestTheFoundationsPortsAreGiven(t *testing.T) {
|
||||
_, opts, _, err := parseArgs([]string{"--store-port", "5433", "--hub-port", "51821", "--overlay-range", "10.77.0.0/16"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if opts.Ports.Store != 5433 || opts.Ports.Hub != 51821 || opts.Ports.Bus != 5671 || opts.OverlayRange != "10.77.0.0/16" {
|
||||
t.Errorf("ports read as %+v, range %s", opts.Ports, opts.OverlayRange)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTheRegistrysPortAndAddressAgree(t *testing.T) {
|
||||
_, opts, _, err := parseArgs([]string{"--registry-port", "5100"})
|
||||
if err != nil || opts.Registry != "127.0.0.1:5100" {
|
||||
t.Errorf("--registry-port alone: %s %v", opts.Registry, err)
|
||||
}
|
||||
_, opts, _, err = parseArgs([]string{"--registry", "192.0.2.10:5100"})
|
||||
if err != nil || opts.Ports.Registry != 5100 {
|
||||
t.Errorf("--registry alone: %d %v", opts.Ports.Registry, err)
|
||||
}
|
||||
if _, _, _, err := parseArgs([]string{"--registry", "192.0.2.10:5000", "--registry-port", "5100"}); err == nil {
|
||||
t.Error("two ports for one registry were accepted")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user