Repository navigation
tests: dedup shared fixtures into test_utils::helpers (#907) - #954
Merged
Merged
Conversation
Move duplicated test fixtures to common::test_utils::helpers: binary_text,
body, handshake_frames, FARM_OK_MSG + farm_ok_frame_{42,unrouted},
execution_data_frame (wraps execution_data() builder), NoticeTestData,
CapturingSink, test_notice.
…mes (#907) - add handshake_response_frame; replace 13 hand-rolled handshake literals, full sequences in transport tests use handshake_frames - client tests: local default_handshake_frames wrapper; vec! literals - connection/client: TEST_ACCOUNT / TEST_ORDER_ID_SEED over literals - messages/tests: shorten helpers:: paths - doc CapturingSink::last/count
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 #907. Covers the issue body plus the items from @tradatious's comment.
Moved to
common::test_utils::helpers:binary_text(4 copies) andbody(2), withbodynow built onbinary_text; 2 hand-written frames inconnection/common_tests.rsswitched tobinary_texthandshake_response_frame(server_version, zone): replaces 13 hand-written handshake strings across client/connection/transport testshandshake_frames(server_version, zone, next_order_id): the client tests'handshake_frames()and the connection tests'push_handshake_in_zonenow share it.push_handshake*stay per file because sync and asyncMemoryStreamare different types.FARM_OK_MSG,farm_ok_frame_unrouted,farm_ok_frame_42execution_data_frame: replaces the hand-builtexecution_data_bodyproto with theexecution_data()builderNoticeTestData,CapturingSink(adds anotices()snapshot accessor)test_notice(code, msg): replaces 5 constructors (test_notice×3,make_notice,notice_with_code). It delegates toNotice::synthesizedbut keeps a separate name, so tests that use real TWS codes don't read like tests of client-generated notices.Not changed:
test_parse_raw_message_protobuf: its payload is raw proto bytes, not text, and the test checks the raw protobuf parse pathDeclaresTickPrice: each copy is paired with its ownstatic CALL_COUNTcounter inside the test. With--all-features, the sync and async tests run in parallel in one binary, so a shared counter would race.Test-only. Ran clippy
--all-targets -D warningsandcargo test --libfor default,--features syncand--all-features, pluscargo fmt --check.