Add a more detailed error message for potential auth fails in docker pull.

This commit is contained in:
Brendan Burns
2015-02-10 07:23:32 -08:00
parent e27d534b87
commit 0532c46217
3 changed files with 45 additions and 1 deletions

View File

@@ -196,6 +196,27 @@ func TestParseImageName(t *testing.T) {
}
}
func TestDockerKeyringLookupFails(t *testing.T) {
fakeKeyring := &credentialprovider.FakeKeyring{}
fakeClient := &FakeDockerClient{
Err: fmt.Errorf("test error"),
}
dp := dockerPuller{
client: fakeClient,
keyring: fakeKeyring,
}
err := dp.Pull("host/repository/image:version")
if err == nil {
t.Errorf("unexpected non-error")
}
msg := "image pull failed for host/repository/image, this may be because there are no credentials on this request. details: (test error)"
if err.Error() != msg {
t.Errorf("expected: %s, saw: %s", msg, err.Error())
}
}
func TestDockerKeyringLookup(t *testing.T) {
empty := docker.AuthConfiguration{}