🧪 test: add JWT secret rotation BDD scenarios and step implementations #12

Merged
arcodange merged 72 commits from feature/jwt-secret-rotation into main 2026-04-11 17:56:47 +02:00
Showing only changes of commit f62c7c49a1 - Show all commits

View File

@@ -1,12 +1,9 @@
package bdd package bdd
import ( import (
"dance-lessons-coach/pkg/bdd/context"
"dance-lessons-coach/pkg/bdd/helpers"
"dance-lessons-coach/pkg/bdd/steps" "dance-lessons-coach/pkg/bdd/steps"
"dance-lessons-coach/pkg/bdd/testserver" "dance-lessons-coach/pkg/bdd/testserver"
"os" "os"
"time"
"github.com/cucumber/godog" "github.com/cucumber/godog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
@@ -14,10 +11,8 @@ import (
// FeatureSuiteContext holds feature-specific test suite context // FeatureSuiteContext holds feature-specific test suite context
type FeatureSuiteContext struct { type FeatureSuiteContext struct {
featureName string featureName string
client *testserver.Client client *testserver.Client
authContext *context.AuthContext
configContext *context.ConfigContext
// Add other feature contexts as needed // Add other feature contexts as needed
} }
@@ -51,17 +46,13 @@ func InitializeFeatureSuite(ctx *godog.TestSuiteContext) {
func InitializeFeatureScenario(ctx *godog.ScenarioContext, client *testserver.Client) { func InitializeFeatureScenario(ctx *godog.ScenarioContext, client *testserver.Client) {
featureName := os.Getenv("FEATURE") featureName := os.Getenv("FEATURE")
// Initialize feature-specific contexts
var authCtx *context.AuthContext
var configCtx *context.ConfigContext
switch featureName { switch featureName {
case "auth": case "auth":
authCtx = context.NewAuthContext(client) // Initialize auth-specific context if needed
context.InitializeAuthContext(ctx, client) steps.InitializeAllSteps(ctx, client)
case "config": case "config":
configCtx = context.NewConfigContext(client) // Initialize config-specific context if needed
context.InitializeConfigContext(ctx, client) steps.InitializeAllSteps(ctx, client)
case "greet": case "greet":
// Initialize greet-specific context if needed // Initialize greet-specific context if needed
steps.InitializeAllSteps(ctx, client) steps.InitializeAllSteps(ctx, client)
@@ -75,19 +66,6 @@ func InitializeFeatureScenario(ctx *godog.ScenarioContext, client *testserver.Cl
// Fallback to all steps for backward compatibility // Fallback to all steps for backward compatibility
steps.InitializeAllSteps(ctx, client) steps.InitializeAllSteps(ctx, client)
} }
// Initialize synchronization helpers
ctx.Step(`^I wait for the server to be ready$`, func() error {
return helpers.waitForServerReady(client, 30*time.Second)
})
ctx.Step(`^I wait for v2 API to be enabled$`, func() error {
return helpers.waitForV2APIEnabled(client, 30*time.Second)
})
ctx.Step(`^I wait for config reload to complete$`, func() error {
return helpers.waitForConfigReload(client, 10*time.Second)
})
} }
// CleanupFeatureSuite cleans up feature-specific resources // CleanupFeatureSuite cleans up feature-specific resources