diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-12-16 14:49:27 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-12-16 14:49:27 +0000 |
commit | 552cdae90b8f2da2c38689a39636452c19205919 (patch) | |
tree | af0364663885c05b7c6573712e67c2c55c3ec866 /src/integration-tests | |
parent | c0411452aa4c4473fb217252eede77e1a6c0d563 (diff) | |
download | gnunet-552cdae90b8f2da2c38689a39636452c19205919.tar.gz gnunet-552cdae90b8f2da2c38689a39636452c19205919.zip |
adding nat clique test
Diffstat (limited to 'src/integration-tests')
-rw-r--r-- | src/integration-tests/Makefile.am | 11 | ||||
-rw-r--r-- | src/integration-tests/confs/c_nat_client.conf | 343 | ||||
-rwxr-xr-x | src/integration-tests/test_integration_clique_nat.py.in | 197 |
3 files changed, 549 insertions, 2 deletions
diff --git a/src/integration-tests/Makefile.am b/src/integration-tests/Makefile.am index 1e5686bf8..b9f6b4c56 100644 --- a/src/integration-tests/Makefile.am +++ b/src/integration-tests/Makefile.am | |||
@@ -21,7 +21,8 @@ check_SCRIPTS = \ | |||
21 | test_integration_bootstrap_and_connect.py \ | 21 | test_integration_bootstrap_and_connect.py \ |
22 | test_integration_disconnect.py \ | 22 | test_integration_disconnect.py \ |
23 | test_integration_restart.py \ | 23 | test_integration_restart.py \ |
24 | test_integration_clique.py | 24 | test_integration_clique.py \ |
25 | test_integration_clique_nat.py | ||
25 | endif | 26 | endif |
26 | 27 | ||
27 | 28 | ||
@@ -52,12 +53,18 @@ test_integration_clique.py: test_integration_clique.py.in Makefile | |||
52 | $(do_subst) < $(srcdir)/test_integration_clique.py.in > test_integration_clique.py | 53 | $(do_subst) < $(srcdir)/test_integration_clique.py.in > test_integration_clique.py |
53 | chmod +x test_integration_clique.py | 54 | chmod +x test_integration_clique.py |
54 | 55 | ||
56 | test_integration_clique_nat.py: test_integration_clique_nat.py.in Makefile | ||
57 | $(do_subst) < $(srcdir)/test_integration_clique_nat.py.in > test_integration_clique_nat.py | ||
58 | chmod +x test_integration_clique_nat.py | ||
59 | |||
60 | |||
55 | EXTRA_DIST = \ | 61 | EXTRA_DIST = \ |
56 | gnunet_testing.py.in \ | 62 | gnunet_testing.py.in \ |
57 | test_integration_bootstrap_and_connect.py.in \ | 63 | test_integration_bootstrap_and_connect.py.in \ |
58 | test_integration_disconnect.py.in \ | 64 | test_integration_disconnect.py.in \ |
59 | test_integration_restart.py.in \ | 65 | test_integration_restart.py.in \ |
60 | test_integration_clique.py.in | 66 | test_integration_clique.py.in \ |
67 | test_integration_clique_nat.py.in | ||
61 | 68 | ||
62 | CLEANFILES = \ | 69 | CLEANFILES = \ |
63 | $(check_SCRIPTS) \ | 70 | $(check_SCRIPTS) \ |
diff --git a/src/integration-tests/confs/c_nat_client.conf b/src/integration-tests/confs/c_nat_client.conf index e69de29bb..d23c4d57b 100644 --- a/src/integration-tests/confs/c_nat_client.conf +++ b/src/integration-tests/confs/c_nat_client.conf | |||
@@ -0,0 +1,343 @@ | |||
1 | [PATHS] | ||
2 | SERVICEHOME = /tmp/c_nat_client | ||
3 | DEFAULTCONFIG = confs/c_nat_client.conf | ||
4 | |||
5 | [gnunetd] | ||
6 | HOSTKEY = hostkeys/0002-hostkey | ||
7 | |||
8 | [client] | ||
9 | HOME = $SERVICEHOME | ||
10 | |||
11 | |||
12 | [resolver] | ||
13 | AUTOSTART = YES | ||
14 | PORT = 20071 | ||
15 | HOSTNAME = localhost | ||
16 | HOME = $SERVICEHOME | ||
17 | CONFIG = $DEFAULTCONFIG | ||
18 | BINARY = gnunet-service-resolver | ||
19 | ACCEPT_FROM = 127.0.0.1; | ||
20 | ACCEPT_FROM6 = ::1; | ||
21 | UNIXPATH = /tmp/test-service-resolver-56 | ||
22 | UNIX_MATCH_UID = NO | ||
23 | UNIX_MATCH_GID = NO | ||
24 | |||
25 | [mesh] | ||
26 | AUTOSTART = YES | ||
27 | PORT = 20070 | ||
28 | HOSTNAME = localhost | ||
29 | HOME = $SERVICEHOME | ||
30 | CONFIG = $DEFAULTCONFIG | ||
31 | BINARY = gnunet-service-mesh | ||
32 | ACCEPT_FROM = 127.0.0.1; | ||
33 | ACCEPT_FROM6 = ::1; | ||
34 | UNIXPATH = /tmp/test-service-mesh-55 | ||
35 | UNIX_MATCH_UID = YES | ||
36 | UNIX_MATCH_GID = YES | ||
37 | |||
38 | [nse] | ||
39 | AUTOSTART = YES | ||
40 | PORT = 20069 | ||
41 | HOSTNAME = localhost | ||
42 | HOME = $SERVICEHOME | ||
43 | CONFIG = $DEFAULTCONFIG | ||
44 | BINARY = gnunet-service-nse | ||
45 | ACCEPT_FROM = 127.0.0.1; | ||
46 | ACCEPT_FROM6 = ::1; | ||
47 | UNIXPATH = /tmp/test-service-nse-54 | ||
48 | UNIX_MATCH_UID = YES | ||
49 | UNIX_MATCH_GID = YES | ||
50 | PROOFFILE = $SERVICEHOME/.nse-proof | ||
51 | HISTOGRAM = $SERVICEHOME/nse-history.log | ||
52 | WORKDELAY = 5 ms | ||
53 | INTERVAL = 1 h | ||
54 | WORKBITS = 26 | ||
55 | |||
56 | [topology] | ||
57 | MINIMUM-FRIENDS = 0 | ||
58 | FRIENDS-ONLY = NO | ||
59 | AUTOCONNECT = YES | ||
60 | TARGET-CONNECTION-COUNT = 16 | ||
61 | FRIENDS = $SERVICEHOME/friends | ||
62 | CONFIG = $DEFAULTCONFIG | ||
63 | BINARY = gnunet-daemon-topology | ||
64 | |||
65 | [datastore] | ||
66 | AUTOSTART = YES | ||
67 | UNIXPATH = /tmp/test-service-datastore-53 | ||
68 | UNIX_MATCH_UID = YES | ||
69 | UNIX_MATCH_GID = YES | ||
70 | PORT = 20068 | ||
71 | HOSTNAME = localhost | ||
72 | HOME = $SERVICEHOME | ||
73 | CONFIG = $DEFAULTCONFIG | ||
74 | BINARY = gnunet-service-datastore | ||
75 | ACCEPT_FROM = 127.0.0.1; | ||
76 | ACCEPT_FROM6 = ::1; | ||
77 | QUOTA = 100 MB | ||
78 | BLOOMFILTER = $SERVICEHOME/fs/bloomfilter | ||
79 | DATABASE = sqlite | ||
80 | |||
81 | [datastore-sqlite] | ||
82 | FILENAME = $SERVICEHOME/datastore/sqlite.db | ||
83 | |||
84 | [datastore-postgres] | ||
85 | CONFIG = connect_timeout=10; dbname=gnunet | ||
86 | |||
87 | [datastore-mysql] | ||
88 | DATABASE = gnunet | ||
89 | CONFIG = ~/.my.cnf | ||
90 | |||
91 | [peerinfo] | ||
92 | AUTOSTART = YES | ||
93 | PORT = 20067 | ||
94 | HOSTNAME = localhost | ||
95 | HOME = $SERVICEHOME | ||
96 | CONFIG = $DEFAULTCONFIG | ||
97 | BINARY = gnunet-service-peerinfo | ||
98 | ACCEPT_FROM = 127.0.0.1; | ||
99 | ACCEPT_FROM6 = ::1; | ||
100 | UNIXPATH = /tmp/test-service-peerinfo-52 | ||
101 | UNIX_MATCH_UID = NO | ||
102 | UNIX_MATCH_GID = YES | ||
103 | HOSTS = $SERVICEHOME/data/hosts/ | ||
104 | |||
105 | [TESTING] | ||
106 | WEAKRANDOM = NO | ||
107 | CONNECT_TIMEOUT = 30 s | ||
108 | CONNECT_ATTEMPTS = 3 | ||
109 | MAX_OUTSTANDING_CONNECTIONS = 50 | ||
110 | DELETE_FILES = YES | ||
111 | |||
112 | [ats] | ||
113 | AUTOSTART = YES | ||
114 | PORT = 20066 | ||
115 | HOSTNAME = localhost | ||
116 | HOME = $SERVICEHOME | ||
117 | CONFIG = $DEFAULTCONFIG | ||
118 | BINARY = gnunet-service-ats | ||
119 | ACCEPT_FROM = 127.0.0.1; | ||
120 | ACCEPT_FROM6 = ::1; | ||
121 | UNIXPATH = /tmp/test-service-ats-51 | ||
122 | UNIX_MATCH_UID = YES | ||
123 | UNIX_MATCH_GID = YES | ||
124 | WAN_QUOTA_IN = 65536 | ||
125 | WAN_QUOTA_OUT = 65536 | ||
126 | DUMP_MLP = NO | ||
127 | DUMP_SOLUTION = NO | ||
128 | DUMP_OVERWRITE = NO | ||
129 | DUMP_MIN_PEERS = 0 | ||
130 | DUMP_MIN_ADDRS = 0 | ||
131 | ATS_MIN_INTERVAL = 15000 | ||
132 | ATS_EXEC_INTERVAL = 30000 | ||
133 | |||
134 | [transport] | ||
135 | AUTOSTART = YES | ||
136 | PORT = 20065 | ||
137 | HOSTNAME = localhost | ||
138 | HOME = $SERVICEHOME | ||
139 | CONFIG = $DEFAULTCONFIG | ||
140 | BINARY = gnunet-service-transport | ||
141 | NEIGHBOUR_LIMIT = 50 | ||
142 | ACCEPT_FROM = 127.0.0.1; | ||
143 | ACCEPT_FROM6 = ::1; | ||
144 | PLUGINS = tcp | ||
145 | UNIXPATH = /tmp/test-service-transport-50 | ||
146 | BLACKLIST_FILE = $SERVICEHOME/blacklist | ||
147 | UNIX_MATCH_UID = YES | ||
148 | UNIX_MATCH_GID = YES | ||
149 | |||
150 | [transport-tcp] | ||
151 | PORT = 0 | ||
152 | ADVERTISED_PORT = 20064 | ||
153 | MAX_CONNECTIONS = 128 | ||
154 | TIMEOUT = 5 s | ||
155 | USE_LOCALADDR = YES | ||
156 | |||
157 | [transport-udp] | ||
158 | PORT = 0 | ||
159 | BROADCAST = YES | ||
160 | BROADCAST_INTERVAL = 30000 | ||
161 | MAX_BPS = 1000000 | ||
162 | USE_LOCALADDR = YES | ||
163 | |||
164 | [transport-http] | ||
165 | PORT = 0 | ||
166 | MAX_CONNECTIONS = 128 | ||
167 | |||
168 | [transport-https] | ||
169 | PORT = 0 | ||
170 | CRYPTO_INIT = NORMAL | ||
171 | KEY_FILE = https.key | ||
172 | CERT_FILE = https.cert | ||
173 | MAX_CONNECTIONS = 128 | ||
174 | |||
175 | [transport-wlan] | ||
176 | INTERFACE = mon0 | ||
177 | TESTMODE = 0 | ||
178 | |||
179 | [datacache-mysql] | ||
180 | DATABASE = gnunet | ||
181 | CONFIG = ~/.my.cnf | ||
182 | |||
183 | [datacache-postgres] | ||
184 | CONFIG = connect_timeout=10; dbname=gnunet | ||
185 | |||
186 | [template] | ||
187 | AUTOSTART = NO | ||
188 | PORT = 20060 | ||
189 | HOSTNAME = localhost | ||
190 | HOME = $SERVICEHOME | ||
191 | CONFIG = $DEFAULTCONFIG | ||
192 | BINARY = gnunet-service-template | ||
193 | ACCEPT_FROM = 127.0.0.1; | ||
194 | ACCEPT_FROM6 = ::1; | ||
195 | UNIXPATH = /tmp/test-service-template-49 | ||
196 | UNIX_MATCH_UID = YES | ||
197 | UNIX_MATCH_GID = YES | ||
198 | |||
199 | [fs] | ||
200 | AUTOSTART = YES | ||
201 | INDEXDB = $SERVICEHOME/idxinfo.lst | ||
202 | TRUST = $SERVICEHOME/data/credit/ | ||
203 | IDENTITY_DIR = $SERVICEHOME/identities/ | ||
204 | STATE_DIR = $SERVICEHOME/persistence/ | ||
205 | UPDATE_DIR = $SERVICEHOME/updates/ | ||
206 | PORT = 20059 | ||
207 | HOSTNAME = localhost | ||
208 | HOME = $SERVICEHOME | ||
209 | CONFIG = $DEFAULTCONFIG | ||
210 | BINARY = gnunet-service-fs | ||
211 | ACCEPT_FROM = 127.0.0.1; | ||
212 | ACCEPT_FROM6 = ::1; | ||
213 | DELAY = YES | ||
214 | CONTENT_CACHING = YES | ||
215 | CONTENT_PUSHING = YES | ||
216 | UNIXPATH = /tmp/test-service-fs-48 | ||
217 | UNIX_MATCH_UID = NO | ||
218 | UNIX_MATCH_GID = YES | ||
219 | MAX_PENDING_REQUESTS = 65536 | ||
220 | MIN_MIGRATION_DELAY = 100 ms | ||
221 | EXPECTED_NEIGHBOUR_COUNT = 128 | ||
222 | |||
223 | [vpn] | ||
224 | CONFIG = $DEFAULTCONFIG | ||
225 | BINARY = gnunet-daemon-vpn | ||
226 | IPV6ADDR = 1234::1 | ||
227 | IPV6PREFIX = 32 | ||
228 | IPV4ADDR = 10.11.10.1 | ||
229 | IPV4MASK = 255.255.0.0 | ||
230 | VIRTDNS = 10.11.10.2 | ||
231 | VIRTDNS6 = 1234::17 | ||
232 | IFNAME = vpn-gnunet | ||
233 | |||
234 | [exit] | ||
235 | CONFIG = $DEFAULTCONFIG | ||
236 | BINARY = gnunet-daemon-exit | ||
237 | IPV6ADDR = 1234:1::1 | ||
238 | IPV6PREFIX = 32 | ||
239 | IPV4ADDR = 10.10.1.1 | ||
240 | IPV4MASK = 255.255.0.0 | ||
241 | IFNAME = exit-gnunet | ||
242 | ENABLE_UDP = NO | ||
243 | ENABLE_TCP = NO | ||
244 | |||
245 | [dns] | ||
246 | AUTOSTART = YES | ||
247 | PORT = 0 | ||
248 | HOSTNAME = localhost | ||
249 | HOME = $SERVICEHOME | ||
250 | CONFIG = $DEFAULTCONFIG | ||
251 | BINARY = gnunet-service-dns | ||
252 | ACCEPT_FROM = 127.0.0.1; | ||
253 | ACCEPT_FROM6 = ::1; | ||
254 | UNIXPATH = /tmp/test-service-dns-47 | ||
255 | PROVIDE_EXIT = NO | ||
256 | |||
257 | [arm] | ||
258 | PORT = 20058 | ||
259 | HOSTNAME = localhost | ||
260 | HOME = $SERVICEHOME | ||
261 | CONFIG = $DEFAULTCONFIG | ||
262 | BINARY = gnunet-service-arm | ||
263 | ACCEPT_FROM = 127.0.0.1; | ||
264 | ACCEPT_FROM6 = ::1; | ||
265 | DEFAULTSERVICES = topology hostlist | ||
266 | UNIXPATH = /tmp/test-service-arm-46 | ||
267 | UNIX_MATCH_UID = YES | ||
268 | UNIX_MATCH_GID = YES | ||
269 | |||
270 | [hostlist] | ||
271 | HTTPPORT = 8080 | ||
272 | HOME = $SERVICEHOME | ||
273 | HOSTLISTFILE = $SERVICEHOME/hostlist/learned.data | ||
274 | CONFIG = $DEFAULTCONFIG | ||
275 | BINARY = gnunet-daemon-hostlist | ||
276 | OPTIONS = -b | ||
277 | SERVERS = http://v9.gnunet.org:58080/ | ||
278 | HTTP-PROXY = | ||
279 | |||
280 | [core] | ||
281 | AUTOSTART = YES | ||
282 | PORT = 20057 | ||
283 | HOSTNAME = localhost | ||
284 | HOME = $SERVICEHOME | ||
285 | CONFIG = $DEFAULTCONFIG | ||
286 | BINARY = gnunet-service-core | ||
287 | ACCEPT_FROM = 127.0.0.1; | ||
288 | ACCEPT_FROM6 = ::1; | ||
289 | UNIXPATH = /tmp/test-service-core-45 | ||
290 | UNIX_MATCH_UID = YES | ||
291 | UNIX_MATCH_GID = YES | ||
292 | |||
293 | [nat] | ||
294 | BEHIND_NAT = YES | ||
295 | PUNCHED_NAT = NO | ||
296 | ENABLE_UPNP = NO | ||
297 | USE_LOCALADDR = YES | ||
298 | USE_HOSTNAME = NO | ||
299 | ENABLE_ICMP_CLIENT = NO | ||
300 | ENABLE_ICMP_SERVER = NO | ||
301 | DISABLEV6 = YES | ||
302 | RETURN_LOCAL_ADDRESSES = NO | ||
303 | HOSTNAME_DNS_FREQUENCY = 1200000 | ||
304 | IFC_SCAN_FREQUENCY = 3000000 | ||
305 | DYNDNS_FREQUENCY = 140000 | ||
306 | EXTERNAL_ADDRESS = 127.0.0.1 | ||
307 | INTERNAL_ADDRESS = 127.0.0.1 | ||
308 | BINDTO = 127.0.0.1 | ||
309 | |||
310 | [gnunet-nat-server] | ||
311 | HOSTNAME = gnunet.org | ||
312 | PORT = 20056 | ||
313 | |||
314 | [statistics] | ||
315 | AUTOSTART = YES | ||
316 | PORT = 20055 | ||
317 | HOSTNAME = localhost | ||
318 | HOME = $SERVICEHOME | ||
319 | CONFIG = $DEFAULTCONFIG | ||
320 | BINARY = gnunet-service-statistics | ||
321 | ACCEPT_FROM = 127.0.0.1; | ||
322 | ACCEPT_FROM6 = ::1; | ||
323 | UNIXPATH = /tmp/test-service-statistics-44 | ||
324 | UNIX_MATCH_UID = NO | ||
325 | UNIX_MATCH_GID = YES | ||
326 | |||
327 | [dht] | ||
328 | AUTOSTART = YES | ||
329 | PORT = 20054 | ||
330 | HOSTNAME = localhost | ||
331 | HOME = $SERVICEHOME | ||
332 | CONFIG = $DEFAULTCONFIG | ||
333 | BINARY = gnunet-service-dht | ||
334 | ACCEPT_FROM = 127.0.0.1; | ||
335 | ACCEPT_FROM6 = ::1; | ||
336 | BUCKET_SIZE = 4 | ||
337 | UNIXPATH = /tmp/test-service-dht-43 | ||
338 | UNIX_MATCH_UID = YES | ||
339 | UNIX_MATCH_GID = YES | ||
340 | |||
341 | [dhtcache] | ||
342 | DATABASE = sqlite | ||
343 | QUOTA = 1 MB \ No newline at end of file | ||
diff --git a/src/integration-tests/test_integration_clique_nat.py.in b/src/integration-tests/test_integration_clique_nat.py.in new file mode 100755 index 000000000..6e6d4e505 --- /dev/null +++ b/src/integration-tests/test_integration_clique_nat.py.in | |||
@@ -0,0 +1,197 @@ | |||
1 | #!@PYTHON@ | ||
2 | # This file is part of GNUnet. | ||
3 | # (C) 2010 Christian Grothoff (and other contributing authors) | ||
4 | # | ||
5 | # GNUnet is free software; you can redistribute it and/or modify | ||
6 | # it under the terms of the GNU General Public License as published | ||
7 | # by the Free Software Foundation; either version 2, or (at your | ||
8 | # option) any later version. | ||
9 | # | ||
10 | # GNUnet is distributed in the hope that it will be useful, but | ||
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | # General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License | ||
16 | # along with GNUnet; see the file COPYING. If not, write to the | ||
17 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | # Boston, MA 02111-1307, USA. | ||
19 | # | ||
20 | # | ||
21 | # | ||
22 | # This test starts 3 peers (1 bootstrap server, 1 not nat'ed peer, 1 nat'ed peer) | ||
23 | # and expects bootstrap and a connected clique | ||
24 | # | ||
25 | # Conditions for successful exit: | ||
26 | # Both peers have 1 connected peer in transport, core, topology, fs | ||
27 | |||
28 | import sys | ||
29 | import os | ||
30 | import subprocess | ||
31 | import re | ||
32 | import shutil | ||
33 | import time | ||
34 | import pexpect | ||
35 | from gnunet_testing import Peer | ||
36 | from gnunet_testing import Test | ||
37 | from gnunet_testing import Check | ||
38 | from gnunet_testing import Condition | ||
39 | from gnunet_testing import * | ||
40 | |||
41 | |||
42 | #definitions | ||
43 | testname = "test_integration_clique_nat" | ||
44 | verbose = False | ||
45 | check_timeout = 120 | ||
46 | |||
47 | |||
48 | def cleanup (): | ||
49 | if os.name == "nt": | ||
50 | shutil.rmtree (os.path.join (os.getenv ("TEMP"), "c_bootstrap_server"), True) | ||
51 | shutil.rmtree (os.path.join (os.getenv ("TEMP"), "c_no_nat_client"), True) | ||
52 | shutil.rmtree (os.path.join (os.getenv ("TEMP"), "c_nat_client"), True) | ||
53 | else: | ||
54 | shutil.rmtree ("/tmp/c_bootstrap_server/", True) | ||
55 | shutil.rmtree ("/tmp/c_no_nat_client/", True) | ||
56 | shutil.rmtree ("/tmp/c_nat_client/", True) | ||
57 | |||
58 | |||
59 | def success_cont (check): | ||
60 | global success | ||
61 | success = True; | ||
62 | |||
63 | def fail_cont (check): | ||
64 | global success | ||
65 | success= False; | ||
66 | check.eval(True) | ||
67 | |||
68 | |||
69 | def check_disconnect_client (): | ||
70 | test.p ('Shutting down bootstrap client') | ||
71 | client.stop () | ||
72 | check = Check (test) | ||
73 | |||
74 | check.add (StatisticsCondition (client2, 'transport', '# peers connected',0)) | ||
75 | check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',0)) | ||
76 | check.add (StatisticsCondition (client2, 'core', '# entries in session map',0)) | ||
77 | check.add (StatisticsCondition (client2, 'topology', '# peers connected',0)) | ||
78 | check.add (StatisticsCondition (client2, 'fs', '# peers connected',0)) | ||
79 | |||
80 | check.run_blocking (check_timeout, success_cont, fail_cont) | ||
81 | |||
82 | |||
83 | def success_disconnect_server_cont (check): | ||
84 | check_disconnect_client () | ||
85 | |||
86 | |||
87 | def fail_disconnect_server_cont (check): | ||
88 | global success | ||
89 | success= False; | ||
90 | check.eval(True) | ||
91 | |||
92 | |||
93 | def check_disconnect_server (): | ||
94 | test.p ('Shutting down bootstrap server') | ||
95 | server.stop () | ||
96 | check = Check (test) | ||
97 | check.add (StatisticsCondition (client, 'transport', '# peers connected',1)) | ||
98 | check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',1)) | ||
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) | ||
110 | |||
111 | |||
112 | def success_connect_cont (check): | ||
113 | check_disconnect_server () | ||
114 | |||
115 | |||
116 | def fail_connect_cont (check): | ||
117 | global success | ||
118 | success= False; | ||
119 | check.eval(True) | ||
120 | |||
121 | |||
122 | def check_connect (): | ||
123 | check = Check (test) | ||
124 | check.add (StatisticsCondition (client, 'transport', '# peers connected',2)) | ||
125 | check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',2)) | ||
126 | check.add (StatisticsCondition (client, 'core', '# entries in session map',2)) | ||
127 | check.add (StatisticsCondition (client, 'topology', '# peers connected',2)) | ||
128 | check.add (StatisticsCondition (client, 'fs', '# peers connected',2)) | ||
129 | |||
130 | check.add (StatisticsCondition (client2, 'transport', '# peers connected',2)) | ||
131 | check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',2)) | ||
132 | check.add (StatisticsCondition (client2, 'core', '# entries in session map',2)) | ||
133 | check.add (StatisticsCondition (client2, 'topology', '# peers connected',2)) | ||
134 | check.add (StatisticsCondition (client2, 'fs', '# peers connected',2)) | ||
135 | |||
136 | check.add (StatisticsCondition (server, 'transport', '# peers connected',2)) | ||
137 | check.add (StatisticsCondition (server, 'core', '# neighbour entries allocated',2)) | ||
138 | check.add (StatisticsCondition (server, 'core', '# entries in session map',2)) | ||
139 | check.add (StatisticsCondition (server, 'topology', '# peers connected',2)) | ||
140 | check.add (StatisticsCondition (server, 'fs', '# peers connected',2)) | ||
141 | |||
142 | check.run_blocking (check_timeout, success_connect_cont, fail_connect_cont) | ||
143 | |||
144 | # | ||
145 | # Test execution | ||
146 | # | ||
147 | def run (): | ||
148 | global success | ||
149 | global test | ||
150 | global server | ||
151 | global client | ||
152 | global client2 | ||
153 | |||
154 | success = False | ||
155 | |||
156 | test = Test ('test_integration_disconnect', verbose) | ||
157 | |||
158 | server = Peer(test, './confs/c_bootstrap_server.conf'); | ||
159 | server.start(); | ||
160 | |||
161 | client = Peer(test, './confs/c_no_nat_client.conf'); | ||
162 | client.start(); | ||
163 | |||
164 | client2 = Peer(test, './confs/c_nat_client.conf'); | ||
165 | client2.start(); | ||
166 | |||
167 | if ((client.started == True) and (client2.started == True) and (server.started == True)): | ||
168 | test.p ('Peers started, running check') | ||
169 | check_connect () | ||
170 | |||
171 | server.stop () | ||
172 | client.stop () | ||
173 | client2.stop () | ||
174 | |||
175 | cleanup () | ||
176 | |||
177 | if (success == False): | ||
178 | print ('Test failed') | ||
179 | return False | ||
180 | else: | ||
181 | return True | ||
182 | |||
183 | |||
184 | try: | ||
185 | run () | ||
186 | except (KeyboardInterrupt, SystemExit): | ||
187 | print 'Test interrupted' | ||
188 | server.stop () | ||
189 | client.stop () | ||
190 | client2.stop () | ||
191 | cleanup () | ||
192 | if (success == False): | ||
193 | sys.exit(1) | ||
194 | else: | ||
195 | sys.exit(0) | ||
196 | |||
197 | |||