Skip to content

Commit 6779e6e

Browse files
committed
test: clean up is node stopped
1 parent 681ecac commit 6779e6e

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

test/functional/test_framework/test_node.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def stop_node(self, expected_stderr='', *, wait=0, wait_until_stopped=True):
365365
if wait_until_stopped:
366366
self.wait_until_stopped()
367367

368-
def is_node_stopped(self, expected_ret_code=None):
368+
def is_node_stopped(self, expected_ret_code=0):
369369
"""Checks whether the node has stopped.
370370
371371
Returns True if the node has stopped. False otherwise.
@@ -377,13 +377,8 @@ def is_node_stopped(self, expected_ret_code=None):
377377
return False
378378

379379
# process has stopped. Assert that it didn't return an error code.
380-
# unless 'expected_ret_code' is provided.
381-
if expected_ret_code is not None:
382-
assert return_code == expected_ret_code, self._node_msg(
383-
"Node returned unexpected exit code (%d) vs (%d) when stopping" % (return_code, expected_ret_code))
384-
else:
385-
assert return_code == 0, self._node_msg(
386-
"Node returned non-zero exit code (%d) when stopping" % return_code)
380+
assert return_code == expected_ret_code, self._node_msg(
381+
f"Node returned unexpected exit code ({return_code}) vs ({expected_ret_code}) when stopping")
387382
self.running = False
388383
self.process = None
389384
self.rpc_connected = False
@@ -392,7 +387,7 @@ def is_node_stopped(self, expected_ret_code=None):
392387
return True
393388

394389
def wait_until_stopped(self, timeout=BITCOIND_PROC_WAIT_TIMEOUT, expect_error=False):
395-
expected_ret_code = 1 if expect_error else None # Whether node shutdown return EXIT_FAILURE or EXIT_SUCCESS
390+
expected_ret_code = 1 if expect_error else 0 # Whether node shutdown return EXIT_FAILURE or EXIT_SUCCESS
396391
wait_until_helper(lambda: self.is_node_stopped(expected_ret_code=expected_ret_code), timeout=timeout, timeout_factor=self.timeout_factor)
397392

398393
def replace_in_config(self, replacements):

0 commit comments

Comments
 (0)