diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-12-15 17:03:59 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-12-15 17:03:59 +0000 |
commit | ac01064f2f336b9903164e11450bb46d4c5c04ad (patch) | |
tree | 944056458bea3529042287fdec40a65f78802824 /src/integration-tests/test_integration_clique.py.in | |
parent | 9af43c04be4bb3df805b07e42e04e4a5e70453d8 (diff) | |
download | gnunet-ac01064f2f336b9903164e11450bb46d4c5c04ad.tar.gz gnunet-ac01064f2f336b9903164e11450bb46d4c5c04ad.zip |
improved tests
Diffstat (limited to 'src/integration-tests/test_integration_clique.py.in')
-rwxr-xr-x | src/integration-tests/test_integration_clique.py.in | 475 |
1 files changed, 102 insertions, 373 deletions
diff --git a/src/integration-tests/test_integration_clique.py.in b/src/integration-tests/test_integration_clique.py.in index fbdadae12..ce254ca7b 100755 --- a/src/integration-tests/test_integration_clique.py.in +++ b/src/integration-tests/test_integration_clique.py.in | |||
@@ -31,76 +31,18 @@ import re | |||
31 | import shutil | 31 | import shutil |
32 | import time | 32 | import time |
33 | import pexpect | 33 | import pexpect |
34 | from gnunet_testing import Peer | ||
35 | from gnunet_testing import Test | ||
36 | from gnunet_testing import Check | ||
37 | from gnunet_testing import Condition | ||
38 | from gnunet_testing import * | ||
39 | |||
34 | 40 | ||
35 | #definitions | 41 | #definitions |
36 | 42 | ||
37 | testname = "test_integration_clique" | 43 | testname = "test_integration_clique" |
38 | verbose = False | 44 | verbose = True |
39 | gnunetarm = "" | 45 | check_timeout = 120 |
40 | gnunetstatistics = "" | ||
41 | success = False | ||
42 | timeout = 10 | ||
43 | |||
44 | s_server = False; | ||
45 | s_c1 = False; | ||
46 | s_c2 = False; | ||
47 | |||
48 | #test conditions | ||
49 | |||
50 | |||
51 | def vprintf (msg): | ||
52 | if verbose == True: | ||
53 | print msg | ||
54 | |||
55 | def setup (): | ||
56 | srcdir = "../.." | ||
57 | gnunet_pyexpect_dir = os.path.join (srcdir, "contrib") | ||
58 | if gnunet_pyexpect_dir not in sys.path: | ||
59 | sys.path.append (gnunet_pyexpect_dir) | ||
60 | from gnunet_pyexpect import pexpect | ||
61 | global gnunetarm | ||
62 | global gnunetstatistics | ||
63 | if os.name == 'posix': | ||
64 | gnunetarm = 'gnunet-arm' | ||
65 | gnunetstatistics = 'gnunet-statistics' | ||
66 | elif os.name == 'nt': | ||
67 | gnunetarm = 'gnunet-arm.exe' | ||
68 | gnunetstatistics = 'gnunet-statistics.exe' | ||
69 | if os.name == "nt": | ||
70 | shutil.rmtree (os.path.join (os.getenv ("TEMP"), testname), True) | ||
71 | else: | ||
72 | shutil.rmtree ("/tmp/" + testname, True) | ||
73 | |||
74 | def start (): | ||
75 | vprintf ("Starting bootstrap server & client") | ||
76 | try: | ||
77 | server = subprocess.Popen ([gnunetarm, '-sq', '-c', './confs/c_bootstrap_server.conf']) | ||
78 | server.communicate () | ||
79 | except OSError: | ||
80 | print "Can not start bootstrap server, exiting..." | ||
81 | exit (1) | ||
82 | try: | ||
83 | client = subprocess.Popen ([gnunetarm, '-sq', '-c', 'confs/c_no_nat_client.conf']) | ||
84 | client.communicate () | ||
85 | except OSError: | ||
86 | print "Can not start bootstrap client, exiting..." | ||
87 | exit (1) | ||
88 | try: | ||
89 | client = subprocess.Popen ([gnunetarm, '-sq', '-c', 'confs/c_no_nat_client_2.conf']) | ||
90 | client.communicate () | ||
91 | except OSError: | ||
92 | print "Can not start bootstrap client 2, exiting..." | ||
93 | exit (1) | ||
94 | vprintf ("Bootstrap server & client started") | ||
95 | |||
96 | def stop (): | ||
97 | try: | ||
98 | client = subprocess.Popen ([gnunetarm, '-eq', '-c', 'confs/c_no_nat_client.conf']) | ||
99 | client.communicate () | ||
100 | except OSError: | ||
101 | print "Can not stop bootstrap client 1, exiting..." | ||
102 | exit (1) | ||
103 | vprintf ("Bootstrap client stopped") | ||
104 | 46 | ||
105 | 47 | ||
106 | def cleanup (): | 48 | def cleanup (): |
@@ -113,335 +55,122 @@ def cleanup (): | |||
113 | shutil.rmtree ("/tmp/c_no_nat_client/", True) | 55 | shutil.rmtree ("/tmp/c_no_nat_client/", True) |
114 | shutil.rmtree ("/tmp/c_no_nat_client_2/", True) | 56 | shutil.rmtree ("/tmp/c_no_nat_client_2/", True) |
115 | 57 | ||
116 | def check_statistics (conf, subsystem, name, value): | ||
117 | from gnunet_pyexpect import pexpect | ||
118 | server = pexpect () | ||
119 | server.spawn (None, [gnunetstatistics, '-c', conf ,'-q','-n', name, '-s', subsystem ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
120 | #server.expect ("stdout", re.compile (r"")) | ||
121 | test = server.read("stdout", 10240) | ||
122 | if (test.find(str(value)) == -1): | ||
123 | return False | ||
124 | else: | ||
125 | return True | ||
126 | |||
127 | |||
128 | 58 | ||
129 | def check_connect (): | 59 | def success_cont (check): |
130 | server_transport_connected = False | 60 | global success |
131 | server_topology_connected = False | 61 | success = True; |
132 | server_core_connected = False | 62 | |
133 | server_core_session_map = False | 63 | def fail_cont (check): |
134 | server_fs_connected = False | 64 | global success |
135 | client_transport_connected = False | 65 | success= False; |
136 | client_topology_connected = False | 66 | check.eval(True) |
137 | client_core_connected = False | 67 | |
138 | client_core_session_map = False | 68 | |
139 | client_fs_connected = False | 69 | def check_disconnect_client (): |
70 | test.p ('Shutting down bootstrap client') | ||
71 | client.stop () | ||
72 | check = Check (test) | ||
140 | 73 | ||
141 | client2_transport_connected = False | 74 | check.add (StatisticsCondition (client2, 'transport', '# peers connected',0)) |
142 | client2_topology_connected = False | 75 | check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',0)) |
143 | client2_core_connected = False | 76 | check.add (StatisticsCondition (client2, 'core', '# entries in session map',0)) |
144 | client2_core_session_map = False | 77 | check.add (StatisticsCondition (client2, 'topology', '# peers connected',0)) |
145 | client2_fs_connected = False | 78 | check.add (StatisticsCondition (client2, 'fs', '# peers connected',0)) |
146 | 79 | ||
147 | connected = False | 80 | check.run_blocking (check_timeout, success_cont, fail_cont) |
148 | count = 1 | ||
149 | while ((connected == False) and (count <= timeout)): | ||
150 | # Perform TRANSPORT | ||
151 | if ((False == server_transport_connected) and (True == check_statistics ('./confs/c_bootstrap_server.conf', 'transport', '# peers connected',2))): | ||
152 | server_transport_connected = True | ||
153 | vprintf ('Server transport services is connected') | ||
154 | |||
155 | if ((False == client_transport_connected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'transport', '# peers connected',2))): | ||
156 | client_transport_connected = True | ||
157 | vprintf ('Client transport services is connected') | ||
158 | |||
159 | if ((False == client2_transport_connected) and (True == check_statistics ('./confs/c_no_nat_client_2.conf', 'transport', '# peers connected',2))): | ||
160 | client2_transport_connected = True | ||
161 | vprintf ('Client 2 transport services is connected') | ||
162 | 81 | ||
163 | # Perform TRANSPORT | 82 | |
164 | if ((False == server_core_connected) and (True == check_statistics ('./confs/c_bootstrap_server.conf', 'core', '# neighbour entries allocated',2))): | 83 | def success_disconnect_server_cont (check): |
165 | server_core_connected = True | 84 | check_disconnect_client () |
166 | vprintf ('Server core services is connected') | ||
167 | |||
168 | if ((False == client_core_connected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'core', '# neighbour entries allocated',2))): | ||
169 | client_core_connected = True | ||
170 | vprintf ('Client core services is connected') | ||
171 | 85 | ||
172 | if ((False == client2_core_connected) and (True == check_statistics ('./confs/c_no_nat_client_2.conf', 'core', '# neighbour entries allocated',2))): | ||
173 | client2_core_connected = True | ||
174 | vprintf ('Client2 core services is connected') | ||
175 | |||
176 | # Perform TRANSPORT | ||
177 | if ((False == server_core_session_map) and (True == check_statistics ('./confs/c_bootstrap_server.conf', 'core', '# entries in session map',2))): | ||
178 | server_core_session_map = True | ||
179 | vprintf ('Server core services is connected') | ||
180 | |||
181 | if ((False == client_core_session_map) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'core', '# entries in session map',2))): | ||
182 | client_core_session_map = True | ||
183 | vprintf ('Client core notifies about connected') | ||
184 | 86 | ||
185 | if ((False == client2_core_session_map) and (True == check_statistics ('./confs/c_no_nat_client_2.conf', 'core', '# entries in session map',2))): | 87 | def fail_disconnect_server_cont (check): |
186 | client2_core_session_map = True | 88 | global success |
187 | vprintf ('Client2 core notifies about connected') | 89 | success= False; |
90 | check.eval(True) | ||
188 | 91 | ||
189 | # Perform TRANSPORT | 92 | |
190 | if ((False == server_topology_connected) and (True == check_statistics ('./confs/c_bootstrap_server.conf', 'topology', '# peers connected',2))): | 93 | def check_disconnect_server (): |
191 | server_topology_connected = True | 94 | test.p ('Shutting down bootstrap server') |
192 | vprintf ('Server topology services is connected') | 95 | server.stop () |
193 | 96 | check = Check (test) | |
194 | if ((False == client_topology_connected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'topology', '# peers connected',2))): | 97 | check.add (StatisticsCondition (client, 'transport', '# peers connected',1)) |
195 | client_topology_connected = True | 98 | check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',1)) |
196 | vprintf ('Client topology services is connected') | 99 | check.add (StatisticsCondition (client, 'core', '# entries in session map',1)) |
100 | check.add (StatisticsCondition (client, 'topology', '# peers connected',1)) | ||
101 | check.add (StatisticsCondition (client, 'fs', '# peers connected',1)) | ||
102 | |||
103 | check.add (StatisticsCondition (client2, 'transport', '# peers connected',1)) | ||
104 | check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',1)) | ||
105 | check.add (StatisticsCondition (client2, 'core', '# entries in session map',1)) | ||
106 | check.add (StatisticsCondition (client2, 'topology', '# peers connected',1)) | ||
107 | check.add (StatisticsCondition (client2, 'fs', '# peers connected',1)) | ||
108 | |||
109 | check.run_blocking (check_timeout, success_disconnect_server_cont, fail_disconnect_server_cont) | ||
197 | 110 | ||
198 | if ((False == client2_topology_connected) and (True == check_statistics ('./confs/c_no_nat_client_2.conf', 'topology', '# peers connected',2))): | ||
199 | client2_topology_connected = True | ||
200 | vprintf ('Client2 topology services is connected') | ||
201 | |||
202 | # Perform TRANSPORT | ||
203 | if ((False == server_fs_connected) and (True == check_statistics ('./confs/c_bootstrap_server.conf', 'fs', '# peers connected',2))): | ||
204 | server_fs_connected = True | ||
205 | vprintf ('Server fs services is connected') | ||
206 | 111 | ||
207 | if ((False == client_fs_connected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'fs', '# peers connected',2))): | 112 | def success_connect_cont (check): |
208 | client_fs_connected = True | 113 | check_disconnect_server () |
209 | vprintf ('Client fs services is connected') | ||
210 | 114 | ||
211 | if ((False == client2_fs_connected) and (True == check_statistics ('./confs/c_no_nat_client_2.conf', 'fs', '# peers connected',2))): | ||
212 | client2_fs_connected = True | ||
213 | vprintf ('Client2 fs services is connected') | ||
214 | |||
215 | # Check if conditions fulfilled | ||
216 | if ((True == client_transport_connected) and (True == client2_transport_connected) and (True == server_transport_connected) and | ||
217 | (True == client_topology_connected) and (True == client2_topology_connected) and (True == server_topology_connected) and | ||
218 | (True == client_core_connected) and (True == client2_core_connected) and (True == server_core_connected) and | ||
219 | (True == client_core_session_map) and (True == client2_core_session_map) and (True == server_core_session_map) and | ||
220 | (True == client_fs_connected) and (True == client2_fs_connected) and (True == server_fs_connected)): | ||
221 | connected = True | ||
222 | break | ||
223 | print '.', | ||
224 | time.sleep(1) | ||
225 | count += 1 | ||
226 | if (connected == False): | ||
227 | print '' | ||
228 | if (server_transport_connected == False): | ||
229 | print ('Server transport was NOT connected') | ||
230 | if (server_topology_connected == False): | ||
231 | print ('Server topology was NOT connected') | ||
232 | if (server_core_connected == False): | ||
233 | print ('Server core was NOT connected') | ||
234 | if (server_core_session_map == False): | ||
235 | print ('Server core sessions did NOT increase') | ||
236 | |||
237 | if (client_transport_connected == False): | ||
238 | print ('Client transport was NOT connected') | ||
239 | if (client_topology_connected == False): | ||
240 | print ('Client topology was NOT connected') | ||
241 | if (client_core_connected == False): | ||
242 | print ('Client core was NOT connected') | ||
243 | if (client_core_session_map == False): | ||
244 | print ('Client core sessions did NOT increase') | ||
245 | |||
246 | if (client2_transport_connected == False): | ||
247 | print ('Client2 transport was NOT connected') | ||
248 | if (client2_topology_connected == False): | ||
249 | print ('Client2 topology was NOT connected') | ||
250 | if (client2_core_connected == False): | ||
251 | print ('Client2 core was NOT connected') | ||
252 | if (client2_core_session_map == False): | ||
253 | print ('Client2 core sessions did NOT increase') | ||
254 | return False | ||
255 | else: | ||
256 | return True | ||
257 | 115 | ||
258 | def check_disconnect_client (): | 116 | def fail_connect_cont (check): |
259 | vprintf ("Shutting down client 2") | 117 | global success |
260 | try: | 118 | success= False; |
261 | server = subprocess.Popen ([gnunetarm, '-eq', '-c', './confs/c_no_nat_client_2.conf']) | 119 | check.eval(True) |
262 | server.communicate () | ||
263 | except OSError: | ||
264 | print "Can not stop client 2, exiting..." | ||
265 | exit (1) | ||
266 | |||
267 | client_transport_disconnected = False | ||
268 | client_topology_disconnected = False | ||
269 | client_core_disconnected = False | ||
270 | client_core_session_map = False | ||
271 | client_fs_disconnected = False | ||
272 | |||
273 | disconnected = False | ||
274 | count = 1 | ||
275 | while ((disconnected == False) and (count <= timeout)): | ||
276 | if ((False == client_transport_disconnected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'transport', '# peers connected',0))): | ||
277 | client_transport_disconnected = True | ||
278 | vprintf ('Client transport services is disconnected') | ||
279 | |||
280 | if ((False == client_core_disconnected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'core', '# neighbour entries allocated',0))): | ||
281 | client_core_disconnected = True | ||
282 | vprintf ('Client core services is disconnected') | ||
283 | |||
284 | if ((False == client_core_session_map) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'core', '# entries in session map',0))): | ||
285 | client_core_session_map = True | ||
286 | vprintf ('Client core notifies about disconnected') | ||
287 | |||
288 | if ((False == client_topology_disconnected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'topology', '# peers connected',0))): | ||
289 | client_topology_disconnected = True | ||
290 | vprintf ('Client topology services is disconnected') | ||
291 | |||
292 | if ((False == client_fs_disconnected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'fs', '# peers connected',0))): | ||
293 | client_fs_disconnected = True | ||
294 | vprintf ('Client fs services is disconnected') | ||
295 | |||
296 | # Check if conditions fulfilled | ||
297 | if ((True == client_transport_disconnected) and | ||
298 | (True == client_topology_disconnected) and | ||
299 | (True == client_core_disconnected) and | ||
300 | (True == client_core_session_map) and | ||
301 | (True == client_fs_disconnected)): | ||
302 | disconnected = True | ||
303 | break | ||
304 | print '.', | ||
305 | time.sleep(1) | ||
306 | count += 1 | ||
307 | if (disconnected == False): | ||
308 | print '' | ||
309 | if (client_transport_disconnected == False): | ||
310 | print ('Client transport was NOT disconnected') | ||
311 | if (client_topology_disconnected == False): | ||
312 | print ('Client topology was NOT disconnected') | ||
313 | if (client_core_disconnected == False): | ||
314 | print ('Client core was NOT disconnected') | ||
315 | if (client_core_session_map == False): | ||
316 | print ('Server core sessions did NOT increase') | ||
317 | return False | ||
318 | else: | ||
319 | return True | ||
320 | |||
321 | def check_disconnect_server (): | ||
322 | vprintf ("Shutting down bootstrap server") | ||
323 | try: | ||
324 | server = subprocess.Popen ([gnunetarm, '-eq', '-c', './confs/c_bootstrap_server.conf']) | ||
325 | server.communicate () | ||
326 | except OSError: | ||
327 | print "Can not stop bootstrap server, exiting..." | ||
328 | exit (1) | ||
329 | |||
330 | client_transport_disconnected = False | ||
331 | client_topology_disconnected = False | ||
332 | client_core_disconnected = False | ||
333 | client_core_session_map = False | ||
334 | client_fs_disconnected = False | ||
335 | 120 | ||
336 | client2_transport_disconnected = False | ||
337 | client2_topology_disconnected = False | ||
338 | client2_core_disconnected = False | ||
339 | client2_core_session_map = False | ||
340 | client2_fs_disconnected = False | ||
341 | |||
342 | disconnected = False | ||
343 | count = 1 | ||
344 | while ((disconnected == False) and (count <= timeout)): | ||
345 | if ((False == client_transport_disconnected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'transport', '# peers connected',1))): | ||
346 | client_transport_disconnected = True | ||
347 | vprintf ('Client transport services is disconnected') | ||
348 | |||
349 | if ((False == client_core_disconnected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'core', '# neighbour entries allocated',1))): | ||
350 | client_core_disconnected = True | ||
351 | vprintf ('Client core services is disconnected') | ||
352 | |||
353 | if ((False == client_core_session_map) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'core', '# entries in session map',1))): | ||
354 | client_core_session_map = True | ||
355 | vprintf ('Client core notifies about disconnected') | ||
356 | |||
357 | if ((False == client_topology_disconnected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'topology', '# peers connected',1))): | ||
358 | client_topology_disconnected = True | ||
359 | vprintf ('Client topology services is disconnected') | ||
360 | |||
361 | if ((False == client_fs_disconnected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'fs', '# peers connected',1))): | ||
362 | client_fs_disconnected = True | ||
363 | vprintf ('Client fs services is disconnected') | ||
364 | 121 | ||
365 | if ((False == client2_transport_disconnected) and (True == check_statistics ('./confs/c_no_nat_client_2.conf', 'transport', '# peers connected',1))): | 122 | def check_connect (): |
366 | client2_transport_disconnected = True | 123 | check = Check (test) |
367 | vprintf ('Client2 transport services is disconnected') | 124 | check.add (StatisticsCondition (client, 'transport', '# peers connected',2)) |
368 | 125 | check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',2)) | |
369 | if ((False == client2_core_disconnected) and (True == check_statistics ('./confs/c_no_nat_client_2.conf', 'core', '# neighbour entries allocated',1))): | 126 | check.add (StatisticsCondition (client, 'core', '# entries in session map',2)) |
370 | client2_core_disconnected = True | 127 | check.add (StatisticsCondition (client, 'topology', '# peers connected',2)) |
371 | vprintf ('Client2 core services is disconnected') | 128 | check.add (StatisticsCondition (client, 'fs', '# peers connected',2)) |
372 | 129 | ||
373 | if ((False == client2_core_session_map) and (True == check_statistics ('./confs/c_no_nat_client_2.conf', 'core', '# entries in session map',1))): | 130 | check.add (StatisticsCondition (client2, 'transport', '# peers connected',2)) |
374 | client2_core_session_map = True | 131 | check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',2)) |
375 | vprintf ('Client2 core notifies about disconnected') | 132 | check.add (StatisticsCondition (client2, 'core', '# entries in session map',2)) |
376 | 133 | check.add (StatisticsCondition (client2, 'topology', '# peers connected',2)) | |
377 | if ((False == client2_topology_disconnected) and (True == check_statistics ('./confs/c_no_nat_client_2.conf', 'topology', '# peers connected',1))): | 134 | check.add (StatisticsCondition (client2, 'fs', '# peers connected',2)) |
378 | client2_topology_disconnected = True | 135 | |
379 | vprintf ('Client2 topology services is disconnected') | 136 | check.add (StatisticsCondition (server, 'transport', '# peers connected',2)) |
380 | 137 | check.add (StatisticsCondition (server, 'core', '# neighbour entries allocated',2)) | |
381 | if ((False == client2_fs_disconnected) and (True == check_statistics ('./confs/c_no_nat_client_2.conf', 'fs', '# peers connected',1))): | 138 | check.add (StatisticsCondition (server, 'core', '# entries in session map',2)) |
382 | client2_fs_disconnected = True | 139 | check.add (StatisticsCondition (server, 'topology', '# peers connected',2)) |
383 | vprintf ('Client2 fs services is disconnected') | 140 | check.add (StatisticsCondition (server, 'fs', '# peers connected',2)) |
384 | 141 | ||
385 | 142 | check.run_blocking (check_timeout, success_connect_cont, fail_connect_cont) | |
386 | # Check if conditions fulfilled | ||
387 | if ((True == client_transport_disconnected) and | ||
388 | (True == client_topology_disconnected) and | ||
389 | (True == client_core_disconnected) and | ||
390 | (True == client_core_session_map) and | ||
391 | (True == client_fs_disconnected) and | ||
392 | (True == client2_transport_disconnected) and | ||
393 | (True == client2_topology_disconnected) and | ||
394 | (True == client2_core_disconnected) and | ||
395 | (True == client2_core_session_map) and | ||
396 | (True == client2_fs_disconnected)): | ||
397 | disconnected = True | ||
398 | #break | ||
399 | print '.' | ||
400 | time.sleep(1) | ||
401 | count += 1 | ||
402 | if (disconnected == False): | ||
403 | print '' | ||
404 | if (client_transport_disconnected == False): | ||
405 | print ('Client transport was NOT disconnected') | ||
406 | if (client_topology_disconnected == False): | ||
407 | print ('Client topology was NOT disconnected') | ||
408 | if (client_core_disconnected == False): | ||
409 | print ('Client core was NOT disconnected') | ||
410 | if (client_core_session_map == False): | ||
411 | print ('Client core sessions did NOT decrease') | ||
412 | if (client2_transport_disconnected == False): | ||
413 | print ('Client2 transport was NOT disconnected') | ||
414 | if (client2_topology_disconnected == False): | ||
415 | print ('Client2 topology was NOT disconnected') | ||
416 | if (client2_core_disconnected == False): | ||
417 | print ('Client2 core was NOT disconnected') | ||
418 | if (client2_core_session_map == False): | ||
419 | print ('Client2 core sessions did NOT decrease') | ||
420 | return False | ||
421 | else: | ||
422 | return True | ||
423 | 143 | ||
424 | # | 144 | # |
425 | # Test execution | 145 | # Test execution |
426 | # | 146 | # |
427 | 147 | ||
428 | vprintf ("Running " + testname) | 148 | success = False |
429 | setup () | 149 | |
430 | start () | 150 | test = Test ('test_integration_disconnect', verbose) |
431 | 151 | ||
432 | ret = check_connect () | 152 | server = Peer(test, './confs/c_bootstrap_server.conf'); |
433 | if (ret == True): | 153 | server.start(); |
434 | vprintf ('Peers connected') | 154 | |
435 | if (True == check_disconnect_server ()): | 155 | client = Peer(test, './confs/c_no_nat_client.conf'); |
436 | if (True == check_disconnect_client ()): | 156 | client.start(); |
437 | success = True | 157 | |
158 | client2 = Peer(test, './confs/c_no_nat_client_2.conf'); | ||
159 | client2.start(); | ||
160 | |||
161 | if ((client.started == True) and (client2.started == True) and (server.started == True)): | ||
162 | test.p ('Peers started, running check') | ||
163 | check_connect () | ||
164 | |||
165 | server.stop () | ||
166 | client.stop () | ||
167 | client2.stop () | ||
438 | 168 | ||
439 | stop () | ||
440 | cleanup () | 169 | cleanup () |
441 | 170 | ||
442 | if (success == False): | 171 | if (success == False): |
443 | print ('Test failed') | 172 | print ('Test failed') |
444 | exit (1) | 173 | exit (1) |
445 | else: | 174 | else: |
446 | exit (0) | 175 | exit (0) |
447 | 176 | ||