HYPERFLEET-1178 - test: add negative conformance tests for v1 adapter contract#133
HYPERFLEET-1178 - test: add negative conformance tests for v1 adapter contract#133pnguyen44 wants to merge 3 commits into
Conversation
tests for v1 adapter contract
|
[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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
💤 Files with no reviewable changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds two new files to the repository. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Direct findings — no praise, no filler. CWE-754 (Improper Check for Unusual or Exceptional Conditions): The deferred cleanup only logs a failure ( Spec/implementation gap (HTTP 405 and HTTP 400 cases): Hardcoded string constant No assertion on cluster creation success before polling: 🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@e2e/adapter/conformance_negative.go`:
- Around line 39-41: The error returned by the CleanupTestCluster method is
being discarded in the DeferCleanup callbacks instead of being checked and
handled. Remove the underscore assignment that discards the error and instead
check the error result from h.CleanupTestCluster(ctx, clusterID). If an error
occurs during cleanup, handle it appropriately by logging it or failing the test
to prevent resource leaks and ensure cleanup failures are visible. This same
issue appears in three locations throughout the file where DeferCleanup is used
with CleanupTestCluster calls.
- Around line 17-20: The constant conformanceNegativeAdapter is hardcoded with
the literal value "conformance-test", which violates the coding guideline that
adapter names must come from runtime configuration. Remove the hardcoded
constant definition and replace all references to conformanceNegativeAdapter (at
lines 45-46 and 82-83 as well) with the actual runtime adapter names obtained
from h.Cfg.Adapters.Cluster or h.Cfg.Adapters.NodePool depending on the context
of use. This ensures the conformance tests validate against the correct adapter
names from the runtime configuration rather than a hardcoded literal.
🪄 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: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: a500fd06-a944-466f-ba7e-7c416869309c
📒 Files selected for processing (3)
e2e/adapter/conformance_negative.gopkg/client/cluster.gotest-design/testcases/adapter-conformance-negative.md
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
openshift-hyperfleet/architecture(manual)openshift-hyperfleet/hyperfleet-api(manual)openshift-hyperfleet/hyperfleet-sentinel(manual)openshift-hyperfleet/hyperfleet-adapter(manual)openshift-hyperfleet/hyperfleet-broker(manual)
name and improve cleanup logging in negative tests
|
/retest |
tests covered by API repo
Summary
HYPERFLEET-1178
Adds negative conformance tests that verify the v1.0.0 API correctly rejects pre-migration
adapter behavior. These tests ensure partner teams get clear, early failures when their
adapters still use the old v0.2.0 contract instead of silent, surprising breakage. This
covers the "conformance (negative)" acceptance criterion from the ticket.
Changes
missing mandatory conditions returns 400, and Ready condition is absent on reconciled
clusters
PostClusterStatusesclient method to send raw POST requests for negativestatus-code assertions
Test plan
make checkpasses cleanlymake test-allpassesmake lintpassesmake test-helm(if applicable)