Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_i2p_ports.py
Show All 18 Lines | class I2PPorts(BitcoinTestFramework): | ||||
def run_test(self): | def run_test(self): | ||||
node = self.nodes[0] | node = self.nodes[0] | ||||
self.log.info("Ensure we don't try to connect if port!=0") | self.log.info("Ensure we don't try to connect if port!=0") | ||||
addr = "zsxwyo6qcn3chqzwxnseusqgsnuw3maqnztkiypyfxtya4snkoka.b32.i2p:8333" | addr = "zsxwyo6qcn3chqzwxnseusqgsnuw3maqnztkiypyfxtya4snkoka.b32.i2p:8333" | ||||
raised = False | raised = False | ||||
try: | try: | ||||
with node.assert_debug_log( | with node.assert_debug_log(expected_msgs=[f"Error connecting to {addr}"]): | ||||
expected_msgs=[f"Error connecting to {addr}"]): | |||||
node.addnode(node=addr, command="onetry") | node.addnode(node=addr, command="onetry") | ||||
except AssertionError as e: | except AssertionError as e: | ||||
raised = True | raised = True | ||||
if not re.search( | if not re.search( | ||||
r"Expected messages .* does not partially match log", | r"Expected messages .* does not partially match log", str(e) | ||||
str(e)): | ): | ||||
raise AssertionError( | raise AssertionError( | ||||
f"Assertion raised as expected, but with an unexpected message: {str(e)}") | "Assertion raised as expected, but with an unexpected message:" | ||||
f" {str(e)}" | |||||
) | |||||
if not raised: | if not raised: | ||||
raise AssertionError("Assertion should have been raised") | raise AssertionError("Assertion should have been raised") | ||||
self.log.info( | self.log.info( | ||||
"Ensure we try to connect if port=0 and get an error due to missing I2P proxy") | "Ensure we try to connect if port=0 and get an error due to missing I2P" | ||||
" proxy" | |||||
) | |||||
addr = "h3r6bkn46qxftwja53pxiykntegfyfjqtnzbm6iv6r5mungmqgmq.b32.i2p:0" | addr = "h3r6bkn46qxftwja53pxiykntegfyfjqtnzbm6iv6r5mungmqgmq.b32.i2p:0" | ||||
with node.assert_debug_log( | with node.assert_debug_log(expected_msgs=[f"Error connecting to {addr}"]): | ||||
expected_msgs=[f"Error connecting to {addr}"]): | |||||
node.addnode(node=addr, command="onetry") | node.addnode(node=addr, command="onetry") | ||||
if __name__ == '__main__': | if __name__ == "__main__": | ||||
I2PPorts().main() | I2PPorts().main() |