refactor InferSupervisorIssuerURL() func; remove a TODO

Co-authored-by: Joshua Casey <joshuatcasey@gmail.com>
Co-authored-by: Ashish Amarnath <ashish.amarnath@broadcom.com>
This commit is contained in:
Ryan Richard
2024-07-24 10:27:39 -07:00
parent 60f82d2a55
commit ca2dd2d476
5 changed files with 7 additions and 10 deletions

View File

@@ -178,7 +178,7 @@ func TestTLSSpecKubeBuilderValidationConcierge_Parallel(t *testing.T) {
})
t.Run("apply jwt authenticator", func(t *testing.T) {
_, supervisorIssuer := env.SupervisorUpstreamOIDC.InferTheIssuerURL(t)
_, supervisorIssuer := env.InferSupervisorIssuerURL(t)
jwtAuthenticatorResourceName := "test-jwt-authenticator-" + testlib.RandHex(t, 7)
jwtAuthenticatorYamlBytes := []byte(fmt.Sprintf(jwtAuthenticatorYamlTemplate,

View File

@@ -70,7 +70,7 @@ func TestE2EFullIntegration_Browser(t *testing.T) {
// Build pinniped CLI.
pinnipedExe := testlib.PinnipedCLIPath(t)
issuerURL, _ := env.SupervisorUpstreamOIDC.InferTheIssuerURL(t)
issuerURL, _ := env.InferSupervisorIssuerURL(t)
// Generate a CA bundle with which to serve this provider.
t.Logf("generating test CA")

View File

@@ -1240,7 +1240,6 @@ func TestSupervisorLogin_Browser(t *testing.T) {
},
wantDownstreamIDTokenGroups: env.SupervisorUpstreamActiveDirectory.TestUserIndirectGroupsSAMAccountPlusDomainNames,
},
// TODO: this test is disabled- where can this be run?
{
name: "active directory IDP using secret of type opaque to source ca bundle with all default options",
maybeSkip: skipActiveDirectoryTests,
@@ -1282,7 +1281,6 @@ func TestSupervisorLogin_Browser(t *testing.T) {
},
wantDownstreamIDTokenGroups: env.SupervisorUpstreamActiveDirectory.TestUserIndirectGroupsSAMAccountPlusDomainNames,
},
// TODO: this test is disabled- where can this be run?
{
name: "active directory IDP using secret of type TLS to source ca bundle with all default options",
maybeSkip: skipActiveDirectoryTests,
@@ -1326,7 +1324,6 @@ func TestSupervisorLogin_Browser(t *testing.T) {
},
wantDownstreamIDTokenGroups: env.SupervisorUpstreamActiveDirectory.TestUserIndirectGroupsSAMAccountPlusDomainNames,
},
// TODO: this test is disabled- where can this be run?
{
name: "active directory IDP using configmaps to source ca bundle with all default options",
maybeSkip: skipActiveDirectoryTests,
@@ -2948,7 +2945,7 @@ func testSupervisorLogin(
ctx, cancel := context.WithTimeout(context.Background(), 7*time.Minute)
defer cancel()
issuerURL, _ := env.SupervisorUpstreamOIDC.InferTheIssuerURL(t)
issuerURL, _ := env.InferSupervisorIssuerURL(t)
// Generate a CA bundle with which to serve this provider.
t.Logf("generating test CA")

View File

@@ -48,7 +48,7 @@ func TestSupervisorWarnings_Browser(t *testing.T) {
pinnipedExe := testlib.PinnipedCLIPath(t)
tempDir := t.TempDir()
issuerURL, _ := env.SupervisorUpstreamOIDC.InferTheIssuerURL(t)
issuerURL, _ := env.InferSupervisorIssuerURL(t)
// Generate a CA bundle with which to serve this provider.
t.Logf("generating test CA")

View File

@@ -84,10 +84,10 @@ type TestOIDCUpstream struct {
ExpectedGroups []string `json:"expectedGroups"`
}
// InferTheIssuerURL infers the downstream issuer URL from the callback associated with the upstream test client registration.
func (upstream *TestOIDCUpstream) InferTheIssuerURL(t *testing.T) (*url.URL, string) {
// InferSupervisorIssuerURL infers the downstream issuer URL from the callback associated with the upstream test client registration.
func (e *TestEnv) InferSupervisorIssuerURL(t *testing.T) (*url.URL, string) {
t.Helper()
issuerURL, err := url.Parse(upstream.CallbackURL)
issuerURL, err := url.Parse(e.SupervisorUpstreamOIDC.CallbackURL)
require.NoError(t, err)
require.True(t, strings.HasSuffix(issuerURL.Path, "/callback"))
issuerURL.Path = strings.TrimSuffix(issuerURL.Path, "/callback")