Add a test for addr with host 127.0.0.1
This commit is contained in:
parent
af5a8acd21
commit
68bea10ab7
|
@ -142,9 +142,12 @@ class TestNetwork(unittest.TestCase):
|
|||
time_offset_connections(nodes, -4000)
|
||||
|
||||
|
||||
class TestListener(TestProcessProto):
|
||||
"""A separate test case for Listener with a process with --trusted-peer"""
|
||||
_process_cmd = ['minode', '--trusted-peer', '127.0.0.1']
|
||||
class TestConnection(TestProcessProto):
|
||||
"""
|
||||
A base class for test cases using a process with --trusted-peer
|
||||
to connect to a listener instance.
|
||||
"""
|
||||
_process_cmd = ['minode', '--trusted-peer', '127.0.0.1', '-p', '8448']
|
||||
|
||||
def setUp(self):
|
||||
shared.shutting_down = False
|
||||
|
@ -154,6 +157,10 @@ class TestListener(TestProcessProto):
|
|||
super().tearDownClass()
|
||||
shared.shutting_down = False
|
||||
|
||||
|
||||
class TestListener(TestConnection):
|
||||
"""A separate test case for Listener"""
|
||||
|
||||
def test_listener(self):
|
||||
"""Start Listener and try to connect"""
|
||||
with run_listener() as listener:
|
||||
|
@ -215,3 +222,16 @@ class TestListener(TestProcessProto):
|
|||
if c.status == 'fully_established':
|
||||
self.fail('Established a connection')
|
||||
time.sleep(0.5)
|
||||
|
||||
|
||||
class TestBehavior(TestConnection):
|
||||
"""Test behavior of the process with --trusted-peer"""
|
||||
|
||||
def test_advertisement(self):
|
||||
"""Ensure it doesn't advertise 127.0.0.1"""
|
||||
started = time.time()
|
||||
with run_listener() as _:
|
||||
while time.time() - started < 30:
|
||||
if ('127.0.0.1', 8448) in shared.unchecked_node_pool:
|
||||
self.fail('Got 127.0.0.1 in an addr message')
|
||||
time.sleep(1)
|
||||
|
|
Loading…
Reference in New Issue
Block a user