test: add offline wallet smoke tests#974
Conversation
ItoroD
left a comment
There was a problem hiding this comment.
Thanks for the test! We have also being leaning more towards adding some tests on the bindings side which are a little more comprehensive. See example here. The addition of a regtest setup into our CI for the various bindings also allows us simulate some "live" test. Currently we have that for bdk-jvm and android, hopefully others will have have that too. Here is an issue we previously had just for context.
bdk-ffi/src/tests/wallet.rs
Outdated
|
|
||
| #[test] | ||
| fn test_single_descriptor_wallet_external_and_internal_peek_match() { | ||
| let wallet = build_single_descriptor_wallet(); |
There was a problem hiding this comment.
Hi @j-kon! Thanks for the test.
Since you are doing a create_single here maybe we do not want to use a second KeychainKind for comparison. See doc for create_single.
bdk-ffi/src/tests/wallet.rs
Outdated
| } | ||
|
|
||
| #[test] | ||
| fn test_reveal_next_address_offline() { |
There was a problem hiding this comment.
Small nit:
Maybe we drop the offline suffix from some of the function names?
|
@j-kon will also be good if you could check the checklist in PR description. And a signed commit as well |
|
Thanks for the detailed feedback, really helpful. I see your point about Also makes sense on leaning toward bindings-side tests. I’ll review the bdk-jvm example you shared and align with that direction. I’ll clean up the naming, checklist, and signed commit as well. |
|
Thanks for the feedback. I updated the wallet tests to align more closely with the direction you suggested. Changes made:
Verification:
The PR now includes these updates. |
ItoroD
left a comment
There was a problem hiding this comment.
Thanks for the updates. For completeness I think there is another create method for wallet create_from_two_path_descriptor maybe we can add that too. Also, I think your commit is still not signed.
bdk-ffi/src/tests/wallet.rs
Outdated
| assert_eq!(address_info.index, 0); | ||
| assert_eq!(address_info.keychain, KeychainKind::External); | ||
| assert_eq!(address_info.address.to_string(), EXPECTED_FIRST_ADDRESS); | ||
| assert_eq!(wallet.derivation_index(KeychainKind::External), Some(0)); |
There was a problem hiding this comment.
Maybe the asserts should only have to do with address_info? I think line 52 to 54 are good for this test. line 55 and 56 already show up in the other 2 tests its best to leave them out of here IMO
There was a problem hiding this comment.
@j-kon I believe the lines I mentioned here were in test_reveal_next_address not create_single test. You seem to have changed create_single instead.
|
Thanks for the follow-up. I pushed another small update to keep the Verification:
Scope is still limited to |
|
I force-pushed a signed commit for the latest change set, and GitHub is now recognizing the current PR head commit as verified. |
Cool. Maybe you could also squash your commits. Typically, commit messages do not contain the details of requested changes by the reviewer. You want the commit message describing what you are adding just like the message of your first commit. You might find it easier amending your first commit and doing a force push when reviews require you to make a change, instead of sending different commits with the different changes. |
Thanks, that makes sense. I understand. I’ll squash the PR history down to a single signed commit and keep the commit message focused on the actual addition rather than the review iterations. |
|
Thanks, I squashed the PR down to a single signed commit and kept the commit message focused on the actual change:
|
|
@j-kon FYI I will look at this today. Sorry for the delay |
|
Thanks for catching that you were right, I had applied that change to the wrong test. I’ve updated it so I force-pushed the update, and the PR is still a single signed commit. |
Description
Add small Rust-side wallet smoke tests covering realistic wallet usage flows.
The tests focus on:
create_singlebehaviorNotes to the reviewers
I updated the original wallet tests based on review feedback:
create_singleexternal/internal keychain comparison_offlinesuffix from test namesScope is limited to Rust wallet tests.
Documentation
bdk_walletWalletbitcoinuniffibdk-ffiWallet::create_singledocsbdk-jvmbindings-style test examplebdk-ffiissue: rethinking our test suiteChecklists
All Submissions:
cargo fmtandcargo clippybefore committingNew Features:
Bugfixes:
cc @thunderbiscuit and @reez