summaryrefslogtreecommitdiff
path: root/src/integration-tests/test_integration_disconnect_nat.py.in
diff options
context:
space:
mode:
Diffstat (limited to 'src/integration-tests/test_integration_disconnect_nat.py.in')
-rwxr-xr-xsrc/integration-tests/test_integration_disconnect_nat.py.in22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/integration-tests/test_integration_disconnect_nat.py.in b/src/integration-tests/test_integration_disconnect_nat.py.in
index c3d5d8901..d3ff84ebe 100755
--- a/src/integration-tests/test_integration_disconnect_nat.py.in
+++ b/src/integration-tests/test_integration_disconnect_nat.py.in
@@ -32,7 +32,6 @@ from gnunet_testing import Check
32from gnunet_testing import Condition 32from gnunet_testing import Condition
33from gnunet_testing import * 33from gnunet_testing import *
34 34
35
36# 35#
37# This test tests if a fresh peer bootstraps from a hostlist server and then 36# This test tests if a fresh peer bootstraps from a hostlist server and then
38# successfully connects to the server. When both peers are connected 37# successfully connects to the server. When both peers are connected
@@ -68,7 +67,9 @@ def cleanup_onerror(function, path, excinfo):
68 67
69 68
70def cleanup(): 69def cleanup():
71 shutil.rmtree(os.path.join(tmp, "c_bootstrap_server"), False, cleanup_onerror) 70 shutil.rmtree(
71 os.path.join(tmp, "c_bootstrap_server"), False, cleanup_onerror
72 )
72 shutil.rmtree(os.path.join(tmp, "c_nat_client"), False, cleanup_onerror) 73 shutil.rmtree(os.path.join(tmp, "c_nat_client"), False, cleanup_onerror)
73 74
74 75
@@ -80,7 +81,7 @@ def success_disconnect_cont(check):
80 81
81def fail_disconnect_cont(check): 82def fail_disconnect_cont(check):
82 global success 83 global success
83 success = False; 84 success = False
84 print('Peers failed to disconnect') 85 print('Peers failed to disconnect')
85 check.evaluate(True) 86 check.evaluate(True)
86 87
@@ -96,7 +97,9 @@ def check_disconnect():
96 check.add(StatisticsCondition(server, 'topology', '# peers connected', 0)) 97 check.add(StatisticsCondition(server, 'topology', '# peers connected', 0))
97 check.add(StatisticsCondition(server, 'dht', '# peers connected', 0)) 98 check.add(StatisticsCondition(server, 'dht', '# peers connected', 0))
98 check.add(StatisticsCondition(server, 'fs', '# peers connected', 0)) 99 check.add(StatisticsCondition(server, 'fs', '# peers connected', 0))
99 check.run_blocking(check_timeout, success_disconnect_cont, fail_disconnect_cont) 100 check.run_blocking(
101 check_timeout, success_disconnect_cont, fail_disconnect_cont
102 )
100 103
101 104
102def success_connect_cont(check): 105def success_connect_cont(check):
@@ -115,9 +118,13 @@ def check_connect():
115 global server 118 global server
116 global nat_client 119 global nat_client
117 check = Check(test) 120 check = Check(test)
118 check.add(StatisticsCondition(nat_client, 'transport', '# peers connected', 1)) 121 check.add(
122 StatisticsCondition(nat_client, 'transport', '# peers connected', 1)
123 )
119 check.add(StatisticsCondition(nat_client, 'core', '# peers connected', 1)) 124 check.add(StatisticsCondition(nat_client, 'core', '# peers connected', 1))
120 check.add(StatisticsCondition(nat_client, 'topology', '# peers connected', 1)) 125 check.add(
126 StatisticsCondition(nat_client, 'topology', '# peers connected', 1)
127 )
121 check.add(StatisticsCondition(nat_client, 'dht', '# peers connected', 1)) 128 check.add(StatisticsCondition(nat_client, 'dht', '# peers connected', 1))
122 check.add(StatisticsCondition(nat_client, 'fs', '# peers connected', 1)) 129 check.add(StatisticsCondition(nat_client, 'fs', '# peers connected', 1))
123 130
@@ -134,6 +141,7 @@ def check_connect():
134# Test execution 141# Test execution
135# 142#
136 143
144
137def SigHandler(signum=None, frame=None): 145def SigHandler(signum=None, frame=None):
138 global success 146 global success
139 global server 147 global server
@@ -204,7 +212,7 @@ def run():
204 212
205try: 213try:
206 run() 214 run()
207except(KeyboardInterrupt, SystemExit): 215except (KeyboardInterrupt, SystemExit):
208 print('Test interrupted') 216 print('Test interrupted')
209 server.stop() 217 server.stop()
210 nat_client.stop() 218 nat_client.stop()