test(ws): assert real data on /liquidation/feed live test#202
Merged
Conversation
backend now replays last N liquidations on connect (snap:true), so a fresh connection deterministically yields data — assert it like ticker, quiet window is a FAIL. Close #201.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #201
Summary
Adds a data-asserting live WS test for
liquidation_feed(/ws/v1/liquidation/feed) totests/test_ws_live.py, in the guaranteed-data group alongsideticker/premiumwhere a quiet window is a FAIL, not a pass. The channel had no live test before because a fresh connection wasn't guaranteed to yield data within a bounded window.Backend
Bisonai/datamaxi-backend#7990(PR #8338, merged976b264f5) now replays the last N liquidations immediately on connect (each replayed frame taggedsnap: true; live frames omit it viaomitempty). A fresh connection is therefore deterministic and assertable end-to-end.The channel is connect-only (no SUBSCRIBE, no params) — the test drives
ws.liquidation_feed.stream().Also closes #185 (which asked for any live-lane coverage of this channel; this delivers the hard data-assert directly).
Design notes
snap: trueon at least one of them, rather thanframe[0].snap. This couples the test to replay being enabled: withLIQUIDATION_FEED_REPLAY_N=0in the target env it FAILs rather than skips — deliberately, to catch an accidentally-disabled replay._REPLAY_TIMEOUT = 10.0is used (not_QUIET_TIMEOUT); a quiet window is a FAIL.e, d, s, b, q, sdpresent anddis a plausible UNIX-ms timestamp./liquidation/feedsits in the guaranteed-data (FAIL-on-quiet) group.Test plan
flake8+black --checkon the changed file: clean.pytest -m "not integration": 236 passed, 11 skipped, 116 deselected.https://api.datamaxiplus.com): the new test passes in ~1.3s, and the fulltests/test_ws_live.pyintegration set is 9 passed. Frames arrived carryingsnap: true, confirming replay-on-connect is live.Deploy gate: cleared
An earlier revision of this body warned against merging until a
data-apideploy carrying976b264f5was live. Verified on the wire: production returnssnap: truereplay frames on connect, so the gate no longer applies.