HYPERFLEET-861 - feat: add Tier 1 E2E tests for update and delete lifeecycle#91
HYPERFLEET-861 - feat: add Tier 1 E2E tests for update and delete lifeecycle#91kuudori wants to merge 3 commits intoopenshift-hyperfleet:mainfrom
Conversation
…ters and nodepools
…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
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Caution Review failedFailed to post review comments WalkthroughThis 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
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
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| reason: | ||
| expression: | | ||
| adapter.?errorReason.orValue("") != "" ? adapter.?errorReason.orValue("") : "Healthy" | ||
| !is_deleting ? "" |
There was a problem hiding this comment.
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?
|
PR needs rebase. DetailsInstructions 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. |
Summary
Implement 16 Tier 1 test cases covering edge cases and error scenarios
beyond the critical path for cluster and nodepool update/delete lifecycle.
Test Plan
make test-allpassesmake lintpassesmake test-helm(if applicable)Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Tests