github.com/lazyboychen7/engine@v17.12.1-ce-rc2+incompatible/registry/service_v1_test.go (about) 1 package registry 2 3 import "testing" 4 5 func TestLookupV1Endpoints(t *testing.T) { 6 s, err := NewService(ServiceOptions{}) 7 if err != nil { 8 t.Fatal(err) 9 } 10 11 cases := []struct { 12 hostname string 13 expectedLen int 14 }{ 15 {"example.com", 1}, 16 {DefaultNamespace, 0}, 17 {DefaultV2Registry.Host, 0}, 18 {IndexHostname, 0}, 19 } 20 21 for _, c := range cases { 22 if ret, err := s.lookupV1Endpoints(c.hostname); err != nil || len(ret) != c.expectedLen { 23 t.Errorf("lookupV1Endpoints(`"+c.hostname+"`) returned %+v and %+v", ret, err) 24 } 25 } 26 }