diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 2c65d4696..48c41604f 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -1417,70 +1417,5 @@ func TestE2E(t *testing.T) { return nil }, }, - - testExecution{ - Name: "TestScheduledSuiteTimeoutFail", - IsParallel: true, - TestFn: func(t *testing.T, f *framework.Framework, ctx *framework.Context, namespace string) error { - suiteName := "test-scheduled-suite-timeout-fail" - - workerScanName := fmt.Sprintf("%s-workers-scan", suiteName) - selectWorkers := map[string]string{ - "node-role.kubernetes.io/worker": "", - } - - testSuite := &compv1alpha1.ComplianceSuite{ - ObjectMeta: metav1.ObjectMeta{ - Name: suiteName, - Namespace: namespace, - }, - Spec: compv1alpha1.ComplianceSuiteSpec{ - ComplianceSuiteSettings: compv1alpha1.ComplianceSuiteSettings{ - AutoApplyRemediations: false, - }, - Scans: []compv1alpha1.ComplianceScanSpecWrapper{ - { - Name: workerScanName, - ComplianceScanSpec: compv1alpha1.ComplianceScanSpec{ - ContentImage: contentImagePath, - Profile: "xccdf_org.ssgproject.content_profile_moderate", - Content: rhcosContentFile, - Rule: "xccdf_org.ssgproject.content_rule_no_netrc_files", - NodeSelector: selectWorkers, - ComplianceScanSettings: compv1alpha1.ComplianceScanSettings{ - MaxRetryOnTimeout: 0, - RawResultStorage: compv1alpha1.RawResultStorageSettings{ - Rotation: 1, - }, - Timeout: "1s", - Debug: true, - }, - }, - }, - }, - }, - } - - err := f.Client.Create(goctx.TODO(), testSuite, getCleanupOpts(ctx)) - if err != nil { - return err - } - - // Ensure that all the scans in the suite have finished and are marked as Done - err = waitForSuiteScansStatus(t, f, namespace, suiteName, compv1alpha1.PhaseDone, compv1alpha1.ResultError) - if err != nil { - return err - } - scan := &compv1alpha1.ComplianceScan{} - err = f.Client.Get(goctx.TODO(), types.NamespacedName{Name: workerScanName, Namespace: namespace}, scan) - if err != nil { - return err - } - if _, ok := scan.Annotations[compv1alpha1.ComplianceScanTimeoutAnnotation]; !ok { - return fmt.Errorf("The scan should have the timeout annotation") - } - return nil - }, - }, ) } diff --git a/tests/e2e/parallel/main_test.go b/tests/e2e/parallel/main_test.go index 063795383..c9b495e06 100644 --- a/tests/e2e/parallel/main_test.go +++ b/tests/e2e/parallel/main_test.go @@ -2732,3 +2732,66 @@ func TestHideRule(t *testing.T) { t.Fatalf("The check should not be found in the scan %s", scanName) } } + +func TestScheduledSuiteTimeoutFail(t *testing.T) { + t.Parallel() + f := framework.Global + suiteName := "test-scheduled-suite-timeout-fail" + + workerScanName := fmt.Sprintf("%s-workers-scan", suiteName) + selectWorkers := map[string]string{ + "node-role.kubernetes.io/worker": "", + } + + testSuite := &compv1alpha1.ComplianceSuite{ + ObjectMeta: metav1.ObjectMeta{ + Name: suiteName, + Namespace: f.OperatorNamespace, + }, + Spec: compv1alpha1.ComplianceSuiteSpec{ + ComplianceSuiteSettings: compv1alpha1.ComplianceSuiteSettings{ + AutoApplyRemediations: false, + }, + Scans: []compv1alpha1.ComplianceScanSpecWrapper{ + { + Name: workerScanName, + ComplianceScanSpec: compv1alpha1.ComplianceScanSpec{ + ContentImage: contentImagePath, + Profile: "xccdf_org.ssgproject.content_profile_moderate", + Content: framework.RhcosContentFile, + Rule: "xccdf_org.ssgproject.content_rule_no_netrc_files", + NodeSelector: selectWorkers, + ComplianceScanSettings: compv1alpha1.ComplianceScanSettings{ + MaxRetryOnTimeout: 0, + RawResultStorage: compv1alpha1.RawResultStorageSettings{ + Rotation: 1, + }, + Timeout: "1s", + Debug: true, + }, + }, + }, + }, + }, + } + + err := f.Client.Create(context.TODO(), testSuite, nil) + if err != nil { + t.Fatal(err) + } + defer f.Client.Delete(context.TODO(), testSuite) + + // Ensure that all the scans in the suite have finished and are marked as Done + err = f.WaitForSuiteScansStatus(f.OperatorNamespace, suiteName, compv1alpha1.PhaseDone, compv1alpha1.ResultError) + if err != nil { + t.Fatal(err) + } + scan := &compv1alpha1.ComplianceScan{} + err = f.Client.Get(context.TODO(), types.NamespacedName{Name: workerScanName, Namespace: f.OperatorNamespace}, scan) + if err != nil { + t.Fatal(err) + } + if _, ok := scan.Annotations[compv1alpha1.ComplianceScanTimeoutAnnotation]; !ok { + t.Fatal("The scan should have the timeout annotation") + } +}