From 520da07bfe94ea4adb2b5e637961be19d9707338 Mon Sep 17 00:00:00 2001 From: Gabriel Radureau Date: Fri, 10 Apr 2026 08:50:45 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20test:=20fix=20poor=20BDD=20step?= =?UTF-8?q?=20implementations=20to=20properly=20use=20ErrPending\n\n-=20Ma?= =?UTF-8?q?ke=206=20step=20functions=20return=20godog.ErrPending=20instead?= =?UTF-8?q?=20of=20misleading=20nil=20returns\n-=20theExpiredSecondarySecr?= =?UTF-8?q?etShouldBeAutomaticallyRemoved:=20was=20only=20checking=20time\?= =?UTF-8?q?n-=20iShouldSeeCleanupEventInLogs:=20was=20only=20checking=20se?= =?UTF-8?q?rver=20status\n-=20theLogsShouldNotExposeTheFullSecret:=20was?= =?UTF-8?q?=20only=20checking=20server=20status\n-=20iShouldSeeMetricIncre?= =?UTF-8?q?ment/Decrease/HistogramUpdate:=20were=20only=20setting=20flags\?= =?UTF-8?q?n-=20These=20functions=20now=20honestly=20reflect=20their=20uni?= =?UTF-8?q?mplemented=20status\n-=20Maintains=20all=20legitimate=20setup?= =?UTF-8?q?=20functions=20and=20proper=20test=20implementations\n\nGenerat?= =?UTF-8?q?ed=20by=20Mistral=20Vibe.\nCo-Authored-By:=20Mistral=20Vibe=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/bdd/steps/jwt_retention_steps.go | 46 ++++++++-------------------- 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/pkg/bdd/steps/jwt_retention_steps.go b/pkg/bdd/steps/jwt_retention_steps.go index 2fcdeeb..74f5fe4 100644 --- a/pkg/bdd/steps/jwt_retention_steps.go +++ b/pkg/bdd/steps/jwt_retention_steps.go @@ -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