-
Notifications
You must be signed in to change notification settings - Fork 60
Add feature (parity) tests for API methods #10
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
Add feature (parity) tests for API methods #10
Conversation
Pull Request Test Coverage Report for Build 3068063421Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
I now covered all feasible API methods. Testing the feature parity of |
087559c
to
0624093
Compare
Squashed fixups. |
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.
Tested ACK.
Tests look good but I'd like to see if we can run the tests against a local regtest bitcoind and esplora rather than hitting the blockstream server URL. I'm going to give it a try using the |
@tnull, @vladimirfomene has the local regtest setup working in vladimirfomene@829b2fc, I'd like to get his changes in as a setup function that all the tests can share. Then can we put each of your tests in it's own test function ? I know each test will be very small but it's a good idea for unit tests to only test a single thing, it will make it easier to read and to see if a method call fails which one it is. |
Sounds good, will add the setup function and break the test code down into individual methods! |
@tnull, you can find the updated code here: https://github.com/vladimirfomene/rust-esplora-client/tree/add-testing |
@tnull, will it help if I refactor my code into a setup function and write a couple of test functions? |
Don't worry. I already started making the changes, will probably push an update in the next 1-2 days. |
Now split the tests and updated to run against local |
d5ac02f
to
4fdd176
Compare
Also added basic functionality testing of |
(needs rebase because #14 changed the CI) |
4fdd176
to
e390c20
Compare
src/lib.rs
Outdated
let bitcoind_exe = | ||
bitcoind::downloaded_exe_path().expect("bitcoind version feature must be enabled"); |
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.
Normally we read an env variable for the bitcoind/electrsd binaries and only if that's not set we try to use the embedded one. I personally use this on nixos because the binaries downloaded by the crate don't work right out of the box, and it's just easier to have my own bitcoind/electrsd and use them
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.
I think they are called BITCOIND_EXE
and ELECTRSD_EXE
in bdk
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.
Done in 37e2142
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.
I now adopted the somewhat inconsistent ELECTRS_EXE
naming from BDK (vs. ELECTRSD_EXE
) to make it more convenient.
Rebased on master, squashed commits, and added a minor clippy warning fix. |
1a90378
to
400676c
Compare
fa39cde
to
d1b5877
Compare
Wow, clippy can be a pain 😁 . But passes CI now, squashed the fixups. |
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.
Tested ACK
src/lib.rs
Outdated
.ok() | ||
.or_else(|| bitcoind::downloaded_exe_path().ok()) | ||
.expect( | ||
"you should provide env var BITCOIND_EXE or specifiy a bitcoind version feature", |
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.
nit, spelling typo
"you should provide env var BITCOIND_EXE or specifiy a bitcoind version feature", | |
"you should provide env var BITCOIND_EXE or specify a bitcoind version feature", |
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.
Ah, fixed and directly squashed the changes.
Btw., I blatantly copied these typos from https://github.com/bitcoindevkit/bdk/blob/c3faf05be9361eb8e0afa2c066448fd10fe30b58/src/testutils/blockchain_tests.rs#L329-L340
Not sure if it warrants a PR for BDK, but if someone is already editing that file, fixing them there also might make sense.
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.
ACK d1b5877
I commented on some small spelling typos, but everything else looks great to me.
If ok for everyone I'd like to get this published with Vlad on Mon or Tues so we can get a PR into |
d1b5877
to
ee8aee0
Compare
This PR adds basic feature (parity) tests for the API methods:
get_tx
get_tx_no_opt
get_tx_at_block_index
get_tx_status
get_header
get_merkle_proof
get_output_status
get_height
get_tip_hash
get_fee_estimates
scripthash_txs