🧪 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
import (
"dance-lessons-coach/pkg/bdd/context"
"dance-lessons-coach/pkg/bdd/helpers"
"dance-lessons-coach/pkg/bdd/steps"
"dance-lessons-coach/pkg/bdd/testserver"
"os"
"time"
"github.com/cucumber/godog"
"github.com/rs/zerolog/log"
@@ -14,10 +11,8 @@ import (
// FeatureSuiteContext holds feature-specific test suite context
type FeatureSuiteContext struct {
featureName string
client *testserver.Client
authContext *context.AuthContext
configContext *context.ConfigContext
featureName string
client *testserver.Client
// Add other feature contexts as needed
}
@@ -51,17 +46,13 @@ func InitializeFeatureSuite(ctx *godog.TestSuiteContext) {
func InitializeFeatureScenario(ctx *godog.ScenarioContext, client *testserver.Client) {
featureName := os.Getenv("FEATURE")
// Initialize feature-specific contexts
var authCtx *context.AuthContext
var configCtx *context.ConfigContext
switch featureName {
case "auth":
authCtx = context.NewAuthContext(client)
context.InitializeAuthContext(ctx, client)
// Initialize auth-specific context if needed
steps.InitializeAllSteps(ctx, client)
case "config":
configCtx = context.NewConfigContext(client)
context.InitializeConfigContext(ctx, client)
// Initialize config-specific context if needed
steps.InitializeAllSteps(ctx, client)
case "greet":
// Initialize greet-specific context if needed
steps.InitializeAllSteps(ctx, client)
@@ -75,19 +66,6 @@ func InitializeFeatureScenario(ctx *godog.ScenarioContext, client *testserver.Cl
// Fallback to all steps for backward compatibility
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