mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-01 02:12:50 +02:00
integration: test with both authentication flows (#4817)
Add an environment variable to allow forcing either the stateful or the stateless authenticate flow. Split the existing integration test clusters "single" and "multi" into four new clusters: "single-stateful", "single-stateless", "multi-stateful", and "multi-stateless", so that the integration tests will run for both the stateful and the stateless authenticate flows. (The "kubernetes" cluster is not currently being run, so I've left it alone for now.)
This commit is contained in:
parent
a0d5f49c17
commit
08c186a72e
19 changed files with 1819 additions and 19 deletions
|
@ -23,7 +23,7 @@ import (
|
|||
"golang.org/x/net/publicsuffix"
|
||||
)
|
||||
|
||||
var IDP, ClusterType string
|
||||
var IDP, ClusterType, AuthenticateFlow string
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
||||
|
@ -44,7 +44,7 @@ func TestMain(m *testing.M) {
|
|||
return
|
||||
}
|
||||
|
||||
setIDPAndClusterType(ctx)
|
||||
setClusterInfo(ctx)
|
||||
|
||||
status := m.Run()
|
||||
os.Exit(status)
|
||||
|
@ -169,9 +169,10 @@ func waitForHealthy(ctx context.Context) error {
|
|||
}
|
||||
}
|
||||
|
||||
func setIDPAndClusterType(ctx context.Context) {
|
||||
func setClusterInfo(ctx context.Context) {
|
||||
IDP = "oidc"
|
||||
ClusterType = "single"
|
||||
AuthenticateFlow = "stateful"
|
||||
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
|
||||
if err != nil {
|
||||
|
@ -185,14 +186,19 @@ func setIDPAndClusterType(ctx context.Context) {
|
|||
}
|
||||
for _, container := range containers {
|
||||
for _, name := range container.Names {
|
||||
parts := regexp.MustCompile(`^/(\w+?)[-_]pomerium.*$`).FindStringSubmatch(name)
|
||||
if len(parts) == 2 {
|
||||
parts := regexp.MustCompile(`^/(\w+?)-(\w+?)[-_]pomerium.*$`).FindStringSubmatch(name)
|
||||
if len(parts) == 3 {
|
||||
ClusterType = parts[1]
|
||||
AuthenticateFlow = parts[2]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Info().Str("idp", IDP).Str("cluster-type", ClusterType).Send()
|
||||
log.Info().
|
||||
Str("idp", IDP).
|
||||
Str("cluster-type", ClusterType).
|
||||
Str("authenticate-flow", AuthenticateFlow).
|
||||
Send()
|
||||
}
|
||||
|
||||
func mustParseURL(str string) *url.URL {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue