Repository navigation
π± add ClusterObjectSet pre-apply dry-run validation e2e scenarios #3027
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-bot
merged 1 commit into
operator-framework:main
from
perdasilva:cos-preflight-e2e
Oct 19, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| @BoxcutterRuntime | ||
| Feature: ClusterObjectSet preflight dry-run validation | ||
|
|
||
| As an OLM user applying a ClusterObjectSet directly, I want the revision to be | ||
| rejected with an actionable PreconditionsNotMet condition when one of its | ||
| objects would be rejected by the API server, and to recover automatically once | ||
| the underlying problem is resolved, so that transient or fixable issues do not | ||
| require re-creating the revision. | ||
|
|
||
| Background: | ||
| Given OLM is available | ||
|
|
||
| Scenario: ClusterObjectSet reports PreconditionsNotMet when an object targets a non-existent namespace | ||
| When ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: ${COS_NAME} | ||
| spec: | ||
| lifecycleState: Active | ||
| collisionProtection: Prevent | ||
| group: ${NAME} | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: cm-x | ||
| namespace: ${COS_NAME}-absent | ||
| data: | ||
| k: v | ||
| revision: 1 | ||
| """ | ||
| Then ClusterObjectSet "${COS_NAME}" reports Ready as False with Reason PreconditionsNotMet and Message includes: | ||
| """ | ||
| check rejected phase "resources": phase "resources": /v1, Kind=ConfigMap ${COS_NAME}-absent/cm-x: namespaces "${COS_NAME}-absent" not found. | ||
| """ | ||
|
|
||
| Scenario: ClusterObjectSet reports PreconditionsNotMet when an object has an invalid spec | ||
| Given namespace "${TEST_NAMESPACE}" is available | ||
| When ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: ${COS_NAME} | ||
| spec: | ||
| lifecycleState: Active | ||
| collisionProtection: Prevent | ||
| group: ${NAME} | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: bad-pod | ||
| namespace: ${TEST_NAMESPACE} | ||
| spec: | ||
| containers: [] | ||
| revision: 1 | ||
| """ | ||
| Then ClusterObjectSet "${COS_NAME}" reports Ready as False with Reason PreconditionsNotMet and Message includes: | ||
| """ | ||
| check rejected phase "resources": phase "resources": /v1, Kind=Pod ${TEST_NAMESPACE}/bad-pod: Pod "bad-pod" is invalid: spec.containers: Required value. | ||
| """ | ||
|
|
||
| Scenario: ClusterObjectSet recovers once a missing target namespace is created | ||
| When ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: ${COS_NAME} | ||
| spec: | ||
| lifecycleState: Active | ||
| collisionProtection: Prevent | ||
| group: ${NAME} | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: cm-x | ||
| namespace: ${COS_NAME}-recover | ||
| data: | ||
| k: v | ||
| revision: 1 | ||
| """ | ||
| Then ClusterObjectSet "${COS_NAME}" reports Ready as False with Reason PreconditionsNotMet and Message includes: | ||
| """ | ||
| check rejected phase "resources": phase "resources": /v1, Kind=ConfigMap ${COS_NAME}-recover/cm-x: namespaces "${COS_NAME}-recover" not found. | ||
| """ | ||
| When resource is applied | ||
| """ | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| name: ${COS_NAME}-recover | ||
| """ | ||
| And ClusterObjectSet "${COS_NAME}" reconciliation is triggered | ||
| Then ClusterObjectSet "${COS_NAME}" reports Ready as True with Reason AllObjectsReady | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we are explicitly triggering the reconciliation: we miss checking the controller to re-queue the reconciliation, that should happen in 10 seconds if everything works as expected.
Still it would mean this test will take 10 seconds every time... never mind, probably not worth it π