rust-teos icon indicating copy to clipboard operation
rust-teos copied to clipboard

Use bitcoind to test the tower

Open sr-gi opened this issue 2 years ago • 6 comments

Currently, a BitcoindMock is being used to test the tower functionality.

We should either move to use bitcoind instead, or create a different test suite that uses it (for instance, using the mock for unit but bitcoind for integration / e2e / ... )

sr-gi avatar Mar 10 '22 17:03 sr-gi

The bitcoind crate was suggested as a good tool to accomplish this task.

sr-gi avatar Apr 26 '22 13:04 sr-gi

Going to pick this one up, as it'll help me have more confidence in making larger feature adds in the future, I'll start with trying to integrate with "The bicoind crate" that you've linked.

tee8z avatar May 20 '22 14:05 tee8z

Sweet 🎉

Feel free to take a look at python-teos. We used bitcoind for the whole test suit so it may give you a sense of how this may look like (even though I think the specifics of how to make it work may differ considerably).

sr-gi avatar May 20 '22 15:05 sr-gi

Just wanted to give an update, made solid progress on this, but it required moving much of what currently is in main.rs to a startup.rs file. This allows me to reuse the configuration/wiring up of the startup when doing the integration test setup process. If you have time, please take a look at the branch and the first test I have working with this. https://github.com/tee8z/rust-teos/blob/bitcoind-end_to_end-tests/teos/tests/end_to_end_client_test.rs -- Just want to make sure I'm headed in the correct direction before getting too much deeper into this.

tee8z avatar May 23 '22 15:05 tee8z

Approach ACK

Do you think this could be applied to the unit tests so BitcoindMock is replaced?

sr-gi avatar May 24 '22 07:05 sr-gi

It's possible, it would slow the unit tests down though as it requires bitcoind spinning itself up completely before it can be used (takes a few seconds for regtest). Might be better to just leave the BitcoindMock in the unit tests, allowing them to be nice and fast with low dependencies, and have true integration/end-to-end tests that are run in a separate crate, like my example. Cargo treats each file in the test/ folder as it's own crate and any setup code needed across them can sit in the common/mod.rs file. Also, these integration tests are very easy to run from the command line and cargo knows to pick up the files in the test/ folder as integration tests. They can be executed with the cargo test or cargo test --test end_to_end_client_test where you specify the file you'd like to run. Cargo will also wait to run the integration test after the unit tests found in the files of the src folder complete, when you run the cargo test command instead of specifying the file. Anyways, I'm going to work through making some integration tests that match some of what is being tested in the python-teos integration tests and will let you know how it goes.

tee8z avatar May 24 '22 18:05 tee8z