Simplify TestCLIGetKubeconfigStaticToken now that there's only a single table case.
Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
parent
2e79664f3d
commit
9501168265
@ -49,34 +49,16 @@ func TestCLIGetKubeconfigStaticToken(t *testing.T) {
|
||||
// Build pinniped CLI.
|
||||
pinnipedExe := library.PinnipedCLIPath(t)
|
||||
|
||||
for _, tt := range []struct {
|
||||
name string
|
||||
args []string
|
||||
expectStderrContains []string
|
||||
}{
|
||||
{
|
||||
name: "newer command, but still using static parameters",
|
||||
args: []string{
|
||||
"get", "kubeconfig",
|
||||
stdout, stderr := runPinnipedCLI(t, nil, pinnipedExe, "get", "kubeconfig",
|
||||
"--static-token", env.TestUser.Token,
|
||||
"--concierge-api-group-suffix", env.APIGroupSuffix,
|
||||
"--concierge-authenticator-type", "webhook",
|
||||
"--concierge-authenticator-name", authenticator.Name,
|
||||
},
|
||||
expectStderrContains: []string{
|
||||
"discovered CredentialIssuer",
|
||||
"discovered Concierge endpoint",
|
||||
"discovered Concierge certificate authority bundle",
|
||||
"validated connection to the cluster",
|
||||
},
|
||||
},
|
||||
} {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
stdout, stderr := runPinnipedCLI(t, nil, pinnipedExe, tt.args...)
|
||||
for _, s := range tt.expectStderrContains {
|
||||
assert.Contains(t, stderr, s)
|
||||
}
|
||||
)
|
||||
assert.Contains(t, stderr, "discovered CredentialIssuer")
|
||||
assert.Contains(t, stderr, "discovered Concierge endpoint")
|
||||
assert.Contains(t, stderr, "discovered Concierge certificate authority bundle")
|
||||
assert.Contains(t, stderr, "validated connection to the cluster")
|
||||
|
||||
// Even the deprecated command should now generate a kubeconfig with the new "pinniped login static" command.
|
||||
restConfig := library.NewRestConfigFromKubeconfig(t, stdout)
|
||||
@ -107,6 +89,7 @@ func TestCLIGetKubeconfigStaticToken(t *testing.T) {
|
||||
t.Run("access as group "+group+" with client-go", library.AccessAsGroupTest(ctx, group, kubeClient))
|
||||
}
|
||||
|
||||
t.Run("whoami", func(t *testing.T) {
|
||||
// Validate that `pinniped whoami` returns the correct identity.
|
||||
kubeconfigPath := filepath.Join(testutil.TempDir(t), "whoami-kubeconfig")
|
||||
require.NoError(t, ioutil.WriteFile(kubeconfigPath, []byte(stdout), 0600))
|
||||
@ -121,7 +104,6 @@ func TestCLIGetKubeconfigStaticToken(t *testing.T) {
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func runPinnipedCLI(t *testing.T, envVars []string, pinnipedExe string, args ...string) (string, string) {
|
||||
t.Helper()
|
||||
|
Loading…
Reference in New Issue
Block a user