mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 19:47:56 +00:00
Run apiserver/oidc
integration tests in parallel
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
This commit is contained in:
parent
e8588e6493
commit
d8d0bbff2d
@ -406,6 +406,7 @@ jwt:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
tt := tt
|
||||||
t.Run(tt.name, singleTestRunner(useAuthenticationConfig, rsaGenerateKey, tt))
|
t.Run(tt.name, singleTestRunner(useAuthenticationConfig, rsaGenerateKey, tt))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,6 +466,8 @@ func singleTestRunner[K utilsoidc.JosePrivateKey, L utilsoidc.JosePublicKey](
|
|||||||
tt singleTest[K, L],
|
tt singleTest[K, L],
|
||||||
) func(t *testing.T) {
|
) func(t *testing.T) {
|
||||||
return func(t *testing.T) {
|
return func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
fn := func(t *testing.T, issuerURL, caCert string) string { return "" }
|
fn := func(t *testing.T, issuerURL, caCert string) string { return "" }
|
||||||
if useAuthenticationConfig {
|
if useAuthenticationConfig {
|
||||||
fn = func(t *testing.T, issuerURL, caCert string) string {
|
fn = func(t *testing.T, issuerURL, caCert string) string {
|
||||||
@ -502,6 +505,8 @@ jwt:
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdatingRefreshTokenInCaseOfExpiredIDToken(t *testing.T) {
|
func TestUpdatingRefreshTokenInCaseOfExpiredIDToken(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
type testRun[K utilsoidc.JosePrivateKey] struct {
|
type testRun[K utilsoidc.JosePrivateKey] struct {
|
||||||
name string
|
name string
|
||||||
configureUpdatingTokenBehaviour func(t *testing.T, oidcServer *utilsoidc.TestServer, signingPrivateKey K)
|
configureUpdatingTokenBehaviour func(t *testing.T, oidcServer *utilsoidc.TestServer, signingPrivateKey K)
|
||||||
@ -544,6 +549,7 @@ func TestUpdatingRefreshTokenInCaseOfExpiredIDToken(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
tt := tt
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
expiredIDToken, stubRefreshToken := fetchExpiredToken(t, oidcServer, caCert, signingPrivateKey)
|
expiredIDToken, stubRefreshToken := fetchExpiredToken(t, oidcServer, caCert, signingPrivateKey)
|
||||||
clientConfig := configureClientConfigForOIDC(t, apiServer.ClientConfig, defaultOIDCClientID, certPath, expiredIDToken, stubRefreshToken, oidcServer.URL())
|
clientConfig := configureClientConfigForOIDC(t, apiServer.ClientConfig, defaultOIDCClientID, certPath, expiredIDToken, stubRefreshToken, oidcServer.URL())
|
||||||
@ -942,7 +948,9 @@ jwt:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
tt := tt
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
oidcServer, apiServer, signingPrivateKey, caCert, certPath := tt.configureInfrastructure(t, tt.authConfigFn, rsaGenerateKey)
|
oidcServer, apiServer, signingPrivateKey, caCert, certPath := tt.configureInfrastructure(t, tt.authConfigFn, rsaGenerateKey)
|
||||||
|
|
||||||
tt.configureOIDCServerBehaviour(t, oidcServer, signingPrivateKey)
|
tt.configureOIDCServerBehaviour(t, oidcServer, signingPrivateKey)
|
||||||
@ -1311,6 +1319,7 @@ jwt:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
tt := tt
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
authenticationconfigmetrics.ResetMetricsForTest()
|
authenticationconfigmetrics.ResetMetricsForTest()
|
||||||
defer authenticationconfigmetrics.ResetMetricsForTest()
|
defer authenticationconfigmetrics.ResetMetricsForTest()
|
||||||
@ -1472,7 +1481,9 @@ func TestStructuredAuthenticationDiscoveryURL(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
tt := tt
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
caCertContent, _, caFilePath, caKeyFilePath := generateCert(t)
|
caCertContent, _, caFilePath, caKeyFilePath := generateCert(t)
|
||||||
signingPrivateKey, publicKey := rsaGenerateKey(t)
|
signingPrivateKey, publicKey := rsaGenerateKey(t)
|
||||||
// set the issuer in the discovery document to issuer url (different from the discovery URL) to assert
|
// set the issuer in the discovery document to issuer url (different from the discovery URL) to assert
|
||||||
|
Loading…
Reference in New Issue
Block a user