Skip to content
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

refactor(tests): Hide bitcoind stopper #261

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mariocynicys
Copy link
Collaborator

We had to assign the stopper to a variable in the tests so to have it dropped at the end of the test and clean up the spawned mock server.

This refactor makes it so that the stopper is stored in Carrier (but only on test mode) and it's dropped whenever the carrier is dropped. I chose to include it in the carrier since the carrier is the struct that talks with bitcoind, so if the carrier is to die so should bitcoind as well.

this avoids having exiplict handling of the bitcoind stopper and it being all over the place
when the carrier (by the end of the test) the stopper will get dropped as well which will cause the mock server to shutdown
In some tests the carrier didn't need a stopper since it was already in the test scope so it would drop at the end of the test and do usual cleanup.
This commit unifies stuff and still moves the stopper inside the carrier so that all the tests look alike (not having ones with Some(stopper) and ones with None).
@mariocynicys mariocynicys requested a review from sr-gi July 25, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant