Skip to content

Commit 7f48455

Browse files
authored
Merge pull request #294 from thaJeztah/use_designated_domains_step1
use designated domains in tests (RFC2606) (step 1)
2 parents 4977273 + a90e3fa commit 7f48455

File tree

6 files changed

+56
-56
lines changed

6 files changed

+56
-56
lines changed

client/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import (
1111
)
1212

1313
const (
14-
validServerAddress = "https://index.docker.io/v1"
14+
validServerAddress = "https://registry.example.com/v1"
1515
validUsername = "linus"
1616
validServerAddress2 = "https://example.com:5002"
1717
invalidServerAddress = "https://foobar.example.com"
18-
missingCredsAddress = "https://missing.docker.io/v1"
18+
missingCredsAddress = "https://missing.example.com/v1"
1919
)
2020

2121
var errProgramExited = fmt.Errorf("exited 1")

credentials/credentials_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (m *memoryStore) List() (map[string]string, error) {
4242
}
4343

4444
func TestStore(t *testing.T) {
45-
const serverURL = "https://index.docker.io/v1/"
45+
const serverURL = "https://registry.example.com/v1/"
4646
creds := &Credentials{
4747
ServerURL: serverURL,
4848
Username: "foo",
@@ -95,7 +95,7 @@ func TestStoreMissingServerURL(t *testing.T) {
9595

9696
func TestStoreMissingUsername(t *testing.T) {
9797
creds := &Credentials{
98-
ServerURL: "https://index.docker.io/v1/",
98+
ServerURL: "https://registry.example.com/v1/",
9999
Username: "",
100100
Secret: "bar",
101101
}
@@ -114,7 +114,7 @@ func TestStoreMissingUsername(t *testing.T) {
114114
}
115115

116116
func TestGet(t *testing.T) {
117-
const serverURL = "https://index.docker.io/v1/"
117+
const serverURL = "https://registry.example.com/v1/"
118118
creds := &Credentials{
119119
ServerURL: serverURL,
120120
Username: "foo",
@@ -156,7 +156,7 @@ func TestGet(t *testing.T) {
156156
}
157157

158158
func TestGetMissingServerURL(t *testing.T) {
159-
const serverURL = "https://index.docker.io/v1/"
159+
const serverURL = "https://registry.example.com/v1/"
160160
creds := &Credentials{
161161
ServerURL: serverURL,
162162
Username: "foo",
@@ -182,7 +182,7 @@ func TestGetMissingServerURL(t *testing.T) {
182182
}
183183

184184
func TestErase(t *testing.T) {
185-
const serverURL = "https://index.docker.io/v1/"
185+
const serverURL = "https://registry.example.com/v1/"
186186
creds := &Credentials{
187187
ServerURL: serverURL,
188188
Username: "foo",
@@ -211,7 +211,7 @@ func TestErase(t *testing.T) {
211211
}
212212

213213
func TestEraseMissingServerURL(t *testing.T) {
214-
const serverURL = "https://index.docker.io/v1/"
214+
const serverURL = "https://registry.example.com/v1/"
215215
creds := &Credentials{
216216
ServerURL: serverURL,
217217
Username: "foo",

osxkeychain/osxkeychain_test.go

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

1212
func TestOSXKeychainHelper(t *testing.T) {
1313
creds := &credentials.Credentials{
14-
ServerURL: "https://foobar.docker.io:2376/v1",
14+
ServerURL: "https://foobar.example.com:2376/v1",
1515
Username: "foobar",
1616
Secret: "foobarbaz",
1717
}
1818
creds1 := &credentials.Credentials{
19-
ServerURL: "https://foobar.docker.io:2376/v2",
19+
ServerURL: "https://foobar.example.com:2376/v2",
2020
Username: "foobarbaz",
2121
Secret: "foobar",
2222
}
@@ -68,18 +68,18 @@ func TestOSXKeychainHelperRetrieveAliases(t *testing.T) {
6868
}{
6969
{
7070
doc: "stored with port, retrieved without",
71-
storeURL: "https://foobar.docker.io:2376",
72-
readURL: "https://foobar.docker.io",
71+
storeURL: "https://foobar.example.com:2376",
72+
readURL: "https://foobar.example.com",
7373
},
7474
{
7575
doc: "stored as https, retrieved without scheme",
76-
storeURL: "https://foobar.docker.io:2376",
77-
readURL: "foobar.docker.io",
76+
storeURL: "https://foobar.example.com:2376",
77+
readURL: "foobar.example.com",
7878
},
7979
{
8080
doc: "stored with path, retrieved without",
81-
storeURL: "https://foobar.docker.io:1234/one/two",
82-
readURL: "https://foobar.docker.io:1234",
81+
storeURL: "https://foobar.example.com:1234/one/two",
82+
readURL: "https://foobar.example.com:1234",
8383
},
8484
}
8585

@@ -126,35 +126,35 @@ func TestOSXKeychainHelperRetrieveStrict(t *testing.T) {
126126
}{
127127
{
128128
doc: "stored as https, retrieved using http",
129-
storeURL: "https://foobar.docker.io:2376",
130-
readURL: "http://foobar.docker.io:2376",
129+
storeURL: "https://foobar.example.com:2376",
130+
readURL: "http://foobar.example.com:2376",
131131
},
132132
{
133133
doc: "stored as http, retrieved using https",
134-
storeURL: "http://foobar.docker.io:2376",
135-
readURL: "https://foobar.docker.io:2376",
134+
storeURL: "http://foobar.example.com:2376",
135+
readURL: "https://foobar.example.com:2376",
136136
},
137137
{
138138
// stored as http, retrieved without a scheme specified (hence, using the default https://)
139139
doc: "stored as http, retrieved without scheme",
140-
storeURL: "http://foobar.docker.io",
141-
readURL: "foobar.docker.io:5678",
140+
storeURL: "http://foobar.example.com",
141+
readURL: "foobar.example.com:5678",
142142
},
143143
{
144144
doc: "non-matching ports",
145-
storeURL: "https://foobar.docker.io:1234",
146-
readURL: "https://foobar.docker.io:5678",
145+
storeURL: "https://foobar.example.com:1234",
146+
readURL: "https://foobar.example.com:5678",
147147
},
148148
// TODO: is this desired behavior? The other way round does work
149149
// {
150150
// doc: "non-matching ports (stored without port)",
151-
// storeURL: "https://foobar.docker.io",
152-
// readURL: "https://foobar.docker.io:5678",
151+
// storeURL: "https://foobar.example.com",
152+
// readURL: "https://foobar.example.com:5678",
153153
// },
154154
{
155155
doc: "non-matching paths",
156-
storeURL: "https://foobar.docker.io:1234/one/two",
157-
readURL: "https://foobar.docker.io:1234/five/six",
156+
storeURL: "https://foobar.example.com:1234/one/two",
157+
readURL: "https://foobar.example.com:1234/five/six",
158158
},
159159
}
160160

@@ -197,14 +197,14 @@ func TestOSXKeychainHelperStoreRetrieve(t *testing.T) {
197197
tests := []struct {
198198
url string
199199
}{
200-
{url: "foobar.docker.io"},
201-
{url: "foobar.docker.io:2376"},
202-
{url: "//foobar.docker.io:2376"},
203-
{url: "https://foobar.docker.io:2376"},
204-
{url: "http://foobar.docker.io:2376"},
205-
{url: "https://foobar.docker.io:2376/some/path"},
206-
{url: "https://foobar.docker.io:2376/some/other/path"},
207-
{url: "https://foobar.docker.io:2376/some/other/path?foo=bar"},
200+
{url: "foobar.example.com"},
201+
{url: "foobar.example.com:2376"},
202+
{url: "//foobar.example.com:2376"},
203+
{url: "https://foobar.example.com:2376"},
204+
{url: "http://foobar.example.com:2376"},
205+
{url: "https://foobar.example.com:2376/some/path"},
206+
{url: "https://foobar.example.com:2376/some/other/path"},
207+
{url: "https://foobar.example.com:2376/some/other/path?foo=bar"},
208208
}
209209

210210
helper := Osxkeychain{}

pass/pass_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func TestPassHelper(t *testing.T) {
1313
creds := &credentials.Credentials{
14-
ServerURL: "https://foobar.docker.io:2376/v1",
14+
ServerURL: "https://foobar.example.com:2376/v1",
1515
Username: "nothing",
1616
Secret: "isthebestmeshuggahalbum",
1717
}
@@ -54,12 +54,12 @@ func TestPassHelperCheckInit(t *testing.T) {
5454
func TestPassHelperList(t *testing.T) {
5555
creds := []*credentials.Credentials{
5656
{
57-
ServerURL: "https://foobar.docker.io:2376/v1",
57+
ServerURL: "https://foobar.example.com:2376/v1",
5858
Username: "foo",
5959
Secret: "isthebestmeshuggahalbum",
6060
},
6161
{
62-
ServerURL: "https://foobar.docker.io:2375/v1",
62+
ServerURL: "https://foobar.example.com:2375/v1",
6363
Username: "bar",
6464
Secret: "isthebestmeshuggahalbum",
6565
},

registryurl/parse_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,39 @@ func TestHelperParseURL(t *testing.T) {
1414
err error
1515
}{
1616
{
17-
url: "foobar.docker.io",
18-
expectedURL: "//foobar.docker.io",
17+
url: "foobar.example.com",
18+
expectedURL: "//foobar.example.com",
1919
},
2020
{
21-
url: "foobar.docker.io:2376",
22-
expectedURL: "//foobar.docker.io:2376",
21+
url: "foobar.example.com:2376",
22+
expectedURL: "//foobar.example.com:2376",
2323
},
2424
{
25-
url: "//foobar.docker.io:2376",
26-
expectedURL: "//foobar.docker.io:2376",
25+
url: "//foobar.example.com:2376",
26+
expectedURL: "//foobar.example.com:2376",
2727
},
2828
{
29-
url: "http://foobar.docker.io:2376",
30-
expectedURL: "http://foobar.docker.io:2376",
29+
url: "http://foobar.example.com:2376",
30+
expectedURL: "http://foobar.example.com:2376",
3131
},
3232
{
33-
url: "https://foobar.docker.io:2376",
34-
expectedURL: "https://foobar.docker.io:2376",
33+
url: "https://foobar.example.com:2376",
34+
expectedURL: "https://foobar.example.com:2376",
3535
},
3636
{
37-
url: "https://foobar.docker.io:2376/some/path",
38-
expectedURL: "https://foobar.docker.io:2376/some/path",
37+
url: "https://foobar.example.com:2376/some/path",
38+
expectedURL: "https://foobar.example.com:2376/some/path",
3939
},
4040
{
41-
url: "https://foobar.docker.io:2376/some/other/path?foo=bar",
42-
expectedURL: "https://foobar.docker.io:2376/some/other/path",
41+
url: "https://foobar.example.com:2376/some/other/path?foo=bar",
42+
expectedURL: "https://foobar.example.com:2376/some/other/path",
4343
},
4444
{
45-
url: "/foobar.docker.io",
45+
url: "/foobar.example.com",
4646
err: errors.New("no hostname in URL"),
4747
},
4848
{
49-
url: "ftp://foobar.docker.io:2376",
49+
url: "ftp://foobar.example.com:2376",
5050
err: errors.New("unsupported scheme: ftp"),
5151
},
5252
}

secretservice/secretservice_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func TestSecretServiceHelper(t *testing.T) {
1313
t.Skip("test requires gnome-keyring but travis CI doesn't have it")
1414

1515
creds := &credentials.Credentials{
16-
ServerURL: "https://foobar.docker.io:2376/v1",
16+
ServerURL: "https://foobar.example.com:2376/v1",
1717
Username: "foobar",
1818
Secret: "foobarbaz",
1919
}

0 commit comments

Comments
 (0)