gitee.com/bomy/docker.git@v1.13.1/registry/service_v1_test.go (about)

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