1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30

I think OSX tests were failing because it was a list against an empty keychain, checking whether that is the case by filling it first

Signed-off-by: avaid96 <avaid1996@gmail.com>
This commit is contained in:
avaid96
2016-07-12 10:23:05 -07:00
parent d2e6ed779a
commit 887a66459a
2 changed files with 10 additions and 4 deletions
+1
View File
@@ -104,6 +104,7 @@ func (h Osxkeychain) List() ([]string, []string, error) {
if errMsg != nil {
defer C.free(unsafe.Pointer(errMsg))
goMsg := C.GoString(errMsg)
goMsg = "Error is here"
return nil, nil, errors.New(goMsg)
}
var listLen int
+9 -4
View File
@@ -11,7 +11,11 @@ func TestOSXKeychainHelper(t *testing.T) {
Username: "foobar",
Secret: "foobarbaz",
}
creds1 := &credentials.Credentials{
ServerURL: "https://foobar.docker.io:2376/v2",
Username: "foobarbaz",
Secret: "foobar",
}
helper := Osxkeychain{}
if err := helper.Add(creds); err != nil {
t.Fatal(err)
@@ -33,17 +37,18 @@ func TestOSXKeychainHelper(t *testing.T) {
if err := helper.Delete(creds.ServerURL); err != nil {
t.Fatal(err)
}
helper.Add(creds);
defer helper.Delete(creds.ServerURL)
paths, accts, err := helper.List()
if err != nil || len(paths) == 0 || len(accts) == 0 {
t.Fatal(err)
}
helper.Add(creds)
helper.Add(creds1)
newpaths, newaccts, err := helper.List()
if len(newpaths)-len(paths) != 1 || len(newaccts)-len(accts) != 1 {
t.Fatal(err)
}
helper.Delete(creds.ServerURL)
helper.Delete(creds1.ServerURL)
}
func TestMissingCredentials(t *testing.T) {