MCPcopy Create free account
hub / github.com/docker/cli / TestParseHostnameDomainname

Function TestParseHostnameDomainname

cli/command/container/opts_test.go:416–435  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

414}
415
416func TestParseHostnameDomainname(t *testing.T) {
417 validDomainnames := map[string]string{
418 "domainname": "domainname",
419 "domain-name": "domain-name",
420 "domainname123": "domainname123",
421 "123domainname": "123domainname",
422 "domainname-63-bytes-long-should-be-valid-and-without-any-errors": "domainname-63-bytes-long-should-be-valid-and-without-any-errors",
423 }
424 for domainname, expectedDomainname := range validDomainnames {
425 if config, _, _ := mustParse(t, "--domainname="+domainname); config.Domainname != expectedDomainname {
426 t.Fatalf("Expected the config to have 'domainname' as %q, got %q", expectedDomainname, config.Domainname)
427 }
428 }
429 if config, _, _ := mustParse(t, "--hostname=some.prefix --domainname=domainname"); config.Hostname != "some.prefix" || config.Domainname != "domainname" {
430 t.Fatalf("Expected the config to have 'hostname' as 'some.prefix' and 'domainname' as 'domainname', got %q and %q", config.Hostname, config.Domainname)
431 }
432 if config, _, _ := mustParse(t, "--hostname=another-prefix --domainname=domainname.tld"); config.Hostname != "another-prefix" || config.Domainname != "domainname.tld" {
433 t.Fatalf("Expected the config to have 'hostname' as 'another-prefix' and 'domainname' as 'domainname.tld', got %q and %q", config.Hostname, config.Domainname)
434 }
435}
436
437func TestParseWithExpose(t *testing.T) {
438 t.Run("invalid", func(t *testing.T) {

Callers

nothing calls this directly

Calls 1

mustParseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…