split tests up into separate functions#183
Open
philippem wants to merge 4 commits intoBlockstream:new-indexfrom
Open
split tests up into separate functions#183philippem wants to merge 4 commits intoBlockstream:new-indexfrom
philippem wants to merge 4 commits intoBlockstream:new-indexfrom
Conversation
|
ACK d3e629f Tested on regtest |
rpc_threads.install() was wrapping the lazy iterator *construction* in requests_iter(), but parallel work only executes when the iterator is consumed (.collect()). By the time collect() ran in requests(), the install scope had ended and Rayon dispatched onto the global pool. Move install() to wrap the collect() call in requests() (and the equivalent in get_transactions()), so the actual parallel work — and the per-thread DAEMON_INSTANCE TCP connections — run on the dedicated rpc_threads pool as intended. NOTE: this fix is required for parallel integration tests to work correctly. Without it, concurrent tests share global-pool threads whose DAEMON_INSTANCE thread-locals were initialised by a different test's daemon, causing cross-test RPC connection pollution.
d3e629f to
977047c
Compare
tests/rest.rs
Outdated
|
|
||
| // Verify status on the TransactionValue itself | ||
| assert_eq!(res["status"]["confirmed"].as_bool(), Some(true)); | ||
| assert_eq!(res["status"]["block_height"].as_u64(), Some(102)); |
There was a problem hiding this comment.
If test setup changes these hardcoded heights could break.. could maybe call get_block_count() like the reorg test does:
let init_height = tester.node_client().get_block_count()?;
RCasatta
previously approved these changes
Feb 20, 2026
tests/common.rs
Outdated
| loop { | ||
| let socket = net::TcpListener::bind("127.0.0.1:0").unwrap(); | ||
| let addr = socket.local_addr().unwrap(); | ||
| if USED_PORTS.lock().unwrap().insert(addr.port()) { |
Collaborator
There was a problem hiding this comment.
lock should be taken before the socket binding to really avoid race conditions
Collaborator
Author
There was a problem hiding this comment.
addressed in amended commit
- Use TcpListener instead of UdpSocket for port allocation to avoid races between parallel test instances; track allocated ports in a process-wide HashSet to prevent reuse within the same test run - Poll the REST and Electrum servers until they accept connections before returning, eliminating timing-dependent startup
Break test_rest() into individual test functions, each covering a specific REST endpoint, with assertions on concrete field values rather than just shape checks.
Break test_electrum() into individual test functions (balance, history, payment, raw), each covering a specific scenario, and extract shared setup into a WalletTester struct.
fa8fd04 to
19ab74c
Compare
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.
Uh oh!
There was an error while loading. Please reload this page.