@@ -137,6 +137,19 @@ func TestFileStoreErase(t *testing.T) {
137
137
138
138
func TestConvertToHostname (t * testing.T ) {
139
139
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
+ },
140
153
{
141
154
input : "example.com" ,
142
155
expected : "example.com" ,
@@ -168,10 +181,35 @@ func TestConvertToHostname(t *testing.T) {
168
181
expected : "example.com" ,
169
182
},
170
183
// 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
+ },
171
197
{
172
198
input : "example.com:6555" ,
173
199
expected : "example.com:6555" ,
174
200
},
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
+ },
175
213
{
176
214
input : "http://example.com:6555" ,
177
215
expected : "example.com:6555" ,
0 commit comments