Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,13 @@ e2e-test-wait:
e2e-parallel: e2e-set-image prep-e2e ## Run non-destructive end-to-end tests concurrently.
@CONTENT_IMAGE=$(E2E_CONTENT_IMAGE_PATH) BROKEN_CONTENT_IMAGE=$(E2E_BROKEN_CONTENT_IMAGE_PATH) $(GO) test ./tests/e2e/parallel $(E2E_GO_TEST_FLAGS) -args $(E2E_ARGS) | tee tests/e2e-parallel.log

SCAN_CONFIG_SERIAL_TESTS := TestScanStorageOutOfQuotaRangeFails|TestTolerations|TestSuspendScanSetting|TestSuspendScanSettingDoesNotCreateScan|TestScannerAndAPICollectorLimitsConfigurable|TestStrictNodeScanConfiguration
SCAN_CONFIG_NS := co-e2e-scan-config

.PHONY: e2e-scan-config
e2e-scan-config: e2e-set-image prep-e2e ## Run scan and suite configuration end-to-end tests concurrently.
@CONTENT_IMAGE=$(E2E_CONTENT_IMAGE_PATH) BROKEN_CONTENT_IMAGE=$(E2E_BROKEN_CONTENT_IMAGE_PATH) $(GO) test ./tests/e2e/scan-config $(E2E_GO_TEST_FLAGS) -args $(E2E_ARGS) | tee tests/e2e-scan-config.log
e2e-scan-config: e2e-set-image prep-e2e ## Run scan and suite configuration end-to-end tests: parallel first, then serial.
@TEST_OPERATOR_NAMESPACE=$(SCAN_CONFIG_NS) CO_SKIP_TEARDOWN=1 CONTENT_IMAGE=$(E2E_CONTENT_IMAGE_PATH) BROKEN_CONTENT_IMAGE=$(E2E_BROKEN_CONTENT_IMAGE_PATH) $(GO) test ./tests/e2e/scan-config -skip "$(SCAN_CONFIG_SERIAL_TESTS)" $(E2E_GO_TEST_FLAGS) -args $(E2E_ARGS) | tee tests/e2e-scan-config.log
@TEST_OPERATOR_NAMESPACE=$(SCAN_CONFIG_NS) CO_SKIP_SETUP=1 CONTENT_IMAGE=$(E2E_CONTENT_IMAGE_PATH) BROKEN_CONTENT_IMAGE=$(E2E_BROKEN_CONTENT_IMAGE_PATH) $(GO) test ./tests/e2e/scan-config -run "$(SCAN_CONFIG_SERIAL_TESTS)" $(E2E_GO_TEST_FLAGS) -args $(E2E_ARGS) | tee -a tests/e2e-scan-config.log

.PHONY: e2e-deployment
e2e-deployment: e2e-set-image prep-e2e ## Run operator deployment end-to-end tests concurrently.
Expand Down
10 changes: 10 additions & 0 deletions tests/e2e/framework/main_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ func (f *Framework) SetUp() error {
return fmt.Errorf("failed to change directory to project root: %w", err)
}

if os.Getenv("CO_SKIP_SETUP") != "" {
log.Println("CO_SKIP_SETUP is set, skipping cluster setup (reusing existing environment)")
return f.addFrameworks()
}

err = f.ensureTestNamespaceExists()
if err != nil {
return fmt.Errorf("unable to create or use namespace %s for testing: %w", f.OperatorNamespace, err)
Expand Down Expand Up @@ -139,6 +144,11 @@ func (f *Framework) SetUp() error {
// If we don't properly cleanup resources before deleting CRDs, it leaves resources in a
// terminating state, making them harder to cleanup.
func (f *Framework) TearDown() error {
if os.Getenv("CO_SKIP_TEARDOWN") != "" {
log.Println("CO_SKIP_TEARDOWN is set, skipping teardown (preserving environment for next run)")
return nil
}

// Make sure all scans are cleaned up before we delete the CRDs. Scans should be cleaned up
// because they're owned by ScanSettingBindings or ScanSuites, which should be cleaned up
// by each individual test either directly or through deferred cleanup. If the test fails
Expand Down
Loading