Skip to content

HYPERFLEET-861 - feat: add Tier 1 E2E tests for update and delete lifeecycle#91

Open
kuudori wants to merge 3 commits intoopenshift-hyperfleet:mainfrom
kuudori:HYPERFLEET-861
Open

HYPERFLEET-861 - feat: add Tier 1 E2E tests for update and delete lifeecycle#91
kuudori wants to merge 3 commits intoopenshift-hyperfleet:mainfrom
kuudori:HYPERFLEET-861

Conversation

@kuudori
Copy link
Copy Markdown
Contributor

@kuudori kuudori commented May 6, 2026

Summary

Implement 16 Tier 1 test cases covering edge cases and error scenarios
beyond the critical path for cluster and nodepool update/delete lifecycle.

  • Add cluster delete edge cases: re-DELETE idempotency, create-nodepool-under-deleted-409, DELETE-non-existent-404, concurrent DELETEs, DELETE-during-update, recreate-after-hard-delete
  • Add cluster delete visibility tests with sentinel fence: soft-deleted cluster visible via GET/LIST, LIST shows active and soft-deleted clusters simultaneously
  • Add cluster external K8s deletion test: adapters treat externally-deleted resources as finalized
  • Add cluster update edge cases: rapid update coalescing, labels-only PATCH triggers reconciliation, no-op PATCH does not increment generation
  • Add nodepool delete edge cases: sibling isolation during deletion, re-DELETE idempotency, DELETE-non-existent-404
  • Add nodepool delete visibility test with sentinel fence
  • Add nodepool labels-only PATCH triggers reconciliation
  • Add sentinel deployment name constants to pkg/helper/constants.go

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

Release Notes

  • New Features

    • Added PATCH operations for clusters and nodepools to enable partial updates.
    • Implemented functional cluster and nodepool deletion with soft-delete returning 202 status.
    • Added Finalized condition type for adapter status tracking.
    • Introduced HTTPError type for standardized API error handling.
  • Bug Fixes

    • Enhanced deletion-aware adapter lifecycle management with proper cleanup sequencing.
  • Tests

    • Added comprehensive test coverage for cluster and nodepool deletion, update, and edge-case scenarios.

kuudori added 3 commits May 5, 2026 13:36
…ecycle

Implement 16 Tier 1 test cases covering edge cases and error scenarios
beyond the critical path for cluster and nodepool update/delete lifecycle.

- Add cluster delete edge cases: re-DELETE idempotency, create-nodepool-under-deleted-409, DELETE-non-existent-404, concurrent DELETEs, DELETE-during-update, recreate-after-hard-delete
- Add cluster delete visibility tests with sentinel fence: soft-deleted cluster visible via GET/LIST, LIST shows active and soft-deleted clusters simultaneously
- Add cluster external K8s deletion test: adapters treat externally-deleted resources as finalized
- Add cluster update edge cases: rapid update coalescing, labels-only PATCH triggers reconciliation, no-op PATCH does not increment generation
- Add nodepool delete edge cases: sibling isolation during deletion, re-DELETE idempotency, DELETE-non-existent-404
- Add nodepool delete visibility test with sentinel fence
- Add nodepool labels-only PATCH triggers reconciliation
- Add sentinel deployment name constants to pkg/helper/constants.go
@openshift-ci openshift-ci Bot requested review from Mischulee and pnguyen44 May 6, 2026 17:55
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 6, 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 mbrudnoy 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 May 6, 2026

Caution

Review failed

Failed to post review comments

Walkthrough

This pull request implements a comprehensive architectural shift toward poller-based asynchronous testing patterns and enhanced deletion semantics across the HyperFleet platform. The changes span documentation updates, end-to-end test suite expansion, client API enhancements, helper utilities, adapter configurations, and test data. Documentation (CLAUDE.md, architecture.md, development.md) now emphasizes pollers with custom matchers for Eventually-based assertions instead of direct wait helpers. The client library (pkg/client) gains functional delete and patch operations with revised signatures (DeleteCluster now returns a cluster object and HTTP 202). New helper utilities introduce pollers.go and matchers.go to support async polling and Gomega-based assertions. The test suite expands with 11+ new end-to-end test files covering cluster and nodepool lifecycle operations (create, delete, update, edge cases, visibility, and external resource interactions). All adapter configurations incorporate deletion-awareness via is_deleting preconditions, lifecycle.delete blocks, and enhanced Finalized status logic. Test design metadata is updated to mark scenarios as automated.

Sequence Diagram(s)

sequenceDiagram
    participant Test
    participant Helper
    participant API Client
    participant OpenAPI Server
    participant Kubernetes
    participant Adapter

    Test->>Helper: PollCluster(ctx, clusterID)
    Helper-->>Test: returns closure func() (*Cluster, error)
    
    Test->>Test: Eventually(poll_func, timeout)
    activate Test
        Test->>Helper: invoke poll closure
        Helper->>API Client: GetCluster(ctx, clusterID)
        API Client->>OpenAPI Server: GET /clusters/{id}
        OpenAPI Server-->>API Client: 200 OK {Cluster}
        API Client-->>Helper: *Cluster
        Helper-->>Test: *Cluster
        Test->>Test: HaveResourceCondition("Reconciled", True)
        break if not yet reconciled
            Test->>Test: wait & retry
        end
    deactivate Test
    
    Test->>Test: assertion passes
Loading
sequenceDiagram
    participant Test
    participant Helper
    participant API Client
    participant OpenAPI Server
    participant Kubernetes Adapter

    Test->>Helper: h.CreateCluster(ctx, payload)
    Helper->>API Client: CreateCluster(ctx, req)
    API Client->>OpenAPI Server: POST /clusters {spec}
    OpenAPI Server-->>API Client: 201 Created {Cluster, generation=1}
    API Client-->>Helper: *Cluster
    Helper-->>Test: *Cluster
    
    Test->>Test: Eventually(PollCluster(...))
    Test->>Helper: PollClusterAdapterStatuses(ctx, clusterID)
    Helper-->>Test: closure
    Test->>Test: invoke closure → adapters reconcile
    
    Test->>Helper: h.PatchCluster(ctx, clusterID, patchReq)
    Helper->>API Client: PatchCluster(ctx, clusterID, req)
    API Client->>OpenAPI Server: PATCH /clusters/{id} {spec}
    OpenAPI Server-->>API Client: 200 OK {Cluster, generation=2}
    API Client-->>Helper: *Cluster
    
    Test->>Test: Eventually(PollClusterAdapterStatuses(...))
    Test->>Test: HaveAllAdaptersAtGeneration([...], 2)
    activate Kubernetes Adapter
        Kubernetes Adapter->>Kubernetes Adapter: reconcile at generation 2
        Kubernetes Adapter-->>OpenAPI Server: update status (ObservedGeneration=2)
    deactivate Kubernetes Adapter
    
    Test->>Test: assertion passes
Loading
sequenceDiagram
    participant Test
    participant Helper
    participant API Client
    participant OpenAPI Server

    Test->>Helper: h.DeleteCluster(ctx, clusterID)
    Helper->>API Client: DeleteCluster(ctx, clusterID)
    API Client->>OpenAPI Server: DELETE /clusters/{id}
    OpenAPI Server-->>API Client: 202 Accepted {Cluster, deleted_time=T}
    API Client-->>Helper: *Cluster (soft-deleted)
    Helper-->>Test: *Cluster
    
    Test->>Test: Eventually(PollClusterHTTPStatus(...))
    activate Test
        Test->>Helper: invoke HTTP status poller
        loop until 404
            Helper->>API Client: GetCluster(ctx, clusterID)
            API Client->>OpenAPI Server: GET /clusters/{id}
            break when hard-deleted
                OpenAPI Server-->>API Client: 404 Not Found
            end
        end
    deactivate Test
    
    Test->>Test: assertion: HTTP status == 404
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding Tier 1 E2E tests for update and delete lifecycle scenarios. It's specific about the test coverage area and aligns with the extensive test additions across cluster and nodepool files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

reason:
expression: |
adapter.?errorReason.orValue("") != "" ? adapter.?errorReason.orValue("") : "Healthy"
!is_deleting ? ""
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.

Running the tests locally was giving me errors about expression and reason being blank.
Can we add some dummy text for when is not yet finalizing?

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 7, 2026

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants