diff options
Diffstat (limited to 'networks/hs_instance_stop.py')
-rw-r--r-- | networks/hs_instance_stop.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/networks/hs_instance_stop.py b/networks/hs_instance_stop.py index f3ca787..01ed865 100644 --- a/networks/hs_instance_stop.py +++ b/networks/hs_instance_stop.py @@ -6,6 +6,8 @@ from stem.control import EventType import time def hs_instance_stop(network): + result = True + hs_nodes = network.get("h") clients = network.get("c") @@ -35,6 +37,7 @@ def hs_instance_stop(network): logging.info("There are %d nodes to start" % len(hs_nodes)) + # Start each node, one by one for i, hs_node in enumerate(hs_nodes): logging.info("Starting node %d" % i) @@ -57,14 +60,15 @@ def hs_instance_stop(network): hs_node.getStemController().remove_event_listener(hs_node_listener) # Now begin testing + logging.info("Testing with the %d client group" % i) + result &= connection_test(client_groups[i], i + 1) - for c_group in range(i + 1): - logging.info("Testing with the %d client group" % c_group) - connection_test(client_groups[c_group], i + 1) - - check_same_intro_points() + result &= check_same_intro_points() - for i, hs_node in reversed(list(enumerate(hs_nodes))): + # Stop all but the first node in turn, checking that all currently active + # nodes are reachable, and that all active nodes have the same introduction + # points + for i, hs_node in reversed(list(enumerate(hs_nodes))[1:]): logging.info("Stopping node %d" % i) hs_node.getController().stop() @@ -75,6 +79,9 @@ def hs_instance_stop(network): for c_group in range(len(hs_nodes)): logging.info("Testing with the %d client group" % c_group) - connection_test(client_groups[c_group], i + 1) + expected_nodes = min(c_group, i) + result &= connection_test(client_groups[c_group], expected_nodes) + + result &= check_same_intro_points() - check_same_intro_points() + return result |