🧪 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 520da07bfe - Show all commits

View File

@@ -111,15 +111,9 @@ func (s *JWTRetentionSteps) iWaitForTheRetentionPeriodToElapse() error {
func (s *JWTRetentionSteps) theExpiredSecondarySecretShouldBeAutomaticallyRemoved() error {
// Verify the secondary secret is no longer valid
// Since we can't actually test secret expiration in this mock implementation,
// we'll verify that the retention period has elapsed
if s.elapsedHours == 0 {
return fmt.Errorf("retention period has not elapsed")
}
// In a real implementation, we would try to use the expired secret
// and verify it fails. For now, we'll just verify the time has passed.
return nil
// In a real implementation, this would try to use the expired secret
// and verify it fails. Currently just a placeholder.
return godog.ErrPending
}
func (s *JWTRetentionSteps) thePrimarySecretShouldRemainActive() error {
@@ -131,8 +125,7 @@ func (s *JWTRetentionSteps) thePrimarySecretShouldRemainActive() error {
func (s *JWTRetentionSteps) iShouldSeeCleanupEventInLogs() error {
// Check logs for cleanup events
// In real implementation, this would verify log output
// For now, we'll just verify server is running
return s.client.Request("GET", "/api/ready", nil)
return godog.ErrPending
}
// Retention Calculation Steps
@@ -277,35 +270,20 @@ func (s *JWTRetentionSteps) iHaveEnabledPrometheusMetrics() error {
func (s *JWTRetentionSteps) iShouldSeeMetricIncrement(metric string) error {
// Verify metric was incremented
if !s.metricsEnabled {
return fmt.Errorf("metrics not enabled")
}
// Store the metric for verification
s.lastMetric = metric
s.metricIncremented = true
return nil
// In real implementation, this would check actual metrics
return godog.ErrPending
}
func (s *JWTRetentionSteps) iShouldSeeMetricDecrease(metric string) error {
// Verify metric was decremented
if !s.metricsEnabled {
return fmt.Errorf("metrics not enabled")
}
// Store the metric for verification
s.lastMetric = metric
s.metricDecremented = true
return nil
// In real implementation, this would check actual metrics
return godog.ErrPending
}
func (s *JWTRetentionSteps) iShouldSeeHistogramUpdate(metric string) error {
// Verify histogram was updated
if !s.metricsEnabled {
return fmt.Errorf("metrics not enabled")
}
// Store the histogram metric for verification
s.lastHistogramMetric = metric
s.histogramUpdated = true
return nil
// In real implementation, this would check actual histogram metrics
return godog.ErrPending
}
// Logging Steps
@@ -336,8 +314,8 @@ func (s *JWTRetentionSteps) theLogsShouldShowMaskedSecret(masked string) error {
func (s *JWTRetentionSteps) theLogsShouldNotExposeTheFullSecret() error {
// Verify no full secret exposure
// For now, we'll just verify server is running
return s.client.Request("GET", "/api/ready", nil)
// In real implementation, this would check log output
return godog.ErrPending
}
// Performance Steps