@@ -91,17 +91,25 @@ func TestWinCredHelper(t *testing.T) {
9191// through variations on the URL
9292func TestWinCredHelperRetrieveAliases (t * testing.T ) {
9393 tests := []struct {
94+ doc string
9495 storeURL string
9596 readURL string
9697 }{
97- // stored with port, retrieved without
98- {"https://foobar.docker.io:2376" , "https://foobar.docker.io" },
99-
100- // stored as https, retrieved without scheme
101- {"https://foobar.docker.io" , "foobar.docker.io" },
102-
103- // stored with path, retrieved without
104- {"https://foobar.docker.io/one/two" , "https://foobar.docker.io" },
98+ {
99+ doc : "stored with port, retrieved without" ,
100+ storeURL : "https://foobar.docker.io:2376" ,
101+ readURL : "https://foobar.docker.io" ,
102+ },
103+ {
104+ doc : "stored as https, retrieved without scheme" ,
105+ storeURL : "https://foobar.docker.io" ,
106+ readURL : "foobar.docker.io" ,
107+ },
108+ {
109+ doc : "stored with path, retrieved without" ,
110+ storeURL : "https://foobar.docker.io/one/two" ,
111+ readURL : "https://foobar.docker.io" ,
112+ },
105113 }
106114
107115 helper := Wincred {}
@@ -133,26 +141,42 @@ func TestWinCredHelperRetrieveAliases(t *testing.T) {
133141// returned.
134142func TestWinCredHelperRetrieveStrict (t * testing.T ) {
135143 tests := []struct {
144+ doc string
136145 storeURL string
137146 readURL string
138147 }{
139- // stored as https, retrieved using http
140- {"https://foobar.docker.io:2376" , "http://foobar.docker.io:2376" },
141-
142- // stored as http, retrieved using https
143- {"http://foobar.docker.io:2376" , "https://foobar.docker.io:2376" },
144-
145- // same: stored as http, retrieved without a scheme specified (hence, using the default https://)
146- {"http://foobar.docker.io" , "foobar.docker.io:5678" },
147-
148- // non-matching ports
149- {"https://foobar.docker.io:1234" , "https://foobar.docker.io:5678" },
150-
151- // non-matching ports TODO is this desired behavior? The other way round does work
152- // {"https://foobar.docker.io", "https://foobar.docker.io:5678"},
153-
154- // non-matching paths
155- {"https://foobar.docker.io:1234/one/two" , "https://foobar.docker.io:1234/five/six" },
148+ {
149+ doc : "stored as https, retrieved using http" ,
150+ storeURL : "https://foobar.docker.io:2376" ,
151+ readURL : "http://foobar.docker.io:2376" ,
152+ },
153+ {
154+ doc : "stored as http, retrieved using https" ,
155+ storeURL : "http://foobar.docker.io:2376" ,
156+ readURL : "https://foobar.docker.io:2376" ,
157+ },
158+ {
159+ // stored as http, retrieved without a scheme specified (hence, using the default https://)
160+ doc : "stored as http, retrieved without scheme" ,
161+ storeURL : "http://foobar.docker.io" ,
162+ readURL : "foobar.docker.io:5678" ,
163+ },
164+ {
165+ doc : "non-matching ports" ,
166+ storeURL : "https://foobar.docker.io:1234" ,
167+ readURL : "https://foobar.docker.io:5678" ,
168+ },
169+ // TODO: is this desired behavior? The other way round does work
170+ // {
171+ // doc: "non-matching ports (stored without port)",
172+ // storeURL: "https://foobar.docker.io",
173+ // readURL: "https://foobar.docker.io:5678",
174+ // },
175+ {
176+ doc : "non-matching paths" ,
177+ storeURL : "https://foobar.docker.io:1234/one/two" ,
178+ readURL : "https://foobar.docker.io:1234/five/six" ,
179+ },
156180 }
157181
158182 helper := Wincred {}
0 commit comments