Skip to content

Commit

Permalink
pkg/credentialprovider/plugin: add a unit test for when apiVersion is…
Browse files Browse the repository at this point in the history
… mismatched from plugins

Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
  • Loading branch information
andrewsykim committed Sep 20, 2022
1 parent eb8495d commit 5bd1080
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/credentialprovider/plugin/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,21 @@ func Test_Provide(t *testing.T) {
},
},
},
{
name: "kubelet configured with v1beta1 but plugin returns v1alpha1",
pluginProvider: &pluginProvider{
apiVersion: credentialproviderv1beta1.SchemeGroupVersion.String(),
clock: tclock,
lastCachePurge: tclock.Now(),
matchImages: []string{"*.registry.io"},
cache: cache.NewExpirationStore(cacheKeyFunc, &cacheExpirationPolicy{clock: tclock}),
plugin: &fakeExecPlugin{
data: []byte(`{"kind":"CredentialProviderResponse","apiVersion":"credentialprovider.kubelet.k8s.io/v1alpha1","cacheKeyType":"Global","cacheDuration":"1m","auth":{"*.registry.io":{"username":"user","password":"password"}}}`),
},
},
image: "test.registry.io",
dockerconfig: credentialprovider.DockerConfig{},
},
}

for _, testcase := range testcases {
Expand Down

0 comments on commit 5bd1080

Please sign in to comment.