-
Notifications
You must be signed in to change notification settings - Fork 141
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
reactivate CLN integration tests #1336
Conversation
DecodeBolt11 was removed in: daywalker90/holdinvoice@d51fd03
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.
- when stopping with
docker compose -f docker-tests.yml --env-file tests/compose.env down
and then starting again withdocker compose -f docker-tests.yml --env-file tests/compose.env up -d
my btc container always starts at blockheight 0, basically completely reset. This of course makes CLN crash since it detected blockheight going back.
We have to stop with docker compose -f docker-tests.yml --env-file tests/compose.env down --volumes
(note the --volumes) , effectively trashing everything: the blockchain and the lightning node. On every start, a new CLN node should be created and peered with the user node. That's all pretty much already automated in /tests/utils/node.py
;s set_up_regtest_network()
and was working long time ago. This is needed to ensure full reproducibility of tests, every test run starts from the same point, that is, from scratch.
There is an issue with CLN v24.05 where it crashes on regtest if blockheight=0. I don't know where and how to best generate a block but i think it needs to happen before the Wait for coordinator (django server) job
Two options here:
- The easy one would be to add a
generate_blocks(address, num_blocks=1)
at the beginning of/tests/utils/node.py
;sset_up_regtest_network()
around L165. We should call this function with any hardcoded valid regtest bitcoin address, because we cannot use the lightning nodes to generate an address just yet. - If (1) is not early enough and CLN crashes even before the tests run... I guess we can write an
entrypoint.sh
that usesbitcoin-cli --rpcuser .... generateblocks <hardcoded_regtest_address/>
to mine a single block?
After manually circumventing these 2 issues i can run the tests but at the end i get 3 errors, all the same error:
Happy to see so many tests did pass! I actually never managed so many successes with CLN. Never found anything in specific broken, but the tests would randomly fail after a few orders (hodl invoices did not reach).
The error logs seem to point that CLN might not be returning a mining fee estimate? This might also be due to regtest
environment. This needs some testing, but if this hypothesis is true, we could write some logic on /api/lightning/cln.py
estimate_fee()
that will return 20
sat/vbyte if network==regtest
.
Thank you for your work 🚀
I actually could not reproduce the error with the correct |
Everrything should be passing now: https://github.com/daywalker90/robosats/actions/runs/9542920360/job/26298571087 |
Woop! 🚀 Thank you @daywalker90 ! Interesting that the coverage of the CLN class is somewhat low (well this is true too for LND I believe).
Please post an invoice with a long expiration time ( 1 week) for 300K Sats. |
Yes, i'd love to see one. I would do it myself but doing support kinda scares me off. LND has 54% btw. If i can get a quick grasp on how the testing framework works i might pump those numbers up, no promises tho. Thanks for the sats :)
|
The way I would go with it is to get the HTML report
Take a look at the html output and then either:
I guess a lot of what is not covered has to do with mostlt with logging the onchain and channel balances, etc. Those will benefit of simple unit testing :) |
54d6ea8da3c43ee02331ac0a590c0dc37a3bc98aa8758ed006332db39c277660 |
Ontop of #1335
What does this PR do?
reactivate CLN integration tests
Checklist before merging
pip install pre-commit
, thenpre-commit install
. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.Issues
I managed to run these tests locally but encountered some issues:
docker compose -f docker-tests.yml --env-file tests/compose.env down
and then starting again withdocker compose -f docker-tests.yml --env-file tests/compose.env up -d
my btc container always starts at blockheight 0, basically completely reset. This of course makes CLN crash since it detected blockheight going back.Wait for coordinator (django server)
jobAny pointers why this happens could help me figure out what's wrong.