Skip to content

Commit 1737f61

Browse files
committed
wincred: use designated domains in tests (RFC2606)
Update domains used in tests to used domains that are designated for this purpose as described in [RFC2606, section 3][1] [1]: https://www.rfc-editor.org/rfc/rfc2606.html#section-3 Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 7f48455 commit 1737f61

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

wincred/wincred_test.go

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import (
1212

1313
func TestWinCredHelper(t *testing.T) {
1414
creds := &credentials.Credentials{
15-
ServerURL: "https://foobar.docker.io:2376/v1",
15+
ServerURL: "https://foobar.example.com:2376/v1",
1616
Username: "foobar",
1717
Secret: "foobarbaz",
1818
}
1919
creds1 := &credentials.Credentials{
20-
ServerURL: "https://foobar.docker.io:2376/v2",
20+
ServerURL: "https://foobar.example.com:2376/v2",
2121
Username: "foobarbaz",
2222
Secret: "foobar",
2323
}
@@ -99,18 +99,18 @@ func TestWinCredHelperRetrieveAliases(t *testing.T) {
9999
}{
100100
{
101101
doc: "stored with port, retrieved without",
102-
storeURL: "https://foobar.docker.io:2376",
103-
readURL: "https://foobar.docker.io",
102+
storeURL: "https://foobar.example.com:2376",
103+
readURL: "https://foobar.example.com",
104104
},
105105
{
106106
doc: "stored as https, retrieved without scheme",
107-
storeURL: "https://foobar.docker.io",
108-
readURL: "foobar.docker.io",
107+
storeURL: "https://foobar.example.com",
108+
readURL: "foobar.example.com",
109109
},
110110
{
111111
doc: "stored with path, retrieved without",
112-
storeURL: "https://foobar.docker.io/one/two",
113-
readURL: "https://foobar.docker.io",
112+
storeURL: "https://foobar.example.com/one/two",
113+
readURL: "https://foobar.example.com",
114114
},
115115
}
116116

@@ -157,35 +157,35 @@ func TestWinCredHelperRetrieveStrict(t *testing.T) {
157157
}{
158158
{
159159
doc: "stored as https, retrieved using http",
160-
storeURL: "https://foobar.docker.io:2376",
161-
readURL: "http://foobar.docker.io:2376",
160+
storeURL: "https://foobar.example.com:2376",
161+
readURL: "http://foobar.example.com:2376",
162162
},
163163
{
164164
doc: "stored as http, retrieved using https",
165-
storeURL: "http://foobar.docker.io:2376",
166-
readURL: "https://foobar.docker.io:2376",
165+
storeURL: "http://foobar.example.com:2376",
166+
readURL: "https://foobar.example.com:2376",
167167
},
168168
{
169169
// stored as http, retrieved without a scheme specified (hence, using the default https://)
170170
doc: "stored as http, retrieved without scheme",
171-
storeURL: "http://foobar.docker.io",
172-
readURL: "foobar.docker.io:5678",
171+
storeURL: "http://foobar.example.com",
172+
readURL: "foobar.example.com:5678",
173173
},
174174
{
175175
doc: "non-matching ports",
176-
storeURL: "https://foobar.docker.io:1234",
177-
readURL: "https://foobar.docker.io:5678",
176+
storeURL: "https://foobar.example.com:1234",
177+
readURL: "https://foobar.example.com:5678",
178178
},
179179
// TODO: is this desired behavior? The other way round does work
180180
// {
181181
// doc: "non-matching ports (stored without port)",
182-
// storeURL: "https://foobar.docker.io",
183-
// readURL: "https://foobar.docker.io:5678",
182+
// storeURL: "https://foobar.example.com",
183+
// readURL: "https://foobar.example.com:5678",
184184
// },
185185
{
186186
doc: "non-matching paths",
187-
storeURL: "https://foobar.docker.io:1234/one/two",
188-
readURL: "https://foobar.docker.io:1234/five/six",
187+
storeURL: "https://foobar.example.com:1234/one/two",
188+
readURL: "https://foobar.example.com:1234/five/six",
189189
},
190190
}
191191

@@ -228,14 +228,14 @@ func TestWinCredHelperStoreRetrieve(t *testing.T) {
228228
tests := []struct {
229229
url string
230230
}{
231-
{url: "foobar.docker.io"},
232-
{url: "foobar.docker.io:2376"},
233-
{url: "//foobar.docker.io:2376"},
234-
{url: "https://foobar.docker.io:2376"},
235-
{url: "http://foobar.docker.io:2376"},
236-
{url: "https://foobar.docker.io:2376/some/path"},
237-
{url: "https://foobar.docker.io:2376/some/other/path"},
238-
{url: "https://foobar.docker.io:2376/some/other/path?foo=bar"},
231+
{url: "foobar.example.com"},
232+
{url: "foobar.example.com:2376"},
233+
{url: "//foobar.example.com:2376"},
234+
{url: "https://foobar.example.com:2376"},
235+
{url: "http://foobar.example.com:2376"},
236+
{url: "https://foobar.example.com:2376/some/path"},
237+
{url: "https://foobar.example.com:2376/some/other/path"},
238+
{url: "https://foobar.example.com:2376/some/other/path?foo=bar"},
239239
}
240240

241241
helper := Wincred{}

0 commit comments

Comments
 (0)