🧪 test: add BDD scenarios for config hot reloading

Adds comprehensive BDD test scenarios for configuration hot reloading functionality:
- 10 scenarios covering hot reloading of logging level, feature flags, telemetry settings, JWT TTL
- Scenarios for handling invalid configurations, file deletion/recreation, rapid changes
- Audit logging scenarios for configuration changes
- All scenarios follow black box testing principles using actual HTTP endpoints

The scenarios are marked as pending since the hot reloading feature is not yet implemented.
They will serve as executable specifications for the future implementation.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-04-09 19:16:21 +02:00
parent 1da6789e1b
commit 58c1dda4cf
3 changed files with 694 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ type StepContext struct {
authSteps *AuthSteps
commonSteps *CommonSteps
jwtRetentionSteps *JWTRetentionSteps
configSteps *ConfigSteps
}
// NewStepContext creates a new step context
@@ -25,6 +26,7 @@ func NewStepContext(client *testserver.Client) *StepContext {
authSteps: NewAuthSteps(client),
commonSteps: NewCommonSteps(client),
jwtRetentionSteps: NewJWTRetentionSteps(client),
configSteps: NewConfigSteps(client),
}
}
@@ -210,6 +212,48 @@ func InitializeAllSteps(ctx *godog.ScenarioContext, client *testserver.Client) {
ctx.Step(`^token A should still be valid until retention expires$`, sc.jwtRetentionSteps.tokenAShouldStillBeValidUntilRetentionExpires)
ctx.Step(`^when the secret is removed by cleanup$`, sc.jwtRetentionSteps.whenTheSecretIsRemovedByCleanup)
// Config steps
ctx.Step(`^the server is running with config file monitoring enabled$`, sc.configSteps.theServerIsRunningWithConfigFileMonitoringEnabled)
ctx.Step(`^I update the logging level to "([^"]*)" in the config file$`, sc.configSteps.iUpdateTheLoggingLevelToInTheConfigFile)
ctx.Step(`^the logging level should be updated without restart$`, sc.configSteps.theLoggingLevelShouldBeUpdatedWithoutRestart)
ctx.Step(`^debug logs should appear in the output$`, sc.configSteps.debugLogsShouldAppearInTheOutput)
ctx.Step(`^the v2 API is disabled$`, sc.configSteps.theV2APIIsDisabled)
ctx.Step(`^I enable the v2 API in the config file$`, sc.configSteps.iEnableTheV2APIInTheConfigFile)
ctx.Step(`^the v2 API should become available without restart$`, sc.configSteps.theV2APIShouldBecomeAvailableWithoutRestart)
ctx.Step(`^v2 API requests should succeed$`, sc.configSteps.v2APIRequestsShouldSucceed)
ctx.Step(`^telemetry is enabled$`, sc.configSteps.telemetryIsEnabled)
ctx.Step(`^I update the sampler type to "([^"]*)" in the config file$`, sc.configSteps.iUpdateTheSamplerTypeToInTheConfigFile)
ctx.Step(`^I set the sampler ratio to "([^"]*)" in the config file$`, sc.configSteps.iSetTheSamplerRatioToInTheConfigFile)
ctx.Step(`^the telemetry sampling should be updated without restart$`, sc.configSteps.theTelemetrySamplingShouldBeUpdatedWithoutRestart)
ctx.Step(`^the new sampling settings should be applied$`, sc.configSteps.theNewSamplingSettingsShouldBeApplied)
ctx.Step(`^JWT TTL is set to (\d+) hour$`, sc.configSteps.jwtTTLIsSetToHour)
ctx.Step(`^I update the JWT TTL to (\d+) hours in the config file$`, sc.configSteps.iUpdateTheJWTTTLToHoursInTheConfigFile)
ctx.Step(`^the JWT TTL should be updated without restart$`, sc.configSteps.theJWTTTLShouldBeUpdatedWithoutRestart)
ctx.Step(`^new JWT tokens should have the updated expiration$`, sc.configSteps.newJWTTokensShouldHaveTheUpdatedExpiration)
ctx.Step(`^I update the server port to (\d+) in the config file$`, sc.configSteps.iUpdateTheServerPortToInTheConfigFile)
ctx.Step(`^the server port should remain unchanged$`, sc.configSteps.theServerPortShouldRemainUnchanged)
ctx.Step(`^the server should continue running on the original port$`, sc.configSteps.theServerShouldContinueRunningOnTheOriginalPort)
ctx.Step(`^a warning should be logged about ignored configuration change$`, sc.configSteps.aWarningShouldBeLoggedAboutIgnoredConfigurationChange)
ctx.Step(`^I update the logging level to "([^"]*)" in the config file$`, sc.configSteps.iUpdateTheLoggingLevelToInvalidLevelInTheConfigFile)
ctx.Step(`^the logging level should remain unchanged$`, sc.configSteps.theLoggingLevelShouldRemainUnchanged)
ctx.Step(`^an error should be logged about invalid configuration$`, sc.configSteps.anErrorShouldBeLoggedAboutInvalidConfiguration)
ctx.Step(`^the server should continue running normally$`, sc.configSteps.theServerShouldContinueRunningNormally)
ctx.Step(`^I delete the config file$`, sc.configSteps.iDeleteTheConfigFile)
ctx.Step(`^the server should continue running with last known good configuration$`, sc.configSteps.theServerShouldContinueRunningWithLastKnownGoodConfiguration)
ctx.Step(`^a warning should be logged about missing config file$`, sc.configSteps.aWarningShouldBeLoggedAboutMissingConfigFile)
ctx.Step(`^I have deleted the config file$`, sc.configSteps.iHaveDeletedTheConfigFile)
ctx.Step(`^I recreate the config file with valid configuration$`, sc.configSteps.iRecreateTheConfigFileWithValidConfiguration)
ctx.Step(`^the server should reload the configuration$`, sc.configSteps.theServerShouldReloadTheConfiguration)
ctx.Step(`^the new configuration should be applied$`, sc.configSteps.theNewConfigurationShouldBeApplied)
ctx.Step(`^I rapidly update the logging level multiple times$`, sc.configSteps.iRapidlyUpdateTheLoggingLevelMultipleTimes)
ctx.Step(`^all changes should be processed in order$`, sc.configSteps.allChangesShouldBeProcessedInOrder)
ctx.Step(`^the final configuration should be applied$`, sc.configSteps.theFinalConfigurationShouldBeApplied)
ctx.Step(`^no configuration changes should be lost$`, sc.configSteps.noConfigurationChangesShouldBeLost)
ctx.Step(`^audit logging is enabled$`, sc.configSteps.auditLoggingIsEnabled)
ctx.Step(`^an audit log entry should be created$`, sc.configSteps.anAuditLogEntryShouldBeCreated)
ctx.Step(`^the audit entry should contain the previous and new values$`, sc.configSteps.theAuditEntryShouldContainThePreviousAndNewValues)
ctx.Step(`^the audit entry should contain the timestamp of the change$`, sc.configSteps.theAuditEntryShouldContainTheTimestampOfTheChange)
// Common steps
ctx.Step(`^the response should be "{\\"([^"]*)":\\"([^"]*)"}"$`, sc.commonSteps.theResponseShouldBe)
ctx.Step(`^the response should contain error "([^"]*)"$`, sc.commonSteps.theResponseShouldContainError)