exec credential provider: update tests+metadata for v1

Signed-off-by: Andrew Keesler <akeesler@vmware.com>

Kubernetes-commit: 20e1c4d7548de0b39a2d70a748ca0b9aab28f631
This commit is contained in:
Andrew Keesler
2021-06-28 10:58:02 -04:00
committed by Kubernetes Publisher
parent dba1c9aa68
commit f00874ad93
6 changed files with 168 additions and 28 deletions

View File

@@ -980,6 +980,36 @@ func TestRefreshCreds(t *testing.T) {
}`,
wantCreds: credentials{token: "foo-bar"},
},
{
name: "v1-basic-request",
config: api.ExecConfig{
APIVersion: "client.authentication.k8s.io/v1",
InteractiveMode: api.IfAvailableExecInteractiveMode,
},
wantInput: `{
"kind": "ExecCredential",
"apiVersion": "client.authentication.k8s.io/v1",
"spec": {
"interactive": false
}
}`,
output: `{
"kind": "ExecCredential",
"apiVersion": "client.authentication.k8s.io/v1",
"status": {
"token": "foo-bar"
}
}`,
wantCreds: credentials{token: "foo-bar"},
},
{
name: "v1-with-missing-interactive-mode",
config: api.ExecConfig{
APIVersion: "client.authentication.k8s.io/v1",
},
wantErr: true,
wantErrSubstr: `exec plugin cannot support interactive mode: unknown interactiveMode: ""`,
},
}
for _, test := range tests {