Skip to content

🌱 Align ClusterObjectSet e2e cleanup with addedResources pattern#2799

Open
perdasilva wants to merge 1 commit into
operator-framework:mainfrom
perdasilva:e2e-cos-cleanup-alignment
Open

🌱 Align ClusterObjectSet e2e cleanup with addedResources pattern#2799
perdasilva wants to merge 1 commit into
operator-framework:mainfrom
perdasilva:e2e-cos-cleanup-alignment

Conversation

@perdasilva

Copy link
Copy Markdown
Contributor

Summary

  • Follow-up to 🌱 Add e2e regression test for cross-CE collision protection #2783 — applies the same addedResources-based cleanup pattern to ClusterObjectSets in the e2e test harness
  • ResourceIsApplied now appends ClusterObjectSets to addedResources (alongside setting clusterObjectSetName for ${COS_NAME} substitution)
  • Removes the special-case clusterObjectSetName cleanup block from ScenarioCleanup, so multiple ClusterObjectSets per scenario are all cleaned up correctly

Test plan

  • Verify e2e tests compile (go build ./test/e2e/...)
  • Run BoxcutterRuntime e2e scenarios that create ClusterObjectSets and confirm cleanup succeeds
  • Verify no leaked ClusterObjectSets remain after scenario completion

🤖 Generated with Claude Code

Track ClusterObjectSets in addedResources when applied, matching
the pattern established for ClusterExtensions in operator-framework#2783. This removes
the special-case cleanup block in ScenarioCleanup and ensures multiple
ClusterObjectSets per scenario are all cleaned up correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 2, 2026 09:39
@netlify

netlify Bot commented Jul 2, 2026

Copy link
Copy Markdown

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit bc8c575
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/6a4631b75f63230008d2141d
😎 Deploy Preview https://deploy-preview-2799--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@openshift-ci openshift-ci Bot requested review from OchiengEd and pedjak July 2, 2026 09:39
@openshift-ci

openshift-ci Bot commented Jul 2, 2026

Copy link
Copy Markdown

[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 perdasilva 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the e2e test harness cleanup flow so ClusterObjectSet resources follow the same addedResources-based tracking/cleanup pattern already used for ClusterExtension, ensuring scenarios that create multiple ClusterObjectSets reliably delete all of them during ScenarioCleanup.

Changes:

  • Track applied ClusterObjectSet resources in sc.addedResources within ResourceIsApplied.
  • Remove the legacy/special-case clusterObjectSetName-based cleanup append in ScenarioCleanup, relying on addedResources instead.

Reviewed changes

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

File Description
test/e2e/steps/steps.go Adds ClusterObjectSet to addedResources when applied so cleanup can delete all COS created in a scenario.
test/e2e/steps/hooks.go Removes the special-case COS cleanup block, consolidating deletion behavior around addedResources.

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

@pedjak pedjak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Improve PR title and description for clarity

The current title describes the mechanism ("addedResources pattern") but not the problem being solved. Reviewers who haven't read #2783 won't know why alignment matters.

Suggested title:

🌱 Fix e2e cleanup to handle multiple ClusterObjectSets per scenario

Suggested description:

Follow-up to #2783, which consolidated ClusterExtension cleanup into addedResources
but left ClusterObjectSets on the legacy single-field path.

The old cleanup tracked only sc.clusterObjectSetName — a scalar that gets overwritten
on each apply. Scenarios that create multiple ClusterObjectSets would only clean up the
last one, leaking the rest. This PR applies the same fix #2783 used for ClusterExtensions:
append each applied COS to addedResources at apply time and drop the special-case
cleanup block.

What changed:

  • ResourceIsApplied now appends every ClusterObjectSet to addedResources
    (the clusterObjectSetName field is still set for ${COS_NAME} substitution)
  • ScenarioCleanup drops the single-COS cleanup block — addedResources handles it

Comment thread test/e2e/steps/steps.go
sc.addedResources = append(sc.addedResources, resource{name: res.GetName(), kind: "clusterextension"})
} else if res.GetKind() == "ClusterObjectSet" {
sc.clusterObjectSetName = res.GetName()
sc.addedResources = append(sc.addedResources, resource{name: res.GetName(), kind: "clusterobjectset"})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nitpick (non-blocking): clusterObjectSetName is still assigned here but cleanup has moved to addedResources. A short inline comment noting this field now only serves ${COS_NAME} substitution would help future readers understand why it is still set.

@pedjak

pedjak commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

thought (non-blocking): If a scenario applies the same COS name twice (e.g., updating it), addedResources will have duplicate entries and cleanup will attempt two deletes. Harmless due to --ignore-not-found=true, but noting for awareness.

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants