Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
)

const (
validServerAddress = "https://index.docker.io/v1"
validServerAddress = "https://registry.example.com/v1"
validUsername = "linus"
validServerAddress2 = "https://example.com:5002"
invalidServerAddress = "https://foobar.example.com"
missingCredsAddress = "https://missing.docker.io/v1"
missingCredsAddress = "https://missing.example.com/v1"
)

var errProgramExited = fmt.Errorf("exited 1")
Expand Down
12 changes: 6 additions & 6 deletions credentials/credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (m *memoryStore) List() (map[string]string, error) {
}

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

func TestStoreMissingUsername(t *testing.T) {
creds := &Credentials{
ServerURL: "https://index.docker.io/v1/",
ServerURL: "https://registry.example.com/v1/",
Username: "",
Secret: "bar",
}
Expand All @@ -114,7 +114,7 @@ func TestStoreMissingUsername(t *testing.T) {
}

func TestGet(t *testing.T) {
const serverURL = "https://index.docker.io/v1/"
const serverURL = "https://registry.example.com/v1/"
creds := &Credentials{
ServerURL: serverURL,
Username: "foo",
Expand Down Expand Up @@ -156,7 +156,7 @@ func TestGet(t *testing.T) {
}

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

func TestErase(t *testing.T) {
const serverURL = "https://index.docker.io/v1/"
const serverURL = "https://registry.example.com/v1/"
creds := &Credentials{
ServerURL: serverURL,
Username: "foo",
Expand Down Expand Up @@ -211,7 +211,7 @@ func TestErase(t *testing.T) {
}

func TestEraseMissingServerURL(t *testing.T) {
const serverURL = "https://index.docker.io/v1/"
const serverURL = "https://registry.example.com/v1/"
creds := &Credentials{
ServerURL: serverURL,
Username: "foo",
Expand Down
56 changes: 28 additions & 28 deletions osxkeychain/osxkeychain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (

func TestOSXKeychainHelper(t *testing.T) {
creds := &credentials.Credentials{
ServerURL: "https://foobar.docker.io:2376/v1",
ServerURL: "https://foobar.example.com:2376/v1",
Username: "foobar",
Secret: "foobarbaz",
}
creds1 := &credentials.Credentials{
ServerURL: "https://foobar.docker.io:2376/v2",
ServerURL: "https://foobar.example.com:2376/v2",
Username: "foobarbaz",
Secret: "foobar",
}
Expand Down Expand Up @@ -68,18 +68,18 @@ func TestOSXKeychainHelperRetrieveAliases(t *testing.T) {
}{
{
doc: "stored with port, retrieved without",
storeURL: "https://foobar.docker.io:2376",
readURL: "https://foobar.docker.io",
storeURL: "https://foobar.example.com:2376",
readURL: "https://foobar.example.com",
},
{
doc: "stored as https, retrieved without scheme",
storeURL: "https://foobar.docker.io:2376",
readURL: "foobar.docker.io",
storeURL: "https://foobar.example.com:2376",
readURL: "foobar.example.com",
},
{
doc: "stored with path, retrieved without",
storeURL: "https://foobar.docker.io:1234/one/two",
readURL: "https://foobar.docker.io:1234",
storeURL: "https://foobar.example.com:1234/one/two",
readURL: "https://foobar.example.com:1234",
},
}

Expand Down Expand Up @@ -126,35 +126,35 @@ func TestOSXKeychainHelperRetrieveStrict(t *testing.T) {
}{
{
doc: "stored as https, retrieved using http",
storeURL: "https://foobar.docker.io:2376",
readURL: "http://foobar.docker.io:2376",
storeURL: "https://foobar.example.com:2376",
readURL: "http://foobar.example.com:2376",
},
{
doc: "stored as http, retrieved using https",
storeURL: "http://foobar.docker.io:2376",
readURL: "https://foobar.docker.io:2376",
storeURL: "http://foobar.example.com:2376",
readURL: "https://foobar.example.com:2376",
},
{
// stored as http, retrieved without a scheme specified (hence, using the default https://)
doc: "stored as http, retrieved without scheme",
storeURL: "http://foobar.docker.io",
readURL: "foobar.docker.io:5678",
storeURL: "http://foobar.example.com",
readURL: "foobar.example.com:5678",
},
{
doc: "non-matching ports",
storeURL: "https://foobar.docker.io:1234",
readURL: "https://foobar.docker.io:5678",
storeURL: "https://foobar.example.com:1234",
readURL: "https://foobar.example.com:5678",
},
// TODO: is this desired behavior? The other way round does work
// {
// doc: "non-matching ports (stored without port)",
// storeURL: "https://foobar.docker.io",
// readURL: "https://foobar.docker.io:5678",
// storeURL: "https://foobar.example.com",
// readURL: "https://foobar.example.com:5678",
// },
{
doc: "non-matching paths",
storeURL: "https://foobar.docker.io:1234/one/two",
readURL: "https://foobar.docker.io:1234/five/six",
storeURL: "https://foobar.example.com:1234/one/two",
readURL: "https://foobar.example.com:1234/five/six",
},
}

Expand Down Expand Up @@ -197,14 +197,14 @@ func TestOSXKeychainHelperStoreRetrieve(t *testing.T) {
tests := []struct {
url string
}{
{url: "foobar.docker.io"},
{url: "foobar.docker.io:2376"},
{url: "//foobar.docker.io:2376"},
{url: "https://foobar.docker.io:2376"},
{url: "http://foobar.docker.io:2376"},
{url: "https://foobar.docker.io:2376/some/path"},
{url: "https://foobar.docker.io:2376/some/other/path"},
{url: "https://foobar.docker.io:2376/some/other/path?foo=bar"},
{url: "foobar.example.com"},
{url: "foobar.example.com:2376"},
{url: "//foobar.example.com:2376"},
{url: "https://foobar.example.com:2376"},
{url: "http://foobar.example.com:2376"},
{url: "https://foobar.example.com:2376/some/path"},
{url: "https://foobar.example.com:2376/some/other/path"},
{url: "https://foobar.example.com:2376/some/other/path?foo=bar"},
}

helper := Osxkeychain{}
Expand Down
6 changes: 3 additions & 3 deletions pass/pass_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func TestPassHelper(t *testing.T) {
creds := &credentials.Credentials{
ServerURL: "https://foobar.docker.io:2376/v1",
ServerURL: "https://foobar.example.com:2376/v1",
Username: "nothing",
Secret: "isthebestmeshuggahalbum",
}
Expand Down Expand Up @@ -54,12 +54,12 @@ func TestPassHelperCheckInit(t *testing.T) {
func TestPassHelperList(t *testing.T) {
creds := []*credentials.Credentials{
{
ServerURL: "https://foobar.docker.io:2376/v1",
ServerURL: "https://foobar.example.com:2376/v1",
Username: "foo",
Secret: "isthebestmeshuggahalbum",
},
{
ServerURL: "https://foobar.docker.io:2375/v1",
ServerURL: "https://foobar.example.com:2375/v1",
Username: "bar",
Secret: "isthebestmeshuggahalbum",
},
Expand Down
32 changes: 16 additions & 16 deletions registryurl/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,39 @@ func TestHelperParseURL(t *testing.T) {
err error
}{
{
url: "foobar.docker.io",
expectedURL: "//foobar.docker.io",
url: "foobar.example.com",
expectedURL: "//foobar.example.com",
},
{
url: "foobar.docker.io:2376",
expectedURL: "//foobar.docker.io:2376",
url: "foobar.example.com:2376",
expectedURL: "//foobar.example.com:2376",
},
{
url: "//foobar.docker.io:2376",
expectedURL: "//foobar.docker.io:2376",
url: "//foobar.example.com:2376",
expectedURL: "//foobar.example.com:2376",
},
{
url: "http://foobar.docker.io:2376",
expectedURL: "http://foobar.docker.io:2376",
url: "http://foobar.example.com:2376",
expectedURL: "http://foobar.example.com:2376",
},
{
url: "https://foobar.docker.io:2376",
expectedURL: "https://foobar.docker.io:2376",
url: "https://foobar.example.com:2376",
expectedURL: "https://foobar.example.com:2376",
},
{
url: "https://foobar.docker.io:2376/some/path",
expectedURL: "https://foobar.docker.io:2376/some/path",
url: "https://foobar.example.com:2376/some/path",
expectedURL: "https://foobar.example.com:2376/some/path",
},
{
url: "https://foobar.docker.io:2376/some/other/path?foo=bar",
expectedURL: "https://foobar.docker.io:2376/some/other/path",
url: "https://foobar.example.com:2376/some/other/path?foo=bar",
expectedURL: "https://foobar.example.com:2376/some/other/path",
},
{
url: "/foobar.docker.io",
url: "/foobar.example.com",
err: errors.New("no hostname in URL"),
},
{
url: "ftp://foobar.docker.io:2376",
url: "ftp://foobar.example.com:2376",
err: errors.New("unsupported scheme: ftp"),
},
}
Expand Down
2 changes: 1 addition & 1 deletion secretservice/secretservice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestSecretServiceHelper(t *testing.T) {
t.Skip("test requires gnome-keyring but travis CI doesn't have it")

creds := &credentials.Credentials{
ServerURL: "https://foobar.docker.io:2376/v1",
ServerURL: "https://foobar.example.com:2376/v1",
Username: "foobar",
Secret: "foobarbaz",
}
Expand Down