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) } }