Fix TestCLIGetKubeconfigStaticToken for new CLI log output.

Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
Matt Moyer 2021-03-11 15:47:39 -06:00
parent 2d28d1da19
commit a64786a728
No known key found for this signature in database
GPG Key ID: EAE88AD172C5AE2D
1 changed files with 13 additions and 4 deletions

View File

@ -20,6 +20,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
"gopkg.in/square/go-jose.v2" "gopkg.in/square/go-jose.v2"
@ -47,9 +48,9 @@ func TestCLIGetKubeconfigStaticToken(t *testing.T) {
pinnipedExe := library.PinnipedCLIPath(t) pinnipedExe := library.PinnipedCLIPath(t)
for _, tt := range []struct { for _, tt := range []struct {
name string name string
args []string args []string
expectStderr string expectStderrContains []string
}{ }{
{ {
name: "newer command, but still using static parameters", name: "newer command, but still using static parameters",
@ -60,12 +61,20 @@ func TestCLIGetKubeconfigStaticToken(t *testing.T) {
"--concierge-authenticator-type", "webhook", "--concierge-authenticator-type", "webhook",
"--concierge-authenticator-name", authenticator.Name, "--concierge-authenticator-name", authenticator.Name,
}, },
expectStderrContains: []string{
"discovered CredentialIssuer",
"discovered Concierge endpoint",
"discovered Concierge certificate authority bundle",
"validated connection to the cluster",
},
}, },
} { } {
tt := tt tt := tt
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
stdout, stderr := runPinnipedCLI(t, nil, pinnipedExe, tt.args...) stdout, stderr := runPinnipedCLI(t, nil, pinnipedExe, tt.args...)
require.Equal(t, tt.expectStderr, stderr) for _, s := range tt.expectStderrContains {
assert.Contains(t, stderr, s)
}
// Even the deprecated command should now generate a kubeconfig with the new "pinniped login static" command. // Even the deprecated command should now generate a kubeconfig with the new "pinniped login static" command.
restConfig := library.NewRestConfigFromKubeconfig(t, stdout) restConfig := library.NewRestConfigFromKubeconfig(t, stdout)