test: improve robustness of connect_nodes()

The 'connect_nodes' function in the test framework relies
on a stable number of peer connections to verify the new
connection between the nodes is successfully established.
This approach is fragile, as any of the peers involved in
the process can drop, lose, or create a connection at any
step, causing subsequent 'wait_until' checks to stall
indefinitely even when the peers in question are connected
successfully.

This commit improves the situation by using the nodes' subversion
and the connection direction (inbound/outbound) to identify the
exact peer connection and perform the checks exclusively on it.
This commit is contained in:
furszy
2024-05-15 17:33:01 -03:00
parent 71f0f2273f
commit 6629d1d0f8
2 changed files with 20 additions and 9 deletions

View File

@@ -106,7 +106,7 @@ class TestNode():
"-debugexclude=libevent",
"-debugexclude=leveldb",
"-debugexclude=rand",
"-uacomment=testnode%d" % i,
"-uacomment=testnode%d" % i, # required for subversion uniqueness across peers
]
if self.descriptors is None:
self.args.append("-disablewallet")