talaia-labs/rust-teos

test_utils::start_server may not be necessary

Opened this issue · 2 comments

sr-gi commented

While doing some tests for #130 I realized that not starting the BitcoindMock::Server seemed not to make a difference when running the tests. From what I recall when designing it, starting the server was necessary to bring up the HTTP interface BitcoindMock uses. However, looks like this may not be necessary (?).

I've run some tests getting rid of start_server and some tests do hang, so a more thorough examination will be needed.

sr-gi commented

The logical reason why some test hang may be because of Carrier::hang_until_bitcoind_reachable(), however, is hard to reason why this is not the case for other tests.

I tried to research a little on this and all 10 tests of carrier.rs are running fine without start_server. The tests which are hanged are from watcher.rs and responder.rs and they all are async. Reason being watcher and responder objects need to maintain connection to communicate with the server. While in case of those 10 tests, there is no need to maintain connection as the carrier object contains the variables used to check the query.

If this logic is correct, then I think start_server is not required on those 10 test cases.