Skip to content

🌱 Add e2e test for direct ClusterObjectSet creation with Secret-stored objects#2624

Open
pedjak wants to merge 1 commit intooperator-framework:mainfrom
pedjak:e2e-cos-ref-objects
Open

🌱 Add e2e test for direct ClusterObjectSet creation with Secret-stored objects#2624
pedjak wants to merge 1 commit intooperator-framework:mainfrom
pedjak:e2e-cos-ref-objects

Conversation

@pedjak
Copy link
Copy Markdown
Contributor

@pedjak pedjak commented Apr 1, 2026

Description

Adds an e2e scenario to revision.feature verifying that users can directly create a ClusterObjectSet with phase objects externalized to Secrets via ref, rather than inline object entries.

Previously, revision.feature only tested inline objects, and the Secret externalization test in install.feature only covered the ClusterExtension path. This fills that gap.

Changes

  • ✅ New scenario: "User can install a ClusterObjectSet with objects stored in Secrets"
    • Creates an immutable Secret with a ConfigMap and a busybox httpd Deployment as stringData entries
    • Creates a ClusterObjectSet referencing those objects via ref
    • Asserts successful rollout and resource creation
  • 🔧 ResourceIsApplied now tracks non-CE/COS resources in addedResources for cleanup
  • 🔧 ScenarioCleanup supports namespace-aware resource deletion

Test plan

  • make lint passes
  • make test-e2e passes (46 scenarios, 45 passed, 1 pre-existing undefined in user-managed-fields.feature)

🤖 Generated with Claude Code

…d objects

Adds a scenario verifying that users can create a ClusterObjectSet with
phase objects externalized to Secrets via ref, rather than inline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 1, 2026 16:38
@openshift-ci openshift-ci bot requested review from fgiudici and grokspawn April 1, 2026 16:38
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 1, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign camilamacedo86 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 1, 2026

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 4b980cb
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/69cd4a18b894820008b2f969
😎 Deploy Preview https://deploy-preview-2624--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an e2e scenario to validate direct ClusterObjectSet creation where phase objects are externalized in a Secret via ref, and improves e2e cleanup to handle additional (non-CE/COS) resources and namespaced deletions.

Changes:

  • Add revision.feature scenario for ClusterObjectSet referencing Secret-stored objects via ref.
  • Track additional applied resources for cleanup in ResourceIsApplied.
  • Extend cleanup deletion to include -n <namespace> when applicable.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
test/e2e/steps/steps.go Tracks non-CE/COS applied resources (incl. namespace) for cleanup.
test/e2e/steps/hooks.go Adds namespace field to tracked resources and uses it when deleting.
test/e2e/features/revision.feature Adds new e2e scenario for COS creation via Secret ref objects.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

args = append(args, "-n", res.namespace)
}
if _, err := k8sClient(args...); err != nil {
logger.Info("Error deleting resource", "name", res.name, "namespace", sc.namespace, "stderr", stderrOutput(err))
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log field namespace uses sc.namespace, but the deletion is performed with res.namespace (and some resources may be cluster-scoped / other namespaces). This makes failure logs misleading. Log res.namespace (and optionally also log sc.namespace under a different key if you need scenario context).

Suggested change
logger.Info("Error deleting resource", "name", res.name, "namespace", sc.namespace, "stderr", stderrOutput(err))
logger.Info("Error deleting resource", "name", res.name, "namespace", res.namespace, "scenarioNamespace", sc.namespace, "stderr", stderrOutput(err))

Copilot uses AI. Check for mistakes.
Comment on lines +314 to +317
sc.addedResources = append(sc.addedResources, resource{
name: res.GetName(),
kind: strings.ToLower(res.GetKind()),
namespace: res.GetNamespace(),
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For namespaced resources applied without an explicit metadata.namespace in the YAML, res.GetNamespace() will be empty (because this is parsed from the manifest). With the new cleanup logic, those resources would be deleted without -n, likely leaving them behind. Consider defaulting namespace to the scenario/test namespace when res.GetNamespace() is empty (at least for this e2e harness), so cleanup reliably targets the namespace resources were applied into.

Suggested change
sc.addedResources = append(sc.addedResources, resource{
name: res.GetName(),
kind: strings.ToLower(res.GetKind()),
namespace: res.GetNamespace(),
namespace := res.GetNamespace()
if namespace == "" {
namespace = sc.namespace
}
sc.addedResources = append(sc.addedResources, resource{
name: res.GetName(),
kind: strings.ToLower(res.GetKind()),
namespace: namespace,

Copilot uses AI. Check for mistakes.
Comment on lines 198 to 206
go func(res resource) {
if _, err := k8sClient("delete", res.kind, res.name, "--ignore-not-found=true"); err != nil {
args := []string{"delete", res.kind, res.name, "--ignore-not-found=true"}
if res.namespace != "" {
args = append(args, "-n", res.namespace)
}
if _, err := k8sClient(args...); err != nil {
logger.Info("Error deleting resource", "name", res.name, "namespace", sc.namespace, "stderr", stderrOutput(err))
}
}(r)
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleanup deletes all resources concurrently. With the PR tracking more resources, it becomes more likely that namespace deletion races with deletions of namespaced resources, creating intermittent cleanup failures/noise. Consider deleting in a deterministic order (e.g., delete tracked resources first, then delete the namespace last) and/or avoiding goroutines here so the namespace isn’t removed while other deletes are still in-flight.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants