2018-02-05 16:05:59 -05:00
|
|
|
package registry // import "github.com/docker/docker/registry"
|
2016-11-05 18:53:11 -04:00
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestLookupV1Endpoints(t *testing.T) {
|
2017-09-01 10:35:04 -04:00
|
|
|
s, err := NewService(ServiceOptions{})
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
2016-11-05 18:53:11 -04:00
|
|
|
|
|
|
|
cases := []struct {
|
|
|
|
hostname string
|
|
|
|
expectedLen int
|
|
|
|
}{
|
|
|
|
{"example.com", 1},
|
|
|
|
{DefaultNamespace, 0},
|
|
|
|
{DefaultV2Registry.Host, 0},
|
|
|
|
{IndexHostname, 0},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, c := range cases {
|
|
|
|
if ret, err := s.lookupV1Endpoints(c.hostname); err != nil || len(ret) != c.expectedLen {
|
|
|
|
t.Errorf("lookupV1Endpoints(`"+c.hostname+"`) returned %+v and %+v", ret, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|