Skip to content

HYPERFLEET-859 - docs: design E2E test cases for Update and Delete lifecycle#71

Open
tzhou5 wants to merge 2 commits intoopenshift-hyperfleet:mainfrom
tzhou5:HYPERFLEET-859
Open

HYPERFLEET-859 - docs: design E2E test cases for Update and Delete lifecycle#71
tzhou5 wants to merge 2 commits intoopenshift-hyperfleet:mainfrom
tzhou5:HYPERFLEET-859

Conversation

@tzhou5
Copy link
Copy Markdown
Contributor

@tzhou5 tzhou5 commented Apr 8, 2026

Summary

  • Extend cluster TC1 (Basic Workflow) to full lifecycle: Create → Update → Delete

  • Extend cluster TC2 (K8s Resources Check) with deletion cleanup verification

  • Add 13 new cluster test cases for Update/Delete workflows (Tier0: 4, Tier1: 9)

  • Add 2 nodepool smoke tests for UPDATE and DELETE happy paths

  • Test cases based on HYPERFLEET-560 DDR (adapter deletion flow design)

  • HYPERFLEET-859

Test Plan

  • Unit tests added/updated
  • make test-all passes
  • make lint passes
  • Helm chart changes validated with make test-helm (if applicable)
  • Deployed to a development cluster and verified (if Helm/config changes)
  • E2E tests passed (if cross-component or major changes)

Summary by CodeRabbit

  • Tests
    • Expanded end-to-end lifecycle tests for clusters and nodepools covering create, update (generation/observed_generation), delete (pending-deletion, finalized cleanup, hard-delete) and cleanup flows.
    • Added an AfterEach fallback for incomplete deletions, updated test metadata/status values, timestamps, and Table of Contents labels.
    • Improved validation of adapter-reported states and resource removal checks.

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 8, 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 rh-amarin 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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

Walkthrough

Updated test specifications expand cluster and nodepool end-to-end lifecycle tests. Cluster tests now validate create → PATCH update → DELETE flows: assert Reconciled=True on create, verify generation increments and adapters’ observed_generation after PATCH, exercise DELETE through pending-deletion (deleted_at set, Reconciled=False) to adapter cleanup (Finalized=True with Applied/Available=False), and confirm hard deletion (HTTP 404) plus removal of adapter status. Nodepool gains UPDATE and DELETE happy-path tests exercising similar reconcile, generation/observed_generation, adapter finalization, and hard-delete verification. TOC labels, test metadata, timestamps, and a fallback AfterEach cleanup were also adjusted.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Client as Client
participant API as API Server
participant Adapter as Adapter
participant K8s as Kubernetes
Client->>API: POST cluster/nodepool (create)
API->>Adapter: notify create
Adapter->>API: status: Reconciled=True
API->>Client: 201 + Reconciled=True
Client->>API: PATCH (update)
API->>Adapter: notify update (generation++ -> 2)
Adapter->>API: status: observed_generation=2
API->>Client: 200 + Reconciled=True
Client->>API: DELETE resource
API->>Adapter: notify delete (set deleted_at, generation++)
Adapter->>API: status: Finalized=True, Applied/Available=False
Adapter->>K8s: remove K8s resources
API->>Client: 202 (deletion pending)
Client->>API: GET resource (after finalization)
API->>Client: 404 Not Found; adapter status removed

mermaid
sequenceDiagram
participant Client as Client
participant API as API Server
participant Adapter as Adapter
participant Parent as Parent Cluster
Client->>API: POST nodepool
API->>Adapter: create nodepool
Adapter->>API: status: Reconciled=True
Client->>API: PATCH nodepool (generation++)
API->>Adapter: update nodepool
Adapter->>API: status: observed_generation=2, Reconciled=True
Client->>API: DELETE nodepool
API->>Adapter: mark deleted_at, generation++
Adapter->>API: status: Finalized=True; remove nodepool K8s resources
API->>Client: 202 then 404 after hard-delete
note right of Parent: Parent cluster remains Reconciled=True

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: designing E2E test cases for Update and Delete lifecycle scenarios, which aligns with the substantial additions to cluster.md and nodepool.md test documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test-design/testcases/cluster.md`:
- Around line 121-123: Replace the incorrect `Reconciled` condition references
in the three bullet lines with `Ready` so the documentation matches the actual
tests: change "Cluster `Reconciled` condition transitions..." to "Cluster
`Ready` condition transitions...", the final condition line to reference
`{"type": "Ready"}` alongside `{"type": "Available"}`, and the
observedGeneration validation to check Ready and Available instead of
Reconciled; this should align the markdown with the test implementation (see
creation.go) and other references to `Ready` and `Available`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8f9566e1-3f94-42c7-ada3-7d21eb0b1e2d

📥 Commits

Reviewing files that changed from the base of the PR and between 6b60cab and 43bfa16.

📒 Files selected for processing (2)
  • test-design/testcases/cluster.md
  • test-design/testcases/nodepool.md

Comment on lines +121 to +123
- Cluster `Reconciled` condition transitions from `status: False` to `status: True`
- Final cluster conditions have `status: True` for both condition `{"type": "Reconciled"}` and `{"type": "Available"}`
- Validate that the observedGeneration for the Reconciled and Available conditions is 1 for a new creation request
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Apr 8, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for condition name usage patterns across the codebase

echo "=== Checking API/model definitions for condition types ==="
rg -n --type=go -C3 '\b(Ready|Available|Reconciled)\b.*[Cc]ondition'

echo -e "\n=== Checking test implementations for condition assertions ==="
rg -n --type=go -C3 'condition.*type.*==.*"(Ready|Available|Reconciled)"'

echo -e "\n=== Checking OpenAPI/proto specs for condition definitions ==="
fd -e yaml -e proto -e json | xargs rg -l 'condition' | xargs rg -n -C3 '"(Ready|Available|Reconciled)"'

Repository: openshift-hyperfleet/hyperfleet-e2e

Length of output: 50391


Change lines 121-123 to reference Ready condition instead of Reconciled.

Lines 121-123 check for a Reconciled condition that does not exist in the API. The actual implementation (e2e/cluster/creation.go) validates Ready and Available conditions only. This is also inconsistent with earlier lines in the same file (79-80, 104, 115-118) which correctly reference Ready and Available. Update to match the actual system behavior:

- Cluster `Ready` condition transitions from `status: False` to `status: True`
- Final cluster conditions have `status: True` for both condition `{"type": "Ready"}` and `{"type": "Available"}`
- Validate that the observedGeneration for the Ready and Available conditions is 1 for a new creation request
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test-design/testcases/cluster.md` around lines 121 - 123, Replace the
incorrect `Reconciled` condition references in the three bullet lines with
`Ready` so the documentation matches the actual tests: change "Cluster
`Reconciled` condition transitions..." to "Cluster `Ready` condition
transitions...", the final condition line to reference `{"type": "Ready"}`
alongside `{"type": "Available"}`, and the observedGeneration validation to
check Ready and Available instead of Reconciled; this should align the markdown
with the test implementation (see creation.go) and other references to `Ready`
and `Available`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The Reconciled condition in Steps 4-8 is intentional. This test case was extended to cover the full Create → Update → Delete lifecycle (Post-MVP scope), which is based on the HYPERFLEET-560 DDR where Ready is replaced by Reconciled. Steps 1-3 retain the original Ready references as they reflect the current automated implementation. The new steps use Reconciled to align with the DDR design — the actual condition name will be confirmed when the implementation lands (HYPERFLEET-853).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@tzhou5, understood — thank you for the context. The intentional split makes sense: Steps 1–3 document the current Ready/Available behavior, while Steps 4–8 use Reconciled to align with the Post-MVP DDR design from HYPERFLEET-560, pending confirmation in HYPERFLEET-853. I'll disregard this comment.


📝 Learnings were identified and not saved (knowledge base disabled). Enable

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test-design/testcases/cluster.md`:
- Around line 193-196: The AfterEach cleanup text only mentions deleting the
namespace, which misses other artifacts and diverges from the implemented
multi-stage cleanup in CleanupTestCluster; update the AfterEach sections to
describe and invoke the same multi-stage cleanup contract used by
CleanupTestCluster (see pkg/helper/helper.go and its usage in
e2e/cluster/creation.go) so that helper-level cleanup removes Maestro resource
bundles and other non-namespace artifacts first and only falls back to `kubectl
delete namespace {cluster_id} --ignore-not-found` as the last-resort step.
- Around line 1436-1437: The Concurrent PATCH test's acceptance criteria are
inconsistent (description allows "succeed or reasonable conflict error" but
later requires all PATCH calls to succeed); update the test text and assertions
so they match: change acceptance to permit 2xx or 409 responses (no 5xx), and
replace the "all succeed" assertion with a convergence check that verifies the
final cluster state matches the latest generation/observed_generation; update
the narrative and the assertions in the Concurrent PATCH test block (references:
the Concurrent PATCH test description and the assertions currently forcing all
PATCH calls to succeed) so both the allowed response set and the final-state
verification are consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 19adff51-81cb-41ed-9455-f7074e2ddf82

📥 Commits

Reviewing files that changed from the base of the PR and between 43bfa16 and ab327da.

📒 Files selected for processing (1)
  • test-design/testcases/cluster.md

Comment on lines +193 to +196
- If the test fails before hard-delete completes, clean up remaining resources:
```bash
kubectl delete namespace {cluster_id} --ignore-not-found
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fallback cleanup is under-specified and risks leaked resources

Line 195/326/1223 currently documents namespace-only cleanup. That misses non-namespace artifacts (for example Maestro resource bundles) and diverges from the implemented cleanup flow (pkg/helper/helper.go:59-90, used in e2e/cluster/creation.go:387-396). Please update these AfterEach sections to use the same multi-stage cleanup contract as CleanupTestCluster, with namespace deletion as a last-resort fallback only.

As per coding guidelines, "**: -Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

Also applies to: 324-327, 1221-1224

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test-design/testcases/cluster.md` around lines 193 - 196, The AfterEach
cleanup text only mentions deleting the namespace, which misses other artifacts
and diverges from the implemented multi-stage cleanup in CleanupTestCluster;
update the AfterEach sections to describe and invoke the same multi-stage
cleanup contract used by CleanupTestCluster (see pkg/helper/helper.go and its
usage in e2e/cluster/creation.go) so that helper-level cleanup removes Maestro
resource bundles and other non-namespace artifacts first and only falls back to
`kubectl delete namespace {cluster_id} --ignore-not-found` as the last-resort
step.

Comment on lines +1436 to +1437
This test validates that the system handles concurrent PATCH requests to the same cluster without errors or inconsistent state. Multiple simultaneous updates should each succeed or return a reasonable conflict error, and the final state should be consistent with the latest generation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Concurrent PATCH acceptance criteria are contradictory

The description allows “succeed or reasonable conflict error,” but Line 1469 requires all PATCH calls to succeed. Please make expected results consistent (e.g., accept 2xx/409 with no 5xx, and assert final state convergence by generation/observed_generation).

As per coding guidelines, "**: -Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

Also applies to: 1469-1471

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test-design/testcases/cluster.md` around lines 1436 - 1437, The Concurrent
PATCH test's acceptance criteria are inconsistent (description allows "succeed
or reasonable conflict error" but later requires all PATCH calls to succeed);
update the test text and assertions so they match: change acceptance to permit
2xx or 409 responses (no 5xx), and replace the "all succeed" assertion with a
convergence check that verifies the final cluster state matches the latest
generation/observed_generation; update the narrative and the assertions in the
Concurrent PATCH test block (references: the Concurrent PATCH test description
and the assertions currently forcing all PATCH calls to succeed) so both the
allowed response set and the final-state verification are consistent.

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.

1 participant