openshift / openshift/rosa

Add a focused Destroy() test for skipped prepared-resource cleanup after uninstall failure

Open
#3,434 0 comments 0 reactions 1 assignee View on GitHub

@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.go
  • tests/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

  1. Introduce a minimal, idiomatic test seam that permits controlling the cluster-destroy result and observing prepared-resource cleanup.
  2. Add a focused Ginkgo/Gomega test that invokes Destroy() with a simulated uninstall failure where clusterRemoved=false.
  3. Assert that DestroyResources() is not invoked while the destroy error is still surfaced.
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.