diff options
Diffstat (limited to 'networks')
-rw-r--r-- | networks/hs-dual-intro-fail-3 | 3 | ||||
-rw-r--r-- | networks/hs-intro-fail-2 | 3 | ||||
-rw-r--r-- | networks/hs-intro-fail-3 | 8 | ||||
-rw-r--r-- | networks/hs-intro-select-2 | 8 | ||||
-rw-r--r-- | networks/hs-start-3 | 8 | ||||
-rw-r--r-- | networks/hs-stop-3 | 8 | ||||
-rw-r--r-- | networks/hs-tripple-intro-fail-3 | 8 | ||||
-rw-r--r-- | networks/hs_instance_start.py | 9 | ||||
-rw-r--r-- | networks/hs_instance_stop.py | 23 | ||||
-rw-r--r-- | networks/hs_intro_fail.py | 4 | ||||
-rw-r--r-- | networks/hs_intro_selection.py | 16 |
11 files changed, 55 insertions, 43 deletions
diff --git a/networks/hs-dual-intro-fail-3 b/networks/hs-dual-intro-fail-3 index 9be8479..e467255 100644 --- a/networks/hs-dual-intro-fail-3 +++ b/networks/hs-dual-intro-fail-3 @@ -25,6 +25,9 @@ network.add(Node.create(30, { })) def start(): + for server in hs_servers: + server.listen() + results = hs_fail_test(network, failures=2) for server in hs_servers: diff --git a/networks/hs-intro-fail-2 b/networks/hs-intro-fail-2 index ae0a35b..9b5cf2a 100644 --- a/networks/hs-intro-fail-2 +++ b/networks/hs-intro-fail-2 @@ -25,6 +25,9 @@ network.add(Node.create(10, { })) def start(): + for server in hs_servers: + server.listen() + results = hs_fail_test(network) for server in hs_servers: diff --git a/networks/hs-intro-fail-3 b/networks/hs-intro-fail-3 index 4835b0c..52192a5 100644 --- a/networks/hs-intro-fail-3 +++ b/networks/hs-intro-fail-3 @@ -25,6 +25,9 @@ network.add(Node.create(10, { })) def start(): + for server in hs_servers: + server.listen() + results = hs_fail_test(network) for server in hs_servers: @@ -32,10 +35,5 @@ def start(): network.stop() - if results: - logging.info("hs-intro-fail-3 PASS") - else: - logging.info("hs-intro-fail-3 FAIL") - return results diff --git a/networks/hs-intro-select-2 b/networks/hs-intro-select-2 index e477a00..1881bb6 100644 --- a/networks/hs-intro-select-2 +++ b/networks/hs-intro-select-2 @@ -25,6 +25,9 @@ network.add(Node.create(10, { })) def start(): + for server in hs_servers: + server.listen() + results = hs_select_test(network) for server in hs_servers: @@ -32,9 +35,4 @@ def start(): network.stop() - if results: - logging.info("hs-intro-select-2 PASS") - else: - logging.info("hs-intro-select-2 FAIL") - return results diff --git a/networks/hs-start-3 b/networks/hs-start-3 index 4fead95..e01a7a5 100644 --- a/networks/hs-start-3 +++ b/networks/hs-start-3 @@ -25,6 +25,9 @@ network.add(Node.create(10, { })) def start(): + for server in hs_servers: + server.listen() + results = hs_instance_start(network) for server in hs_servers: @@ -32,9 +35,4 @@ def start(): network.stop() - if results: - logging.info("hs-start-3 PASS") - else: - logging.info("hs-start-3 FAIL") - return results diff --git a/networks/hs-stop-3 b/networks/hs-stop-3 index 7d30f40..8d4f372 100644 --- a/networks/hs-stop-3 +++ b/networks/hs-stop-3 @@ -25,6 +25,9 @@ network.add(Node.create(10, { })) def start(): + for server in hs_servers: + server.listen() + results = hs_instance_stop(network) for server in hs_servers: @@ -32,9 +35,4 @@ def start(): network.stop() - if results: - logging.info("hs-stop-3 PASS") - else: - logging.info("hs-stop-3 FAIL") - return results diff --git a/networks/hs-tripple-intro-fail-3 b/networks/hs-tripple-intro-fail-3 index fedfc44..54d3d0a 100644 --- a/networks/hs-tripple-intro-fail-3 +++ b/networks/hs-tripple-intro-fail-3 @@ -25,6 +25,9 @@ network.add(Node.create(30, { })) def start(): + for server in hs_servers: + server.listen() + results = hs_fail_test(network, failures=3) for server in hs_servers: @@ -32,10 +35,5 @@ def start(): network.stop() - if results: - logging.info("hs-tripple-fail-3 PASS") - else: - logging.info("hs-tripple-fail-3 FAIL") - return results diff --git a/networks/hs_instance_start.py b/networks/hs_instance_start.py index 38282de..19cb3ad 100644 --- a/networks/hs_instance_start.py +++ b/networks/hs_instance_start.py @@ -4,6 +4,8 @@ from chutney.TorNet import * from stem.control import EventType def hs_instance_start(network): + result = True + hs_nodes = network.get("h") clients = network.get("c") @@ -57,6 +59,9 @@ def hs_instance_start(network): 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) + 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 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 diff --git a/networks/hs_intro_fail.py b/networks/hs_intro_fail.py index 90c7f48..4850026 100644 --- a/networks/hs_intro_fail.py +++ b/networks/hs_intro_fail.py @@ -58,7 +58,7 @@ def hs_fail_test(network, failures=1): # Now begin testing - connection_test(network.get("c"), len(hs_nodes)) + result &= connection_test(network.get("c"), len(hs_nodes)) time.sleep(5) @@ -105,6 +105,6 @@ def hs_fail_test(network, failures=1): result &= check_same_intro_points() - connection_test(network.get("c"), len(hs_nodes)) + result &= connection_test(network.get("c"), len(hs_nodes)) return result diff --git a/networks/hs_intro_selection.py b/networks/hs_intro_selection.py index 99b73d8..1ed351a 100644 --- a/networks/hs_intro_selection.py +++ b/networks/hs_intro_selection.py @@ -4,6 +4,8 @@ from chutney.TorNet import * from stem.control import EventType def hs_select_test(network, failures=1): + result = True + hs_nodes = network.get("h") initial_nodes = network.get("a") + network.get("r") + network.get("c") + hs_nodes[:1] @@ -57,7 +59,7 @@ def hs_select_test(network, failures=1): # Now begin testing - connection_test(network.get("c"), len(hs_nodes)) + result &= connection_test(network.get("c"), len(hs_nodes)) time.sleep(5) @@ -65,8 +67,8 @@ def hs_select_test(network, failures=1): next_intro_points = get_next_intro_points() - print("Predicted new introduction points") - print(next_intro_points) + logging.info("Predicted new introduction points") + logging.info(next_intro_points) fingerprint = next_intro_points[0][0] node = nodes_by_fingerprint[fingerprint] @@ -77,7 +79,7 @@ def hs_select_test(network, failures=1): time.sleep(10) - check_same_intro_points() + result &= check_same_intro_points() logging.info("About to stop %d introduction points" % failures) @@ -120,6 +122,8 @@ def hs_select_test(network, failures=1): else: logging.info("All did not change") - check_same_intro_points() + result &= check_same_intro_points() + + result &= connection_test(network.get("c"), len(hs_nodes)) - connection_test(network.get("c"), len(hs_nodes)) + return result |