Accept --registry as a host alone again, completing it with the registry's port (hq ADR 0100)

This commit is contained in:
2026-09-22 18:08:50 +02:00
parent d59d232656
commit 35ecf68393
2 changed files with 27 additions and 0 deletions
+14
View File
@@ -190,3 +190,17 @@ func TestTheRegistrysPortAndAddressAgree(t *testing.T) {
t.Error("two ports for one registry were accepted")
}
}
func TestARegistryGivenAsAHostAloneTakesTheRegistrysPort(t *testing.T) {
_, opts, _, err := parseArgs([]string{"--registry", "192.0.2.10"})
if err != nil || opts.Registry != "192.0.2.10:5000" || opts.Ports.Registry != 5000 {
t.Errorf("--registry host alone: %s %d %v", opts.Registry, opts.Ports.Registry, err)
}
_, opts, _, err = parseArgs([]string{"--registry", "192.0.2.10", "--registry-port", "5100"})
if err != nil || opts.Registry != "192.0.2.10:5100" {
t.Errorf("--registry host with --registry-port: %s %v", opts.Registry, err)
}
if _, _, _, err := parseArgs([]string{"--registry", "192.0.2.10:notaport"}); err == nil {
t.Error("a registry with a port that is not a number was accepted")
}
}