From 1e3057d2e2a260c565a983c539ccf35e38a8f21b Mon Sep 17 00:00:00 2001 From: "Per G. da Silva" Date: Mon, 19 Oct 2026 16:44:13 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B1=20add=20COS=20referenced-content?= =?UTF-8?q?=20PreconditionsNotMet=20e2e=20scenarios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cover the two referenced-Secret content-validation preconditions that were not yet exercised in revision.feature: - a ref pointing to a key that is not present in the Secret, and - a ref whose content is not valid JSON. Both assert Ready=False/PreconditionsNotMet with the controller's "Referenced content is invalid: ..." message. Co-Authored-By: Claude Opus 4.8 Signed-off-by: Per G. da Silva --- test/e2e/features/revision.feature | 87 ++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/test/e2e/features/revision.feature b/test/e2e/features/revision.feature index a52e48a1ee..633440547c 100644 --- a/test/e2e/features/revision.feature +++ b/test/e2e/features/revision.feature @@ -580,6 +580,93 @@ Feature: Install ClusterObjectSet And ClusterObjectSet "${COS_NAME}" reconciliation is triggered Then ClusterObjectSet "${COS_NAME}" reports Ready as True with Reason AllObjectsReady + Scenario: ClusterObjectSet reports PreconditionsNotMet when a referenced Secret is missing the key + Given namespace "${TEST_NAMESPACE}" is available + And resource is applied + """ + apiVersion: v1 + kind: Secret + metadata: + name: ${COS_NAME}-missing-key-secret + namespace: ${TEST_NAMESPACE} + immutable: true + type: olm.operatorframework.io/object-data + stringData: + configmap: | + { + "apiVersion": "v1", + "kind": "ConfigMap", + "metadata": { + "name": "test-cm-missing-key", + "namespace": "${TEST_NAMESPACE}" + }, + "data": { + "key": "value" + } + } + """ + When ClusterObjectSet is applied + """ + apiVersion: olm.operatorframework.io/v1 + kind: ClusterObjectSet + metadata: + name: ${COS_NAME} + spec: + group: ${NAME} + lifecycleState: Active + collisionProtection: Prevent + phases: + - name: resources + objects: + - ref: + name: ${COS_NAME}-missing-key-secret + namespace: ${TEST_NAMESPACE} + key: does-not-exist + revision: 1 + """ + Then ClusterObjectSet "${COS_NAME}" reports Ready as False with Reason PreconditionsNotMet and Message: + """ + Referenced content is invalid: resolving ref in phase "resources": key "does-not-exist" not found in Secret ${TEST_NAMESPACE}/${COS_NAME}-missing-key-secret. Fix the Secret content. + """ + + Scenario: ClusterObjectSet reports PreconditionsNotMet when a referenced Secret has malformed content + Given namespace "${TEST_NAMESPACE}" is available + And resource is applied + """ + apiVersion: v1 + kind: Secret + metadata: + name: ${COS_NAME}-malformed-secret + namespace: ${TEST_NAMESPACE} + immutable: true + type: olm.operatorframework.io/object-data + stringData: + configmap: "this is not valid json" + """ + When ClusterObjectSet is applied + """ + apiVersion: olm.operatorframework.io/v1 + kind: ClusterObjectSet + metadata: + name: ${COS_NAME} + spec: + group: ${NAME} + lifecycleState: Active + collisionProtection: Prevent + phases: + - name: resources + objects: + - ref: + name: ${COS_NAME}-malformed-secret + namespace: ${TEST_NAMESPACE} + key: configmap + revision: 1 + """ + Then ClusterObjectSet "${COS_NAME}" reports Ready as False with Reason PreconditionsNotMet and Message includes: + """ + Referenced content is invalid: resolving ref in phase "resources": unmarshaling object from key "configmap" in Secret ${TEST_NAMESPACE}/${COS_NAME}-malformed-secret + """ + @ProgressDeadline Scenario: Archiving a COS with ProgressDeadlineExceeded cleans up its resources