Skip to content

Commit 5a56cf4

Browse files
committed
test: Add TestNode ipcbind option
With this change, tests can specify `self.extra_init = [{ipcbind: True}]` to start a node listening on an IPC socket, instead of needing to choose which node binary to invoke and what `self.extra_args=[["-ipcbind=..."]]` value to pass to it. The eliminates boilerplate code bitcoin#30437 (interface_ipc_mining.py), bitcoin#32297 (interface_ipc_cli.py), and bitcoin#33201 (interface_ipc.py) previously needed in their test setup.
1 parent d69e410 commit 5a56cf4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,14 @@ def bin_dir_from_version(version):
556556

557557
bin_dirs.append(bin_dir)
558558

559+
<<<<<<< HEAD
559560
extra_init = [{}] * num_nodes if self.extra_init is None else self.extra_init # type: ignore[var-annotated]
560561
assert_equal(len(extra_init), num_nodes)
562+
||||||| parent of 6d0103472f1d (test: Add TestNode ipcbind option)
563+
=======
564+
extra_init = [{}] * num_nodes if self.extra_init is None else self.extra_init
565+
assert_equal(len(extra_init), num_nodes)
566+
>>>>>>> 6d0103472f1d (test: Add TestNode ipcbind option)
561567
assert_equal(len(extra_confs), num_nodes)
562568
assert_equal(len(extra_args), num_nodes)
563569
assert_equal(len(versions), num_nodes)

test/functional/test_framework/test_node.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,16 @@ def __del__(self):
233233
# this destructor is called.
234234
print(self._node_msg("Cleaning up leftover process"), file=sys.stderr)
235235
self.process.kill()
236+
<<<<<<< HEAD
236237
if self.ipc_tmp_dir:
237238
print(self._node_msg(f"Cleaning up ipc directory {str(self.ipc_tmp_dir)!r}"))
238239
shutil.rmtree(self.ipc_tmp_dir)
240+
||||||| parent of 6d0103472f1d (test: Add TestNode ipcbind option)
241+
=======
242+
if self.ipc_tmp_dir:
243+
print(self._node_msg(f"Cleaning up ipc directory {str(self.ipc_tmp_dir)!r}"), file=sys.stderr)
244+
shutil.rmtree(self.ipc_tmp_dir)
245+
>>>>>>> 6d0103472f1d (test: Add TestNode ipcbind option)
239246

240247
def __getattr__(self, name):
241248
"""Dispatches any unrecognised messages to the RPC connection or a CLI instance."""

0 commit comments

Comments
 (0)