test: Avoid redundant stop and error spam on shutdown

Trying to shut down a node after a test failure may fail and lead to an
RPC error.

Also, it is confusing to sidestep the existing fallback to kill any
leftover nodes on a test failure.

So just rely on the fallback.

Idea by Hodlinator.

Co-Authored-By: Hodlinator <172445034+hodlinator@users.noreply.github.com>
This commit is contained in:
MarcoFalke 2025-01-23 14:39:59 +01:00
parent fae3bf6b87
commit faf2f2c654
No known key found for this signature in database

View file

@ -323,9 +323,12 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
self.log.debug('Closing down network thread')
self.network_thread.close()
self.log.info("Stopping nodes")
if self.nodes:
self.stop_nodes()
if self.success == TestStatus.FAILED:
self.log.info("Not stopping nodes as test failed. The dangling processes will be cleaned up later.")
else:
self.log.info("Stopping nodes")
if self.nodes:
self.stop_nodes()
should_clean_up = (
not self.options.nocleanup and