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