mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-12 06:53:11 +02:00
refactor: torcontrol add connection checks to restart_with_mock
This commit is contained in:
@@ -119,6 +119,11 @@ class TorControlTest(BitcoinTestFramework):
|
||||
"-debug=tor",
|
||||
])
|
||||
|
||||
# Wait for connection and PROTOCOLINFO command
|
||||
mock_tor.conn_ready.wait(timeout=10)
|
||||
self.wait_until(lambda: len(mock_tor.received_commands) >= 1, timeout=10)
|
||||
assert_equal(mock_tor.received_commands[0], "PROTOCOLINFO 1")
|
||||
|
||||
def test_basic(self):
|
||||
self.log.info("Test Tor control basic functionality")
|
||||
|
||||
@@ -144,11 +149,6 @@ class TorControlTest(BitcoinTestFramework):
|
||||
mock_tor = MockTorControlServer(self.next_port(), manual_mode=True)
|
||||
self.restart_with_mock(mock_tor)
|
||||
|
||||
# Wait for connection and PROTOCOLINFO command
|
||||
mock_tor.conn_ready.wait(timeout=10)
|
||||
self.wait_until(lambda: len(mock_tor.received_commands) >= 1, timeout=10)
|
||||
assert_equal(mock_tor.received_commands[0], "PROTOCOLINFO 1")
|
||||
|
||||
# Send partial response (no \r\n on last line)
|
||||
mock_tor.send_raw(
|
||||
"250-PROTOCOLINFO 1\r\n"
|
||||
@@ -207,11 +207,6 @@ class TorControlTest(BitcoinTestFramework):
|
||||
mock_tor = MockTorControlServer(self.next_port(), manual_mode=True)
|
||||
self.restart_with_mock(mock_tor)
|
||||
|
||||
# Wait for connection and PROTOCOLINFO command.
|
||||
mock_tor.conn_ready.wait(timeout=10)
|
||||
self.wait_until(lambda: len(mock_tor.received_commands) >= 1, timeout=10)
|
||||
assert_equal(mock_tor.received_commands[0], "PROTOCOLINFO 1")
|
||||
|
||||
# Send a single line longer than MAX_LINE_LENGTH. The node should disconnect.
|
||||
MAX_LINE_LENGTH = 100000
|
||||
mock_tor.send_raw("250-" + ("A" * (MAX_LINE_LENGTH + 1)) + "\r\n")
|
||||
|
||||
Reference in New Issue
Block a user