Skip to content

Commit 4f5ee42

Browse files
committed
feat(test): roll a custom TestEnv and drop lazy_static
Implement a custom `TestEnv`, which is instantiated per-test and fixes the un-dropped `bitcoind` issue. This also allows running tests with more than 1 thread, since they no longer share `bitcoind` and `electrsd` instances. Also adds helpers to fetch externally sourced addresses, fixing the issue where `bitcoind`'s wallet would send change outputs to it's own wallet address, which would mess with `test_get_scripthash_stats`. The `test` recipe and CI job are updated to now use 16 threads.
1 parent ebdbd9a commit 4f5ee42

File tree

4 files changed

+330
-343
lines changed

4 files changed

+330
-343
lines changed

.github/workflows/cont_integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Build
5454
run: cargo build --features ${{ matrix.features }} --no-default-features
5555
- name: Test
56-
run: cargo test --features ${{ matrix.features }} --no-default-features -- --test-threads=1
56+
run: cargo test --features ${{ matrix.features }} --no-default-features -- --test-threads=16
5757

5858
fmt:
5959
name: Rust Formatting

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ tokio = { version = "1", features = ["time"], optional = true }
3434
[dev-dependencies]
3535
tokio = { version = "1.20.1", features = ["full"] }
3636
electrsd = { version = "0.36.1", features = ["legacy", "esplora_a33e97e1", "corepc-node_29_0"] }
37-
lazy_static = "1.4.0"
3837

3938
[features]
4039
default = ["blocking", "async", "async-https", "tokio"]

justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ msrv:
3131
rm -rf Cargo.lock
3232
bash ci/pin-msrv.sh
3333
cargo +1.75.0 build --all-features
34-
cargo +1.75.0 test --all-features -- --test-threads=1
34+
cargo +1.75.0 test --all-features -- --test-threads=16
3535

3636
# Run pre-push suite: format, check, and test
3737
pre-push: fmt check test msrv
3838

3939
# Run all tests on the workspace with all features
4040
test:
41-
cargo test --all-features -- --test-threads=1
41+
cargo test --all-features -- --test-threads=16

0 commit comments

Comments
 (0)