Skip to content

Commit 5c4bf7b

Browse files
🌱 test: ensure single/own namespace increase coverage for both runtimes (#2463)
* test: ensure single/own namespace increase coverage for both runtimes Add E2E test scenarios for single/own namespace support that run for both Helm and Boxcutter runtimes: 1. Invalid DNS-1123 watchNamespace - tests namespace name validation 2. Reject watchNamespace for AllNamespaces-only operators Tests use assertions compatible with both runtimes. Unit tests in provider_test.go provide comprehensive validation coverage via shared RegistryV1ManifestProvider. Achieves 100% parity with downstream OCP test coverage. * test: improve error message assertions for validation scenarios Enhance both new test scenarios with more complete error message assertions: 1. DNS-1123 validation test: Now checks for the full error context including "invalid ClusterExtension configuration: invalid target namespaces [invalid-namespace-]: a lowercase RFC 1123 subdomain..." instead of just "lowercase RFC 1123". 2. AllNamespaces operator rejection test: Now verifies the complete error about "invalid ClusterExtension configuration: supported install modes [AllNamespaces] do not support target namespaces" instead of just "watchNamespace". These more comprehensive assertions better demonstrate that proper validation is occurring and provide clearer test documentation of the expected error behavior. Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent e50144a commit 5c4bf7b

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

‎test/e2e/features/install.feature‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,67 @@ Feature: Install ClusterExtension
298298
mutate: true
299299
"""
300300

301+
@SingleOwnNamespaceInstallSupport
302+
Scenario: Report failure when watchNamespace has invalid DNS-1123 name
303+
Given ServiceAccount "olm-admin" in test namespace is cluster admin
304+
When ClusterExtension is applied
305+
"""
306+
apiVersion: olm.operatorframework.io/v1
307+
kind: ClusterExtension
308+
metadata:
309+
name: ${NAME}
310+
spec:
311+
namespace: ${TEST_NAMESPACE}
312+
serviceAccount:
313+
name: olm-admin
314+
config:
315+
configType: Inline
316+
inline:
317+
watchNamespace: invalid-namespace-
318+
source:
319+
sourceType: Catalog
320+
catalog:
321+
packageName: single-namespace-operator
322+
selector:
323+
matchLabels:
324+
"olm.operatorframework.io/metadata.name": test-catalog
325+
"""
326+
Then ClusterExtension reports Progressing as True with Reason Retrying and Message includes:
327+
"""
328+
invalid ClusterExtension configuration: invalid configuration: field "watchNamespace" must match pattern
329+
"""
330+
331+
@SingleOwnNamespaceInstallSupport
332+
@WebhookProviderCertManager
333+
Scenario: Reject watchNamespace for operator that does not support Single/OwnNamespace install modes
334+
Given ServiceAccount "olm-admin" in test namespace is cluster admin
335+
When ClusterExtension is applied
336+
"""
337+
apiVersion: olm.operatorframework.io/v1
338+
kind: ClusterExtension
339+
metadata:
340+
name: ${NAME}
341+
spec:
342+
namespace: ${TEST_NAMESPACE}
343+
serviceAccount:
344+
name: olm-admin
345+
config:
346+
configType: Inline
347+
inline:
348+
watchNamespace: ${TEST_NAMESPACE}
349+
source:
350+
sourceType: Catalog
351+
catalog:
352+
packageName: webhook-operator
353+
selector:
354+
matchLabels:
355+
"olm.operatorframework.io/metadata.name": test-catalog
356+
"""
357+
Then ClusterExtension reports Progressing as True with Reason Retrying and Message includes:
358+
"""
359+
invalid ClusterExtension configuration: invalid configuration: unknown field "watchNamespace"
360+
"""
361+
301362
@BoxcutterRuntime
302363
@ProgressDeadline
303364
Scenario: Report ClusterExtension as not progressing if the rollout does not complete within given timeout

0 commit comments

Comments
 (0)