Skip to content

Commit 94e2e07

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 f8e94d9 commit 94e2e07

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

wincred/wincred_windows_test.go

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

1111
func TestWinCredHelper(t *testing.T) {
1212
creds := &credentials.Credentials{
13-
ServerURL: "https://foobar.docker.io:2376/v1",
13+
ServerURL: "https://foobar.example.com:2376/v1",
1414
Username: "foobar",
1515
Secret: "foobarbaz",
1616
}
1717
creds1 := &credentials.Credentials{
18-
ServerURL: "https://foobar.docker.io:2376/v2",
18+
ServerURL: "https://foobar.example.com:2376/v2",
1919
Username: "foobarbaz",
2020
Secret: "foobar",
2121
}
@@ -97,18 +97,18 @@ func TestWinCredHelperRetrieveAliases(t *testing.T) {
9797
}{
9898
{
9999
doc: "stored with port, retrieved without",
100-
storeURL: "https://foobar.docker.io:2376",
101-
readURL: "https://foobar.docker.io",
100+
storeURL: "https://foobar.example.com:2376",
101+
readURL: "https://foobar.example.com",
102102
},
103103
{
104104
doc: "stored as https, retrieved without scheme",
105-
storeURL: "https://foobar.docker.io",
106-
readURL: "foobar.docker.io",
105+
storeURL: "https://foobar.example.com",
106+
readURL: "foobar.example.com",
107107
},
108108
{
109109
doc: "stored with path, retrieved without",
110-
storeURL: "https://foobar.docker.io/one/two",
111-
readURL: "https://foobar.docker.io",
110+
storeURL: "https://foobar.example.com/one/two",
111+
readURL: "https://foobar.example.com",
112112
},
113113
}
114114

@@ -155,35 +155,35 @@ func TestWinCredHelperRetrieveStrict(t *testing.T) {
155155
}{
156156
{
157157
doc: "stored as https, retrieved using http",
158-
storeURL: "https://foobar.docker.io:2376",
159-
readURL: "http://foobar.docker.io:2376",
158+
storeURL: "https://foobar.example.com:2376",
159+
readURL: "http://foobar.example.com:2376",
160160
},
161161
{
162162
doc: "stored as http, retrieved using https",
163-
storeURL: "http://foobar.docker.io:2376",
164-
readURL: "https://foobar.docker.io:2376",
163+
storeURL: "http://foobar.example.com:2376",
164+
readURL: "https://foobar.example.com:2376",
165165
},
166166
{
167167
// stored as http, retrieved without a scheme specified (hence, using the default https://)
168168
doc: "stored as http, retrieved without scheme",
169-
storeURL: "http://foobar.docker.io",
170-
readURL: "foobar.docker.io:5678",
169+
storeURL: "http://foobar.example.com",
170+
readURL: "foobar.example.com:5678",
171171
},
172172
{
173173
doc: "non-matching ports",
174-
storeURL: "https://foobar.docker.io:1234",
175-
readURL: "https://foobar.docker.io:5678",
174+
storeURL: "https://foobar.example.com:1234",
175+
readURL: "https://foobar.example.com:5678",
176176
},
177177
// TODO: is this desired behavior? The other way round does work
178178
// {
179179
// doc: "non-matching ports (stored without port)",
180-
// storeURL: "https://foobar.docker.io",
181-
// readURL: "https://foobar.docker.io:5678",
180+
// storeURL: "https://foobar.example.com",
181+
// readURL: "https://foobar.example.com:5678",
182182
// },
183183
{
184184
doc: "non-matching paths",
185-
storeURL: "https://foobar.docker.io:1234/one/two",
186-
readURL: "https://foobar.docker.io:1234/five/six",
185+
storeURL: "https://foobar.example.com:1234/one/two",
186+
readURL: "https://foobar.example.com:1234/five/six",
187187
},
188188
}
189189

@@ -226,14 +226,14 @@ func TestWinCredHelperStoreRetrieve(t *testing.T) {
226226
tests := []struct {
227227
url string
228228
}{
229-
{url: "foobar.docker.io"},
230-
{url: "foobar.docker.io:2376"},
231-
{url: "//foobar.docker.io:2376"},
232-
{url: "https://foobar.docker.io:2376"},
233-
{url: "http://foobar.docker.io:2376"},
234-
{url: "https://foobar.docker.io:2376/some/path"},
235-
{url: "https://foobar.docker.io:2376/some/other/path"},
236-
{url: "https://foobar.docker.io:2376/some/other/path?foo=bar"},
229+
{url: "foobar.example.com"},
230+
{url: "foobar.example.com:2376"},
231+
{url: "//foobar.example.com:2376"},
232+
{url: "https://foobar.example.com:2376"},
233+
{url: "http://foobar.example.com:2376"},
234+
{url: "https://foobar.example.com:2376/some/path"},
235+
{url: "https://foobar.example.com:2376/some/other/path"},
236+
{url: "https://foobar.example.com:2376/some/other/path?foo=bar"},
237237
}
238238

239239
helper := Wincred{}

0 commit comments

Comments
 (0)