diff options
author | ng0 <ng0@n0.is> | 2019-10-12 18:16:07 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-10-12 18:16:07 +0000 |
commit | a5f5e7ed9b07b902af4438d76087e034abcba9b2 (patch) | |
tree | 6f376f93f1c785103d0b30f54311a0f61d2bdced /src/integration-tests/test_integration_reconnect_nat.py.in | |
parent | 8e827de2a1db34dfe15f5f9da2850ca469b5ecc3 (diff) | |
download | gnunet-a5f5e7ed9b07b902af4438d76087e034abcba9b2.tar.gz gnunet-a5f5e7ed9b07b902af4438d76087e034abcba9b2.zip |
format python
Diffstat (limited to 'src/integration-tests/test_integration_reconnect_nat.py.in')
-rwxr-xr-x | src/integration-tests/test_integration_reconnect_nat.py.in | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/integration-tests/test_integration_reconnect_nat.py.in b/src/integration-tests/test_integration_reconnect_nat.py.in index 45626d50d..751a0484b 100755 --- a/src/integration-tests/test_integration_reconnect_nat.py.in +++ b/src/integration-tests/test_integration_reconnect_nat.py.in | |||
@@ -32,7 +32,6 @@ from gnunet_testing import Check | |||
32 | from gnunet_testing import Condition | 32 | from gnunet_testing import Condition |
33 | from gnunet_testing import * | 33 | from 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 |
@@ -43,7 +42,6 @@ from gnunet_testing import * | |||
43 | 42 | ||
44 | # definitions | 43 | # definitions |
45 | 44 | ||
46 | |||
47 | testname = "test_integration_restart" | 45 | testname = "test_integration_restart" |
48 | verbose = True | 46 | verbose = True |
49 | check_timeout = 180 | 47 | check_timeout = 180 |
@@ -82,7 +80,7 @@ def cleanup(): | |||
82 | retries = 10 | 80 | retries = 10 |
83 | path = os.path.join(tmp, "c_nat_client") | 81 | path = os.path.join(tmp, "c_nat_client") |
84 | test.p("Removing " + path) | 82 | test.p("Removing " + path) |
85 | while((os.path.exists(path)) and(retries > 0)): | 83 | while ((os.path.exists(path)) and (retries > 0)): |
86 | shutil.rmtree((path), False, cleanup_onerror) | 84 | shutil.rmtree((path), False, cleanup_onerror) |
87 | time.sleep(1) | 85 | time.sleep(1) |
88 | retries -= 1 | 86 | retries -= 1 |
@@ -91,18 +89,18 @@ def cleanup(): | |||
91 | 89 | ||
92 | 90 | ||
93 | def success_restart_cont(check): | 91 | def success_restart_cont(check): |
94 | global success | 92 | global success |
95 | print('Peers connected successfully after restart') | 93 | print('Peers connected successfully after restart') |
96 | server.stop() | 94 | server.stop() |
97 | client.stop() | 95 | client.stop() |
98 | success = True | 96 | success = True |
99 | 97 | ||
100 | 98 | ||
101 | def fail_restart_cont(check): | 99 | def fail_restart_cont(check): |
102 | global success | 100 | global success |
103 | success = False | 101 | success = False |
104 | print('Peers failed to connect after restart') | 102 | print('Peers failed to connect after restart') |
105 | check.evaluate(True) | 103 | check.evaluate(True) |
106 | 104 | ||
107 | 105 | ||
108 | def success_connect_cont(check): | 106 | def success_connect_cont(check): |
@@ -151,6 +149,7 @@ def check_connect(): | |||
151 | 149 | ||
152 | check.run_blocking(check_timeout, success_connect_cont, fail_connect_cont) | 150 | check.run_blocking(check_timeout, success_connect_cont, fail_connect_cont) |
153 | 151 | ||
152 | |||
154 | # | 153 | # |
155 | # Test execution | 154 | # Test execution |
156 | # | 155 | # |
@@ -227,7 +226,7 @@ def run(): | |||
227 | 226 | ||
228 | try: | 227 | try: |
229 | run() | 228 | run() |
230 | except(KeyboardInterrupt, SystemExit): | 229 | except (KeyboardInterrupt, SystemExit): |
231 | print('Test interrupted') | 230 | print('Test interrupted') |
232 | server.stop() | 231 | server.stop() |
233 | client.stop() | 232 | client.stop() |