(t *testing.T)
| 391 | } |
| 392 | |
| 393 | func TestParseHostname(t *testing.T) { |
| 394 | validHostnames := map[string]string{ |
| 395 | "hostname": "hostname", |
| 396 | "host-name": "host-name", |
| 397 | "hostname123": "hostname123", |
| 398 | "123hostname": "123hostname", |
| 399 | "hostname-of-63-bytes-long-should-be-valid-and-without-any-error": "hostname-of-63-bytes-long-should-be-valid-and-without-any-error", |
| 400 | } |
| 401 | hostnameWithDomain := "--hostname=hostname.domainname" |
| 402 | hostnameWithDomainTld := "--hostname=hostname.domainname.tld" |
| 403 | for hostname, expectedHostname := range validHostnames { |
| 404 | if config, _, _ := mustParse(t, "--hostname="+hostname); config.Hostname != expectedHostname { |
| 405 | t.Fatalf("Expected the config to have 'hostname' as %q, got %q", expectedHostname, config.Hostname) |
| 406 | } |
| 407 | } |
| 408 | if config, _, _ := mustParse(t, hostnameWithDomain); config.Hostname != "hostname.domainname" || config.Domainname != "" { |
| 409 | t.Fatalf("Expected the config to have 'hostname' as hostname.domainname, got %q", config.Hostname) |
| 410 | } |
| 411 | if config, _, _ := mustParse(t, hostnameWithDomainTld); config.Hostname != "hostname.domainname.tld" || config.Domainname != "" { |
| 412 | t.Fatalf("Expected the config to have 'hostname' as hostname.domainname.tld, got %q", config.Hostname) |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | func TestParseHostnameDomainname(t *testing.T) { |
| 417 | validDomainnames := map[string]string{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…