mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 22:20:51 +00:00
make the dockerkeyring handle mutiple matching credentials
This commit is contained in:
@@ -104,10 +104,15 @@ func TestJwtProvider(t *testing.T) {
|
||||
// Verify that we get the expected username/password combo for
|
||||
// a gcr.io image name.
|
||||
registryUrl := "gcr.io/foo/bar"
|
||||
val, ok := keyring.Lookup(registryUrl)
|
||||
creds, ok := keyring.Lookup(registryUrl)
|
||||
if !ok {
|
||||
t.Errorf("Didn't find expected URL: %s", registryUrl)
|
||||
return
|
||||
}
|
||||
if len(creds) > 1 {
|
||||
t.Errorf("Got more hits than expected: %s", creds)
|
||||
}
|
||||
val := creds[0]
|
||||
|
||||
if "_token" != val.Username {
|
||||
t.Errorf("Unexpected username value, want: _token, got: %s", val.Username)
|
||||
|
@@ -76,10 +76,15 @@ func TestDockerKeyringFromGoogleDockerConfigMetadata(t *testing.T) {
|
||||
|
||||
keyring.Add(provider.Provide())
|
||||
|
||||
val, ok := keyring.Lookup(registryUrl)
|
||||
creds, ok := keyring.Lookup(registryUrl)
|
||||
if !ok {
|
||||
t.Errorf("Didn't find expected URL: %s", registryUrl)
|
||||
return
|
||||
}
|
||||
if len(creds) > 1 {
|
||||
t.Errorf("Got more hits than expected: %s", creds)
|
||||
}
|
||||
val := creds[0]
|
||||
|
||||
if username != val.Username {
|
||||
t.Errorf("Unexpected username value, want: %s, got: %s", username, val.Username)
|
||||
@@ -143,10 +148,15 @@ func TestDockerKeyringFromGoogleDockerConfigMetadataUrl(t *testing.T) {
|
||||
|
||||
keyring.Add(provider.Provide())
|
||||
|
||||
val, ok := keyring.Lookup(registryUrl)
|
||||
creds, ok := keyring.Lookup(registryUrl)
|
||||
if !ok {
|
||||
t.Errorf("Didn't find expected URL: %s", registryUrl)
|
||||
return
|
||||
}
|
||||
if len(creds) > 1 {
|
||||
t.Errorf("Got more hits than expected: %s", creds)
|
||||
}
|
||||
val := creds[0]
|
||||
|
||||
if username != val.Username {
|
||||
t.Errorf("Unexpected username value, want: %s, got: %s", username, val.Username)
|
||||
@@ -211,10 +221,15 @@ func TestContainerRegistryBasics(t *testing.T) {
|
||||
|
||||
keyring.Add(provider.Provide())
|
||||
|
||||
val, ok := keyring.Lookup(registryUrl)
|
||||
creds, ok := keyring.Lookup(registryUrl)
|
||||
if !ok {
|
||||
t.Errorf("Didn't find expected URL: %s", registryUrl)
|
||||
return
|
||||
}
|
||||
if len(creds) > 1 {
|
||||
t.Errorf("Got more hits than expected: %s", creds)
|
||||
}
|
||||
val := creds[0]
|
||||
|
||||
if "_token" != val.Username {
|
||||
t.Errorf("Unexpected username value, want: %s, got: %s", "_token", val.Username)
|
||||
|
Reference in New Issue
Block a user