-
Notifications
You must be signed in to change notification settings - Fork 0
test: add comprehensive HyperLiquid mock server integration tests #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Expand integration test coverage for HyperLiquid functionality using the hyperliquid-mock server. This adds 35+ new integration tests across 5 new test files, covering HTTP interactions, order lifecycles, and real-world scenarios. New test files: - hl/status_refresher_integration_test.go (6 tests) * Test StatusRefresher with real HTTP queries * Concurrent refresh, timeouts, fill tracker integration - hl/info_integration_test.go (7 tests) * Test Info client order queries * Various order states (filled, canceled, partial) * Order result conversion - hl/order_lifecycle_integration_test.go (11 tests) * Complete order lifecycles (create → fill → cancel) * Order modifications, IOC orders, reduce-only orders * Multiple concurrent orders with different states - filltracker/hyperliquid_integration_test.go (5 tests) * Position tracking with real HyperLiquid status updates * Partial fills, take profit management * Multi-order scenarios (base + safety orders) - emitter/modify_integration_test.go (6 tests) * Order modification functionality * Modify → fill/cancel workflows * Multiple sequential modifications Test coverage improvements: - StatusRefresher: unit tests → + HTTP integration tests - Info client: none → 7 integration tests - Order lifecycle: none → 11 integration tests - FillTracker: unit tests → + real status update tests - Emitter modify: none → 6 integration tests All tests use t.Parallel() for fast execution and follow established patterns for test isolation and cleanup. Documentation: HYPERLIQUID_INTEGRATION_TESTS.md provides comprehensive guide for running and understanding the test suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| package hl | ||
|
|
||
| import ( | ||
| "context" | ||
| "crypto/ecdsa" | ||
| "path/filepath" | ||
| "testing" | ||
| "time" | ||
|
|
||
| gethCrypto "github.com/ethereum/go-ethereum/crypto" | ||
| mockserver "github.com/recomma/hyperliquid-mock/server" | ||
| "github.com/recomma/recomma/orderid" | ||
| "github.com/recomma/recomma/storage" | ||
| "github.com/sonirico/go-hyperliquid" | ||
| "github.com/stretchr/testify/require" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Break import cycle by avoiding storage in hl tests
The new integration tests import storage directly from within package hl, which introduces the cycle hl → storage → internal/api → hl. Running go test ./hl fails to build (import cycle not allowed) before the tests even execute. Consider moving the tests to package hl_test and using the public API, or replacing the storage dependency with a lightweight stub that satisfies statusStore.
Useful? React with 👍 / 👎.
Move status_refresher_integration_test.go to package hl_test to avoid import cycle: hl → storage → internal/api → hl Changes: - Change package from 'hl' to 'hl_test' - Add explicit 'hl' import and use hl. prefix for exported functions - Storage can now be safely imported from external test package - Update documentation to note package structure This allows the integration tests to import both hl and storage without creating a circular dependency. Fixes build error: "import cycle not allowed"
|
@codex please fix the broken tests, it's using a non existing struct likely |
|
Summary
Testing
|
… into claude/investigate-multi-wallet-hyperliquid-011CUscCmD67KQZuFtsDSKxE
3c3c738
into
codex/investigate-multi-wallet-support-for-hyperliquid
Expand integration test coverage for HyperLiquid functionality using
the hyperliquid-mock server. This adds 35+ new integration tests across
5 new test files, covering HTTP interactions, order lifecycles, and
real-world scenarios.
New test files:
hl/status_refresher_integration_test.go (6 tests)
hl/info_integration_test.go (7 tests)
hl/order_lifecycle_integration_test.go (11 tests)
filltracker/hyperliquid_integration_test.go (5 tests)
emitter/modify_integration_test.go (6 tests)
Test coverage improvements:
All tests use t.Parallel() for fast execution and follow established
patterns for test isolation and cleanup.
Documentation: HYPERLIQUID_INTEGRATION_TESTS.md provides comprehensive
guide for running and understanding the test suite.