@@ -137,6 +137,19 @@ func TestFileStoreErase(t *testing.T) {
137137
138138func TestConvertToHostname (t * testing.T ) {
139139 tests := []struct { input , expected string }{
140+ {
141+ input : "127.0.0.1" ,
142+ expected : "127.0.0.1" ,
143+ },
144+ {
145+ input : "::1" ,
146+ expected : "::1" ,
147+ },
148+ {
149+ // FIXME(thaJeztah): this should be normalized to "::1" if there's no port (or vice-versa, as long as we're consistent)
150+ input : "[::1]" ,
151+ expected : "[::1]" ,
152+ },
140153 {
141154 input : "example.com" ,
142155 expected : "example.com" ,
@@ -168,10 +181,35 @@ func TestConvertToHostname(t *testing.T) {
168181 expected : "example.com" ,
169182 },
170183 // should support non-standard port in registry url
184+ {
185+ input : "127.0.0.1:6556" ,
186+ expected : "127.0.0.1:6556" ,
187+ },
188+ {
189+ // FIXME(thaJeztah): this should be normalized to "[::1]:6556"
190+ input : "::1:6556" ,
191+ expected : "::1:6556" ,
192+ },
193+ {
194+ input : "[::1]:6556" ,
195+ expected : "[::1]:6556" ,
196+ },
171197 {
172198 input : "example.com:6555" ,
173199 expected : "example.com:6555" ,
174200 },
201+ {
202+ input : "https://127.0.0.1:6555/v2/" ,
203+ expected : "127.0.0.1:6555" ,
204+ },
205+ {
206+ input : "https://::1:6555/v2/" ,
207+ expected : "[::1]:6555" ,
208+ },
209+ {
210+ input : "https://[::1]:6555/v2/" ,
211+ expected : "[::1]:6555" ,
212+ },
175213 {
176214 input : "http://example.com:6555" ,
177215 expected : "example.com:6555" ,
0 commit comments