Add a focused Destroy() test for skipped prepared-resource cleanup after uninstall failure
@amandahla is already working on this.
Since Jul 29, 2026.
- Dominant language
- Go
- Stars
- 103
- Forks
- 257
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 43
Description
Summary
Add a focused unit-test seam for the cluster handler so tests can verify the Destroy() side effect: prepared-resource cleanup must not run when cluster uninstall fails and the cluster remains.
Rationale
The current helper-level tests in tests/utils/handler/cluster_handler_test.go verify the cleanup gate's boolean behavior, but they do not prove that clusterHandler.Destroy() avoids calling DestroyResources() when destroyCluster() reports clusterRemoved=false. The existing package has no suitable mocks/doubles for these collaborators, so this work was deferred from the fail-fast destroy change.
Affected areas
tests/utils/handler/cluster_handler.gotests/utils/handler/cluster_handler_test.go- Any minimal test-only seam, interface, or fake needed to control destroy and prepared-resource cleanup behavior
Required changes
- Introduce a minimal, idiomatic test seam that permits controlling the cluster-destroy result and observing prepared-resource cleanup.
- Add a focused Ginkgo/Gomega test that invokes
Destroy()with a simulated uninstall failure whereclusterRemoved=false. - Assert that
DestroyResources()is not invoked while the destroy error is still surfaced. - Keep production behavior and the test harness scope minimal.
Acceptance criteria
- The test fails if
Destroy()calls prepared-resource cleanup after a failed/uncompleted uninstall. - The test confirms the original destroy failure is preserved.
- Existing cleanup behavior remains covered when the cluster is removed.
Requested by: @amandahla
Related PR: https://github.com/openshift/rosa/pull/3433
Related review comment: https://github.com/openshift/rosa/pull/3433#discussion_r3674406231
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.