From 9535c011eea3b1d91d6d173abc2a88ad00a54bef Mon Sep 17 00:00:00 2001 From: Watson Yuuma Sato Date: Fri, 21 Aug 2026 18:49:13 +0200 Subject: [PATCH] CMP-4616: Fix flaky TestScheduledSuiteNoStorage e2e test TestScheduledSuiteNoStorage validates that no PVCs are created when RawResultStorage is disabled. The test was brittle because it only accepted ResultCompliant, but under cluster pressure from ~70 parallel tests the scan can finish with a different result, causing an immediate hard failure in WaitForSuiteScansStatus. Since the test validates storage behavior and not compliance outcome, accept COMPLIANT, NON_COMPLIANT, and ERROR results using WaitForSuiteScansStatusAnyResult. Also move the PVC assertion after WaitForSuiteScansStatusAnyResult so it runs once the scan has actually completed, matching the pattern used by TestScheduledSuitePlatformNoStorage. Co-Authored-By: Claude Opus 4.6 --- tests/e2e/parallel/main_test.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/e2e/parallel/main_test.go b/tests/e2e/parallel/main_test.go index f2932bda03..6827fcb983 100644 --- a/tests/e2e/parallel/main_test.go +++ b/tests/e2e/parallel/main_test.go @@ -2431,6 +2431,14 @@ func TestScheduledSuiteNoStorage(t *testing.T) { } defer f.Client.Delete(context.TODO(), testSuite) + // Ensure that all the scans in the suite have finished and are marked as Done. + // Accept any result since this test validates storage behavior, not compliance outcome. + err = f.WaitForSuiteScansStatusAnyResult(f.OperatorNamespace, suiteName, compv1alpha1.PhaseDone, + compv1alpha1.ResultCompliant, compv1alpha1.ResultNonCompliant, compv1alpha1.ResultError) + if err != nil { + t.Fatal(err) + } + pvcList := &corev1.PersistentVolumeClaimList{} err = f.Client.List(context.TODO(), pvcList, client.InNamespace(f.OperatorNamespace), client.MatchingLabels(map[string]string{ compv1alpha1.ComplianceScanLabel: workerScanName, @@ -2438,17 +2446,8 @@ func TestScheduledSuiteNoStorage(t *testing.T) { if err != nil { t.Fatal(err) } - if len(pvcList.Items) > 0 { - for _, pvc := range pvcList.Items { - t.Fatalf("Found unexpected PVC %s", pvc.Name) - } - t.Fatal("Expected not to find PVC associated with the scan.") - } - - // Ensure that all the scans in the suite have finished and are marked as Done - err = f.WaitForSuiteScansStatus(f.OperatorNamespace, suiteName, compv1alpha1.PhaseDone, compv1alpha1.ResultCompliant) - if err != nil { - t.Fatal(err) + for _, pvc := range pvcList.Items { + t.Fatalf("Found unexpected PVC %s", pvc.Name) } }