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

test_utils::start_server may not be necessary

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

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 avatar Oct 06 '22 11:10 sr-gi

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.

sr-gi avatar Oct 06 '22 11:10 sr-gi

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.

ShubhamBhut avatar Mar 26 '23 04:03 ShubhamBhut