Signed-off-by: Tibor Vass <teabee89@gmail.com>
| ... | ... |
@@ -19,8 +19,9 @@ import ( |
| 19 | 19 |
) |
| 20 | 20 |
|
| 21 | 21 |
var ( |
| 22 |
- testHTTPServer *httptest.Server |
|
| 23 |
- testLayers = map[string]map[string]string{
|
|
| 22 |
+ testHTTPServer *httptest.Server |
|
| 23 |
+ insecureRegistries []string |
|
| 24 |
+ testLayers = map[string]map[string]string{
|
|
| 24 | 25 |
"77dbf71da1d00e3fbddc480176eac8994025630c6590d11cfc8fe1209c2a1d20": {
|
| 25 | 26 |
"json": `{"id":"77dbf71da1d00e3fbddc480176eac8994025630c6590d11cfc8fe1209c2a1d20",
|
| 26 | 27 |
"comment":"test base image","created":"2013-03-23T12:53:11.10432-07:00", |
| ... | ... |
@@ -100,6 +101,11 @@ func init() {
|
| 100 | 100 |
r.HandleFunc("/v2/version", handlerGetPing).Methods("GET")
|
| 101 | 101 |
|
| 102 | 102 |
testHTTPServer = httptest.NewServer(handlerAccessLog(r)) |
| 103 |
+ URL, err := url.Parse(testHTTPServer.URL) |
|
| 104 |
+ if err != nil {
|
|
| 105 |
+ panic(err) |
|
| 106 |
+ } |
|
| 107 |
+ insecureRegistries = []string{URL.Host}
|
|
| 103 | 108 |
} |
| 104 | 109 |
|
| 105 | 110 |
func handlerAccessLog(handler http.Handler) http.Handler {
|
| ... | ... |
@@ -21,7 +21,7 @@ const ( |
| 21 | 21 |
|
| 22 | 22 |
func spawnTestRegistrySession(t *testing.T) *Session {
|
| 23 | 23 |
authConfig := &AuthConfig{}
|
| 24 |
- endpoint, err := NewEndpoint(makeURL("/v1/"), false)
|
|
| 24 |
+ endpoint, err := NewEndpoint(makeURL("/v1/"), insecureRegistries)
|
|
| 25 | 25 |
if err != nil {
|
| 26 | 26 |
t.Fatal(err) |
| 27 | 27 |
} |
| ... | ... |
@@ -33,7 +33,7 @@ func spawnTestRegistrySession(t *testing.T) *Session {
|
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 | 35 |
func TestPingRegistryEndpoint(t *testing.T) {
|
| 36 |
- ep, err := NewEndpoint(makeURL("/v1/"), false)
|
|
| 36 |
+ ep, err := NewEndpoint(makeURL("/v1/"), insecureRegistries)
|
|
| 37 | 37 |
if err != nil {
|
| 38 | 38 |
t.Fatal(err) |
| 39 | 39 |
} |