@@ -30,12 +30,12 @@ import (
3030func TestPushPlainHTTPFails (t * testing.T ) {
3131 testutil .RequiresBuild (t )
3232 base := testutil .NewBase (t )
33- reg := testregistry .NewPlainHTTP (base , 5000 )
34- defer reg .Cleanup ()
33+ reg := testregistry .NewWithNoAuth (base , 0 , false )
34+ defer reg .Cleanup (nil )
3535
3636 base .Cmd ("pull" , testutil .CommonImage ).AssertOK ()
3737 testImageRef := fmt .Sprintf ("%s:%d/%s:%s" ,
38- reg .IP .String (), reg .ListenPort , testutil .Identifier (t ), strings .Split (testutil .CommonImage , ":" )[1 ])
38+ reg .IP .String (), reg .Port , testutil .Identifier (t ), strings .Split (testutil .CommonImage , ":" )[1 ])
3939 t .Logf ("testImageRef=%q" , testImageRef )
4040 base .Cmd ("tag" , testutil .CommonImage , testImageRef ).AssertOK ()
4141
@@ -49,14 +49,14 @@ func TestPushPlainHTTPFails(t *testing.T) {
4949func TestPushPlainHTTPLocalhost (t * testing.T ) {
5050 testutil .RequiresBuild (t )
5151 base := testutil .NewBase (t )
52- reg := testregistry .NewPlainHTTP (base , 5000 )
53- defer reg .Cleanup ()
52+ reg := testregistry .NewWithNoAuth (base , 0 , false )
53+ defer reg .Cleanup (nil )
5454 localhostIP := "127.0.0.1"
5555 t .Logf ("localhost IP=%q" , localhostIP )
5656
5757 base .Cmd ("pull" , testutil .CommonImage ).AssertOK ()
5858 testImageRef := fmt .Sprintf ("%s:%d/%s:%s" ,
59- localhostIP , reg .ListenPort , testutil .Identifier (t ), strings .Split (testutil .CommonImage , ":" )[1 ])
59+ localhostIP , reg .Port , testutil .Identifier (t ), strings .Split (testutil .CommonImage , ":" )[1 ])
6060 t .Logf ("testImageRef=%q" , testImageRef )
6161 base .Cmd ("tag" , testutil .CommonImage , testImageRef ).AssertOK ()
6262
@@ -69,12 +69,12 @@ func TestPushPlainHTTPInsecure(t *testing.T) {
6969 testutil .DockerIncompatible (t )
7070
7171 base := testutil .NewBase (t )
72- reg := testregistry .NewPlainHTTP (base , 5000 )
73- defer reg .Cleanup ()
72+ reg := testregistry .NewWithNoAuth (base , 0 , false )
73+ defer reg .Cleanup (nil )
7474
7575 base .Cmd ("pull" , testutil .CommonImage ).AssertOK ()
7676 testImageRef := fmt .Sprintf ("%s:%d/%s:%s" ,
77- reg .IP .String (), reg .ListenPort , testutil .Identifier (t ), strings .Split (testutil .CommonImage , ":" )[1 ])
77+ reg .IP .String (), reg .Port , testutil .Identifier (t ), strings .Split (testutil .CommonImage , ":" )[1 ])
7878 t .Logf ("testImageRef=%q" , testImageRef )
7979 base .Cmd ("tag" , testutil .CommonImage , testImageRef ).AssertOK ()
8080
@@ -87,8 +87,8 @@ func TestPushPlainHttpInsecureWithDefaultPort(t *testing.T) {
8787 testutil .DockerIncompatible (t )
8888
8989 base := testutil .NewBase (t )
90- reg := testregistry .NewPlainHTTP (base , 80 )
91- defer reg .Cleanup ()
90+ reg := testregistry .NewWithNoAuth (base , 80 , false )
91+ defer reg .Cleanup (nil )
9292
9393 base .Cmd ("pull" , testutil .CommonImage ).AssertOK ()
9494 testImageRef := fmt .Sprintf ("%s/%s:%s" ,
@@ -105,14 +105,14 @@ func TestPushInsecureWithLogin(t *testing.T) {
105105 testutil .DockerIncompatible (t )
106106
107107 base := testutil .NewBase (t )
108- reg := testregistry .NewHTTPS (base , "admin" , "badmin" )
109- defer reg .Cleanup ()
108+ reg := testregistry .NewWithTokenAuth (base , "admin" , "badmin" , 0 , true )
109+ defer reg .Cleanup (nil )
110110
111111 base .Cmd ("--insecure-registry" , "login" , "-u" , "admin" , "-p" , "badmin" ,
112- fmt .Sprintf ("%s:%d" , reg .IP .String (), reg .ListenPort )).AssertOK ()
112+ fmt .Sprintf ("%s:%d" , reg .IP .String (), reg .Port )).AssertOK ()
113113 base .Cmd ("pull" , testutil .CommonImage ).AssertOK ()
114114 testImageRef := fmt .Sprintf ("%s:%d/%s:%s" ,
115- reg .IP .String (), reg .ListenPort , testutil .Identifier (t ), strings .Split (testutil .CommonImage , ":" )[1 ])
115+ reg .IP .String (), reg .Port , testutil .Identifier (t ), strings .Split (testutil .CommonImage , ":" )[1 ])
116116 t .Logf ("testImageRef=%q" , testImageRef )
117117 base .Cmd ("tag" , testutil .CommonImage , testImageRef ).AssertOK ()
118118
@@ -126,14 +126,14 @@ func TestPushWithHostsDir(t *testing.T) {
126126 testutil .DockerIncompatible (t )
127127
128128 base := testutil .NewBase (t )
129- reg := testregistry .NewHTTPS (base , "admin" , "badmin" )
130- defer reg .Cleanup ()
129+ reg := testregistry .NewWithTokenAuth (base , "admin" , "badmin" , 0 , true )
130+ defer reg .Cleanup (nil )
131131
132- base .Cmd ("--hosts-dir" , reg .HostsDir , "login" , "-u" , "admin" , "-p" , "badmin" , fmt .Sprintf ("%s:%d" , reg .IP .String (), reg .ListenPort )).AssertOK ()
132+ base .Cmd ("--hosts-dir" , reg .HostsDir , "login" , "-u" , "admin" , "-p" , "badmin" , fmt .Sprintf ("%s:%d" , reg .IP .String (), reg .Port )).AssertOK ()
133133
134134 base .Cmd ("pull" , testutil .CommonImage ).AssertOK ()
135135 testImageRef := fmt .Sprintf ("%s:%d/%s:%s" ,
136- reg .IP .String (), reg .ListenPort , testutil .Identifier (t ), strings .Split (testutil .CommonImage , ":" )[1 ])
136+ reg .IP .String (), reg .Port , testutil .Identifier (t ), strings .Split (testutil .CommonImage , ":" )[1 ])
137137 t .Logf ("testImageRef=%q" , testImageRef )
138138 base .Cmd ("tag" , testutil .CommonImage , testImageRef ).AssertOK ()
139139
@@ -147,18 +147,18 @@ func TestPushNonDistributableArtifacts(t *testing.T) {
147147 testutil .DockerIncompatible (t )
148148
149149 base := testutil .NewBase (t )
150- reg := testregistry .NewPlainHTTP (base , 5000 )
151- defer reg .Cleanup ()
150+ reg := testregistry .NewWithNoAuth (base , 0 , false )
151+ defer reg .Cleanup (nil )
152152
153153 base .Cmd ("pull" , testutil .NonDistBlobImage ).AssertOK ()
154154
155155 testImgRef := fmt .Sprintf ("%s:%d/%s:%s" ,
156- reg .IP .String (), reg .ListenPort , testutil .Identifier (t ), strings .Split (testutil .NonDistBlobImage , ":" )[1 ])
156+ reg .IP .String (), reg .Port , testutil .Identifier (t ), strings .Split (testutil .NonDistBlobImage , ":" )[1 ])
157157 base .Cmd ("tag" , testutil .NonDistBlobImage , testImgRef ).AssertOK ()
158158
159159 base .Cmd ("--debug" , "--insecure-registry" , "push" , testImgRef ).AssertOK ()
160160
161- blobURL := fmt .Sprintf ("http://%s:%d/v2/%s/blobs/%s" , reg .IP .String (), reg .ListenPort , testutil .Identifier (t ), testutil .NonDistBlobDigest )
161+ blobURL := fmt .Sprintf ("http://%s:%d/v2/%s/blobs/%s" , reg .IP .String (), reg .Port , testutil .Identifier (t ), testutil .NonDistBlobDigest )
162162 resp , err := http .Get (blobURL )
163163 assert .Assert (t , err , "error making http request" )
164164 if resp .Body != nil {
@@ -179,12 +179,12 @@ func TestPushSoci(t *testing.T) {
179179 testutil .DockerIncompatible (t )
180180 base := testutil .NewBase (t )
181181 requiresSoci (base )
182- reg := testregistry .NewPlainHTTP (base , 5000 )
183- defer reg .Cleanup ()
182+ reg := testregistry .NewWithNoAuth (base , 0 , false )
183+ defer reg .Cleanup (nil )
184184
185185 base .Cmd ("pull" , testutil .UbuntuImage ).AssertOK ()
186186 testImageRef := fmt .Sprintf ("%s:%d/%s:%s" ,
187- reg .IP .String (), reg .ListenPort , testutil .Identifier (t ), strings .Split (testutil .UbuntuImage , ":" )[1 ])
187+ reg .IP .String (), reg .Port , testutil .Identifier (t ), strings .Split (testutil .UbuntuImage , ":" )[1 ])
188188 t .Logf ("testImageRef=%q" , testImageRef )
189189 base .Cmd ("tag" , testutil .UbuntuImage , testImageRef ).AssertOK ()
190190
0 commit comments