aboutsummaryrefslogtreecommitdiff
path: root/src/integration-tests
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-12-17 16:23:15 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-12-17 16:23:15 +0000
commit93ca93ec08407bcdc680527ba2a22ab693541344 (patch)
treefc6840586922231290cc70a8aed1af46c1c10f9c /src/integration-tests
parent9945ef17c41da515ab9ce9c1657ad66728d89ded (diff)
downloadgnunet-93ca93ec08407bcdc680527ba2a22ab693541344.tar.gz
gnunet-93ca93ec08407bcdc680527ba2a22ab693541344.zip
a nat peer is included in clique test
Diffstat (limited to 'src/integration-tests')
-rw-r--r--src/integration-tests/Makefile.am13
-rwxr-xr-xsrc/integration-tests/test_integration_clique_nat.py.in220
2 files changed, 1 insertions, 232 deletions
diff --git a/src/integration-tests/Makefile.am b/src/integration-tests/Makefile.am
index 8fab9a837..c1bbc72ec 100644
--- a/src/integration-tests/Makefile.am
+++ b/src/integration-tests/Makefile.am
@@ -18,10 +18,8 @@ check_SCRIPTS = \
18 test_integration_bootstrap_and_connect.py \ 18 test_integration_bootstrap_and_connect.py \
19 test_integration_disconnect.py \ 19 test_integration_disconnect.py \
20 test_integration_reconnect.py \ 20 test_integration_reconnect.py \
21 test_integration_reconnect_nat.py \ 21 test_integration_reconnect_nat.py \
22 test_integration_clique.py 22 test_integration_clique.py
23# test_integration_clique_nat.py \
24# test_integration_connect_on_restart.py
25endif 23endif
26 24
27 25
@@ -66,14 +64,6 @@ test_integration_clique.py: test_integration_clique.py.in Makefile
66 $(do_subst) < $(srcdir)/test_integration_clique.py.in > test_integration_clique.py 64 $(do_subst) < $(srcdir)/test_integration_clique.py.in > test_integration_clique.py
67 chmod +x test_integration_clique.py 65 chmod +x test_integration_clique.py
68 66
69#test_integration_clique_nat.py: test_integration_clique_nat.py.in Makefile
70# $(do_subst) < $(srcdir)/test_integration_clique_nat.py.in > test_integration_clique_nat.py
71# chmod +x test_integration_clique_nat.py
72
73#test_integration_connect_on_restart.py: test_integration_connect_on_restart.py.in Makefile
74# $(do_subst) < $(srcdir)/test_integration_connect_on_restart.py.in > test_integration_connect_on_restart.py
75# chmod +x test_integration_connect_on_restart.py
76
77 67
78EXTRA_DIST = \ 68EXTRA_DIST = \
79 gnunet_testing.py.in \ 69 gnunet_testing.py.in \
@@ -92,7 +82,6 @@ EXTRA_DIST = \
92 hostkeys/c_no_nat_client \ 82 hostkeys/c_no_nat_client \
93 hostkeys/c_no_nat_client_2 \ 83 hostkeys/c_no_nat_client_2 \
94 hostkeys/c_nat_client 84 hostkeys/c_nat_client
95# test_integration_clique_nat.py.in
96 85
97CLEANFILES = \ 86CLEANFILES = \
98 $(check_SCRIPTS) \ 87 $(check_SCRIPTS) \
diff --git a/src/integration-tests/test_integration_clique_nat.py.in b/src/integration-tests/test_integration_clique_nat.py.in
deleted file mode 100755
index 184630d10..000000000
--- a/src/integration-tests/test_integration_clique_nat.py.in
+++ /dev/null
@@ -1,220 +0,0 @@
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
34from gnunet_testing import Peer
35from gnunet_testing import Test
36from gnunet_testing import Check
37from gnunet_testing import Condition
38from gnunet_testing import *
39
40if os.name == "nt":
41 tmp = os.getenv ("TEMP")
42else:
43 tmp = "/tmp"
44
45#definitions
46testname = "test_integration_clique_nat"
47verbose = False
48check_timeout = 180
49
50
51def cleanup ():
52 retries = 10
53 path = os.path.join (tmp, "c_bootstrap_server")
54 test.p ("Removing " + path)
55 while ((os.path.exists(path)) and (retries > 0)):
56 shutil.rmtree ((path), False)
57 time.sleep (1)
58 retries -= 1
59 if (os.path.exists(path)):
60 test.p ("Failed to remove " + path)
61
62 retries = 10
63 path = os.path.join (tmp, "c_no_nat_client")
64 test.p ("Removing " + path)
65 while ((os.path.exists(path)) and (retries > 0)):
66 shutil.rmtree ((path), False)
67 time.sleep (1)
68 retries -= 1
69 if (os.path.exists(path)):
70 test.p ("Failed to remove " + path)
71 retries = 10
72 path = os.path.join (tmp, "c_nat_client")
73 test.p ("Removing " + path)
74 while ((os.path.exists(path)) and (retries > 0)):
75 shutil.rmtree ((path), False)
76 time.sleep (1)
77 retries -= 1
78 if (os.path.exists(path)):
79 test.p ("Failed to remove " + path)
80
81
82def success_cont (check):
83 global success
84 success = True;
85
86def fail_cont (check):
87 global success
88 success= False;
89 check.evaluate(True)
90
91
92def check_disconnect_client ():
93 test.p ('Shutting down bootstrap client')
94 client.stop ()
95 check = Check (test)
96
97 check.add (StatisticsCondition (client2, 'transport', '# peers connected',0))
98 check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',0))
99 check.add (StatisticsCondition (client2, 'core', '# peers connected',0))
100 check.add (StatisticsCondition (client2, 'topology', '# peers connected',0))
101 check.add (StatisticsCondition (client2, 'fs', '# peers connected',0))
102
103 check.run_blocking (check_timeout, success_cont, fail_cont)
104
105
106def success_disconnect_server_cont (check):
107 check_disconnect_client ()
108
109
110def fail_disconnect_server_cont (check):
111 global success
112 success= False;
113 check.evaluate(False)
114
115
116def check_disconnect_server ():
117 test.p ('Shutting down bootstrap server')
118 server.stop ()
119 check = Check (test)
120 check.add (StatisticsCondition (client, 'transport', '# peers connected',1))
121 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',1))
122 check.add (StatisticsCondition (client, 'core', '# peers connected',1))
123 check.add (StatisticsCondition (client, 'topology', '# peers connected',1))
124 check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
125
126 check.add (StatisticsCondition (client2, 'transport', '# peers connected',1))
127 check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',1))
128 check.add (StatisticsCondition (client2, 'core', '# peers connected',1))
129 check.add (StatisticsCondition (client2, 'topology', '# peers connected',1))
130 check.add (StatisticsCondition (client2, 'fs', '# peers connected',1))
131
132 check.run_blocking (check_timeout, success_disconnect_server_cont, fail_disconnect_server_cont)
133
134
135def success_connect_cont (check):
136 check_disconnect_server ()
137
138
139def fail_connect_cont (check):
140 global success
141 success= False;
142 check.evaluate(False)
143
144
145def check_connect ():
146 check = Check (test)
147 check.add (StatisticsCondition (client, 'transport', '# peers connected',2))
148 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',2))
149 check.add (StatisticsCondition (client, 'core', '# peers connected',2))
150 check.add (StatisticsCondition (client, 'topology', '# peers connected',2))
151 check.add (StatisticsCondition (client, 'fs', '# peers connected',2))
152
153 check.add (StatisticsCondition (client2, 'transport', '# peers connected',2))
154 check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',2))
155 check.add (StatisticsCondition (client2, 'core', '# peers connected',2))
156 check.add (StatisticsCondition (client2, 'topology', '# peers connected',2))
157 check.add (StatisticsCondition (client2, 'fs', '# peers connected',2))
158
159 check.add (StatisticsCondition (server, 'transport', '# peers connected',2))
160 check.add (StatisticsCondition (server, 'core', '# neighbour entries allocated',2))
161 check.add (StatisticsCondition (server, 'core', '# peers connected',2))
162 check.add (StatisticsCondition (server, 'topology', '# peers connected',2))
163 check.add (StatisticsCondition (server, 'fs', '# peers connected',2))
164
165 check.run_blocking (check_timeout, success_connect_cont, fail_connect_cont)
166
167#
168# Test execution
169#
170def run ():
171 global success
172 global test
173 global server
174 global client
175 global client2
176
177 success = False
178
179 test = Test ('test_integration_disconnect', verbose)
180
181 server = Peer(test, './confs/c_bootstrap_server.conf');
182 server.start();
183
184 client = Peer(test, './confs/c_no_nat_client.conf');
185 client.start();
186
187 client2 = Peer(test, './confs/c_nat_client.conf');
188 client2.start();
189
190 if ((client.started == True) and (client2.started == True) and (server.started == True)):
191 test.p ('Peers started, running check')
192 check_connect ()
193
194 server.stop ()
195 client.stop ()
196 client2.stop ()
197
198 cleanup ()
199
200 if (success == False):
201 print ('Test failed')
202 return False
203 else:
204 return True
205
206
207try:
208 run ()
209except (KeyboardInterrupt, SystemExit):
210 print 'Test interrupted'
211 server.stop ()
212 client.stop ()
213 client2.stop ()
214 cleanup ()
215if (success == False):
216 sys.exit(1)
217else:
218 sys.exit(0)
219
220