lightning
lightning copied to clipboard
Issue 5363 mkfunding unit tests
Issue https://github.com/ElementsProject/lightning/issues/5363 suggests that we create some sanity checking tests for the mkfunding devtool. In this draft pull request, I copied the parameters from the top of mkfunding.c and used them as input into three "unit tests".
A couple obvious problems so far:
- I mocked-out most of the interesting bitcoin/*.c functions that the devtool uses, just to get the three tests to pass; so it doesn't do any interesting work. So far, "pass" simply means it didn't abort after all the mocked functions returned successfully;
- I don't know what use cases these three sets of parameters actually represent; I can't put a meaningful label on any of the test cases.
I'd like to create tests for specific use cases, including segfaults and crashes and error conditions as suggested in the issue. I'd be open to suggestions.
Is this PR headed in the right direction?
Whoa this is a great idea. I think the easiest thing to do would be more "blackbox", so having a shell function that calls mkfunding
with some parameters and verifies the output.
You could probably do these using the python test framework? SImilar to the ones we have for the hsmtool
.
Here's where we test hsmtool
:
https://github.com/ElementsProject/lightning/blob/master/tests/test_wallet.py#L1103-L1109
Note that there's a partial fix for mkfunding
here (still has crash)
https://github.com/ElementsProject/lightning/commit/d2ea7f25fa1a5271096067fd4b666064d4054948
agree with more blackbox approach, it has served me well in the past
Issue 5363 has been fixed, so closing this pull request