diff --git a/minode/tests/test_network.py b/minode/tests/test_network.py index dbf5bc3..47b405a 100644 --- a/minode/tests/test_network.py +++ b/minode/tests/test_network.py @@ -127,19 +127,28 @@ class TestNetwork(unittest.TestCase): else: return 'Spent too much time trying to connect' - def time_offset_connections(nodes, offset): + def time_offset_bad_connections(nodes, offset): """Spoof time.time and open connections with given time offset""" with time_offset(offset) as time_call: result = try_connect(nodes, 200, time_call) if result: self.fail(result) + def time_offset_good_connections(nodes): + """Connect to at least one node with acceptable time offset""" + with time_offset(-3500) as time_call: + result = try_connect(nodes, 200, time_call) + if not result: + self.fail('Failed to connect with acceptable time offset') + self._make_initial_nodes() nodes = random.sample( tuple(shared.core_nodes.union(shared.unchecked_node_pool)), 5) - time_offset_connections(nodes, 4000) - time_offset_connections(nodes, -4000) + time_offset_bad_connections(nodes, 4000) + time_offset_bad_connections(nodes, -4000) + + time_offset_good_connections(nodes) class TestConnection(TestProcessProto):