aboutsummaryrefslogtreecommitdiff
path: root/src/integration-tests
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-12-16 14:49:27 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-12-16 14:49:27 +0000
commit552cdae90b8f2da2c38689a39636452c19205919 (patch)
treeaf0364663885c05b7c6573712e67c2c55c3ec866 /src/integration-tests
parentc0411452aa4c4473fb217252eede77e1a6c0d563 (diff)
downloadgnunet-552cdae90b8f2da2c38689a39636452c19205919.tar.gz
gnunet-552cdae90b8f2da2c38689a39636452c19205919.zip
adding nat clique test
Diffstat (limited to 'src/integration-tests')
-rw-r--r--src/integration-tests/Makefile.am11
-rw-r--r--src/integration-tests/confs/c_nat_client.conf343
-rwxr-xr-xsrc/integration-tests/test_integration_clique_nat.py.in197
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
25endif 26endif
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
56test_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
55EXTRA_DIST = \ 61EXTRA_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
62CLEANFILES = \ 69CLEANFILES = \
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]
2SERVICEHOME = /tmp/c_nat_client
3DEFAULTCONFIG = confs/c_nat_client.conf
4
5[gnunetd]
6HOSTKEY = hostkeys/0002-hostkey
7
8[client]
9HOME = $SERVICEHOME
10
11
12[resolver]
13AUTOSTART = YES
14PORT = 20071
15HOSTNAME = localhost
16HOME = $SERVICEHOME
17CONFIG = $DEFAULTCONFIG
18BINARY = gnunet-service-resolver
19ACCEPT_FROM = 127.0.0.1;
20ACCEPT_FROM6 = ::1;
21UNIXPATH = /tmp/test-service-resolver-56
22UNIX_MATCH_UID = NO
23UNIX_MATCH_GID = NO
24
25[mesh]
26AUTOSTART = YES
27PORT = 20070
28HOSTNAME = localhost
29HOME = $SERVICEHOME
30CONFIG = $DEFAULTCONFIG
31BINARY = gnunet-service-mesh
32ACCEPT_FROM = 127.0.0.1;
33ACCEPT_FROM6 = ::1;
34UNIXPATH = /tmp/test-service-mesh-55
35UNIX_MATCH_UID = YES
36UNIX_MATCH_GID = YES
37
38[nse]
39AUTOSTART = YES
40PORT = 20069
41HOSTNAME = localhost
42HOME = $SERVICEHOME
43CONFIG = $DEFAULTCONFIG
44BINARY = gnunet-service-nse
45ACCEPT_FROM = 127.0.0.1;
46ACCEPT_FROM6 = ::1;
47UNIXPATH = /tmp/test-service-nse-54
48UNIX_MATCH_UID = YES
49UNIX_MATCH_GID = YES
50PROOFFILE = $SERVICEHOME/.nse-proof
51HISTOGRAM = $SERVICEHOME/nse-history.log
52WORKDELAY = 5 ms
53INTERVAL = 1 h
54WORKBITS = 26
55
56[topology]
57MINIMUM-FRIENDS = 0
58FRIENDS-ONLY = NO
59AUTOCONNECT = YES
60TARGET-CONNECTION-COUNT = 16
61FRIENDS = $SERVICEHOME/friends
62CONFIG = $DEFAULTCONFIG
63BINARY = gnunet-daemon-topology
64
65[datastore]
66AUTOSTART = YES
67UNIXPATH = /tmp/test-service-datastore-53
68UNIX_MATCH_UID = YES
69UNIX_MATCH_GID = YES
70PORT = 20068
71HOSTNAME = localhost
72HOME = $SERVICEHOME
73CONFIG = $DEFAULTCONFIG
74BINARY = gnunet-service-datastore
75ACCEPT_FROM = 127.0.0.1;
76ACCEPT_FROM6 = ::1;
77QUOTA = 100 MB
78BLOOMFILTER = $SERVICEHOME/fs/bloomfilter
79DATABASE = sqlite
80
81[datastore-sqlite]
82FILENAME = $SERVICEHOME/datastore/sqlite.db
83
84[datastore-postgres]
85CONFIG = connect_timeout=10; dbname=gnunet
86
87[datastore-mysql]
88DATABASE = gnunet
89CONFIG = ~/.my.cnf
90
91[peerinfo]
92AUTOSTART = YES
93PORT = 20067
94HOSTNAME = localhost
95HOME = $SERVICEHOME
96CONFIG = $DEFAULTCONFIG
97BINARY = gnunet-service-peerinfo
98ACCEPT_FROM = 127.0.0.1;
99ACCEPT_FROM6 = ::1;
100UNIXPATH = /tmp/test-service-peerinfo-52
101UNIX_MATCH_UID = NO
102UNIX_MATCH_GID = YES
103HOSTS = $SERVICEHOME/data/hosts/
104
105[TESTING]
106WEAKRANDOM = NO
107CONNECT_TIMEOUT = 30 s
108CONNECT_ATTEMPTS = 3
109MAX_OUTSTANDING_CONNECTIONS = 50
110DELETE_FILES = YES
111
112[ats]
113AUTOSTART = YES
114PORT = 20066
115HOSTNAME = localhost
116HOME = $SERVICEHOME
117CONFIG = $DEFAULTCONFIG
118BINARY = gnunet-service-ats
119ACCEPT_FROM = 127.0.0.1;
120ACCEPT_FROM6 = ::1;
121UNIXPATH = /tmp/test-service-ats-51
122UNIX_MATCH_UID = YES
123UNIX_MATCH_GID = YES
124WAN_QUOTA_IN = 65536
125WAN_QUOTA_OUT = 65536
126DUMP_MLP = NO
127DUMP_SOLUTION = NO
128DUMP_OVERWRITE = NO
129DUMP_MIN_PEERS = 0
130DUMP_MIN_ADDRS = 0
131ATS_MIN_INTERVAL = 15000
132ATS_EXEC_INTERVAL = 30000
133
134[transport]
135AUTOSTART = YES
136PORT = 20065
137HOSTNAME = localhost
138HOME = $SERVICEHOME
139CONFIG = $DEFAULTCONFIG
140BINARY = gnunet-service-transport
141NEIGHBOUR_LIMIT = 50
142ACCEPT_FROM = 127.0.0.1;
143ACCEPT_FROM6 = ::1;
144PLUGINS = tcp
145UNIXPATH = /tmp/test-service-transport-50
146BLACKLIST_FILE = $SERVICEHOME/blacklist
147UNIX_MATCH_UID = YES
148UNIX_MATCH_GID = YES
149
150[transport-tcp]
151PORT = 0
152ADVERTISED_PORT = 20064
153MAX_CONNECTIONS = 128
154TIMEOUT = 5 s
155USE_LOCALADDR = YES
156
157[transport-udp]
158PORT = 0
159BROADCAST = YES
160BROADCAST_INTERVAL = 30000
161MAX_BPS = 1000000
162USE_LOCALADDR = YES
163
164[transport-http]
165PORT = 0
166MAX_CONNECTIONS = 128
167
168[transport-https]
169PORT = 0
170CRYPTO_INIT = NORMAL
171KEY_FILE = https.key
172CERT_FILE = https.cert
173MAX_CONNECTIONS = 128
174
175[transport-wlan]
176INTERFACE = mon0
177TESTMODE = 0
178
179[datacache-mysql]
180DATABASE = gnunet
181CONFIG = ~/.my.cnf
182
183[datacache-postgres]
184CONFIG = connect_timeout=10; dbname=gnunet
185
186[template]
187AUTOSTART = NO
188PORT = 20060
189HOSTNAME = localhost
190HOME = $SERVICEHOME
191CONFIG = $DEFAULTCONFIG
192BINARY = gnunet-service-template
193ACCEPT_FROM = 127.0.0.1;
194ACCEPT_FROM6 = ::1;
195UNIXPATH = /tmp/test-service-template-49
196UNIX_MATCH_UID = YES
197UNIX_MATCH_GID = YES
198
199[fs]
200AUTOSTART = YES
201INDEXDB = $SERVICEHOME/idxinfo.lst
202TRUST = $SERVICEHOME/data/credit/
203IDENTITY_DIR = $SERVICEHOME/identities/
204STATE_DIR = $SERVICEHOME/persistence/
205UPDATE_DIR = $SERVICEHOME/updates/
206PORT = 20059
207HOSTNAME = localhost
208HOME = $SERVICEHOME
209CONFIG = $DEFAULTCONFIG
210BINARY = gnunet-service-fs
211ACCEPT_FROM = 127.0.0.1;
212ACCEPT_FROM6 = ::1;
213DELAY = YES
214CONTENT_CACHING = YES
215CONTENT_PUSHING = YES
216UNIXPATH = /tmp/test-service-fs-48
217UNIX_MATCH_UID = NO
218UNIX_MATCH_GID = YES
219MAX_PENDING_REQUESTS = 65536
220MIN_MIGRATION_DELAY = 100 ms
221EXPECTED_NEIGHBOUR_COUNT = 128
222
223[vpn]
224CONFIG = $DEFAULTCONFIG
225BINARY = gnunet-daemon-vpn
226IPV6ADDR = 1234::1
227IPV6PREFIX = 32
228IPV4ADDR = 10.11.10.1
229IPV4MASK = 255.255.0.0
230VIRTDNS = 10.11.10.2
231VIRTDNS6 = 1234::17
232IFNAME = vpn-gnunet
233
234[exit]
235CONFIG = $DEFAULTCONFIG
236BINARY = gnunet-daemon-exit
237IPV6ADDR = 1234:1::1
238IPV6PREFIX = 32
239IPV4ADDR = 10.10.1.1
240IPV4MASK = 255.255.0.0
241IFNAME = exit-gnunet
242ENABLE_UDP = NO
243ENABLE_TCP = NO
244
245[dns]
246AUTOSTART = YES
247PORT = 0
248HOSTNAME = localhost
249HOME = $SERVICEHOME
250CONFIG = $DEFAULTCONFIG
251BINARY = gnunet-service-dns
252ACCEPT_FROM = 127.0.0.1;
253ACCEPT_FROM6 = ::1;
254UNIXPATH = /tmp/test-service-dns-47
255PROVIDE_EXIT = NO
256
257[arm]
258PORT = 20058
259HOSTNAME = localhost
260HOME = $SERVICEHOME
261CONFIG = $DEFAULTCONFIG
262BINARY = gnunet-service-arm
263ACCEPT_FROM = 127.0.0.1;
264ACCEPT_FROM6 = ::1;
265DEFAULTSERVICES = topology hostlist
266UNIXPATH = /tmp/test-service-arm-46
267UNIX_MATCH_UID = YES
268UNIX_MATCH_GID = YES
269
270[hostlist]
271HTTPPORT = 8080
272HOME = $SERVICEHOME
273HOSTLISTFILE = $SERVICEHOME/hostlist/learned.data
274CONFIG = $DEFAULTCONFIG
275BINARY = gnunet-daemon-hostlist
276OPTIONS = -b
277SERVERS = http://v9.gnunet.org:58080/
278HTTP-PROXY =
279
280[core]
281AUTOSTART = YES
282PORT = 20057
283HOSTNAME = localhost
284HOME = $SERVICEHOME
285CONFIG = $DEFAULTCONFIG
286BINARY = gnunet-service-core
287ACCEPT_FROM = 127.0.0.1;
288ACCEPT_FROM6 = ::1;
289UNIXPATH = /tmp/test-service-core-45
290UNIX_MATCH_UID = YES
291UNIX_MATCH_GID = YES
292
293[nat]
294BEHIND_NAT = YES
295PUNCHED_NAT = NO
296ENABLE_UPNP = NO
297USE_LOCALADDR = YES
298USE_HOSTNAME = NO
299ENABLE_ICMP_CLIENT = NO
300ENABLE_ICMP_SERVER = NO
301DISABLEV6 = YES
302RETURN_LOCAL_ADDRESSES = NO
303HOSTNAME_DNS_FREQUENCY = 1200000
304IFC_SCAN_FREQUENCY = 3000000
305DYNDNS_FREQUENCY = 140000
306EXTERNAL_ADDRESS = 127.0.0.1
307INTERNAL_ADDRESS = 127.0.0.1
308BINDTO = 127.0.0.1
309
310[gnunet-nat-server]
311HOSTNAME = gnunet.org
312PORT = 20056
313
314[statistics]
315AUTOSTART = YES
316PORT = 20055
317HOSTNAME = localhost
318HOME = $SERVICEHOME
319CONFIG = $DEFAULTCONFIG
320BINARY = gnunet-service-statistics
321ACCEPT_FROM = 127.0.0.1;
322ACCEPT_FROM6 = ::1;
323UNIXPATH = /tmp/test-service-statistics-44
324UNIX_MATCH_UID = NO
325UNIX_MATCH_GID = YES
326
327[dht]
328AUTOSTART = YES
329PORT = 20054
330HOSTNAME = localhost
331HOME = $SERVICEHOME
332CONFIG = $DEFAULTCONFIG
333BINARY = gnunet-service-dht
334ACCEPT_FROM = 127.0.0.1;
335ACCEPT_FROM6 = ::1;
336BUCKET_SIZE = 4
337UNIXPATH = /tmp/test-service-dht-43
338UNIX_MATCH_UID = YES
339UNIX_MATCH_GID = YES
340
341[dhtcache]
342DATABASE = sqlite
343QUOTA = 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
28import sys
29import os
30import subprocess
31import re
32import shutil
33import time
34import pexpect
35from gnunet_testing import Peer
36from gnunet_testing import Test
37from gnunet_testing import Check
38from gnunet_testing import Condition
39from gnunet_testing import *
40
41
42#definitions
43testname = "test_integration_clique_nat"
44verbose = False
45check_timeout = 120
46
47
48def 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
59def success_cont (check):
60 global success
61 success = True;
62
63def fail_cont (check):
64 global success
65 success= False;
66 check.eval(True)
67
68
69def 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
83def success_disconnect_server_cont (check):
84 check_disconnect_client ()
85
86
87def fail_disconnect_server_cont (check):
88 global success
89 success= False;
90 check.eval(True)
91
92
93def 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
112def success_connect_cont (check):
113 check_disconnect_server ()
114
115
116def fail_connect_cont (check):
117 global success
118 success= False;
119 check.eval(True)
120
121
122def 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#
147def 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
184try:
185 run ()
186except (KeyboardInterrupt, SystemExit):
187 print 'Test interrupted'
188 server.stop ()
189 client.stop ()
190 client2.stop ()
191 cleanup ()
192if (success == False):
193 sys.exit(1)
194else:
195 sys.exit(0)
196
197