Repository navigation
Full mutation coverage on send in the payjoin crate - #748
Conversation
b44cd2b to
18ae4e2
Compare
Pull Request Test Coverage Report for Build 15618943659Warning: 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 got a bit confused on the error comparison when working with the InternalBuilderSender error and the error comparison here. This is cleaner to just compare to an Err type and not an Option of the internal error.
18ae4e2 to
04b8a6d
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
|
||
| #[test] | ||
| fn test_build_recommended_multiple_inputs() -> Result<(), BoxError> { | ||
| let mut psbt = Psbt::from_str(MULTIPARTY_ORIGINAL_PSBT_ONE).unwrap(); |
There was a problem hiding this comment.
Why do we need to use the multiparty original psbt here?
There was a problem hiding this comment.
I found this to be a quick way to introduce an additional set of input_pairs for build_recommended to ensure that the for loop there runs at least once. I will go ahead and add some docstring comments to clarify these 2 tests.
| } | ||
|
|
||
| #[test] | ||
| fn test_build_recommended_modified_outputs() -> Result<(), BoxError> { |
There was a problem hiding this comment.
It may help to add some comments or a docstring that explains the purpose of these tests. For example, I can tell that this test takes the vector original PSBT and modifies output 0 and adds a new output (duplicated from output 1) so we now have 3 outputs, builds a Sender, and expects a success. Then it repeats, removing output 0 this time. But I don't have an intuition of what this proves and why?
test_build_recommended_fee_contribution is pretty self-explanatory. test_build_recommended_modified_outputs and test_build_recommended_multiple_inputs less so. I assume the reason they're there is they explicitly kill some mutants?
a04db96 to
3763460
Compare
bf2fe2e to
b22a918
Compare
This adds the tests to cover mutations for the send directory in its entirety.
With full mutation coverage we can now include the whole send directory in our mutants toml.
In payjoin#660 we added a process_get_res and process_post_res methods in ohttps to pull away some of the logic from our send module but multiparty remained the same. This PR attempts pull sync the multiparty sender error handling with this new approach. As well this change gets rid of the remaining mutant on this status code match block.
b22a918 to
2531308
Compare
spacebear21
left a comment
There was a problem hiding this comment.
tACK 2531308
Ran it locally and got:
❯ cargo mutants -j 2
Found 415 mutants to test
ok Unmutated baseline in 16.2s build + 19.6s test
INFO Auto-set test timeout to 1m 39s
TIMEOUT payjoin/src/receive/v1/mod.rs:641:74: replace -= with += in ProvisionalProposal::apply_fee in 2.0s build + 99.0s test
415 mutants tested in 17m 45s: 251 caught, 163 unviable, 1 timeouts
I get unreproducible timeouts on my machine for unknown reasons so that one is safe to ignore.
|
86% coverage and no mutants in all of send/receive!!! 🚀 |
This adds full mutation coverage for our sender. After this merges we will have full mutation coverage on send and receive! A nice step forward for adversarial tests!