aboutsummaryrefslogtreecommitdiff
path: root/src/integration-tests
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-12-17 16:26:01 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-12-17 16:26:01 +0000
commit9b2456b3ae889b167efed280197efc161367cb8a (patch)
tree03a18e8a685d6a935e15f300d3e1cd109928d166 /src/integration-tests
parent3ea525ab277928ae906e335e2e30f0c7212411aa (diff)
downloadgnunet-9b2456b3ae889b167efed280197efc161367cb8a.tar.gz
gnunet-9b2456b3ae889b167efed280197efc161367cb8a.zip
unused
Diffstat (limited to 'src/integration-tests')
-rwxr-xr-xsrc/integration-tests/test_integration_connect_on_restart.py.in206
1 files changed, 0 insertions, 206 deletions
diff --git a/src/integration-tests/test_integration_connect_on_restart.py.in b/src/integration-tests/test_integration_connect_on_restart.py.in
deleted file mode 100755
index 3fe5756e6..000000000
--- a/src/integration-tests/test_integration_connect_on_restart.py.in
+++ /dev/null
@@ -1,206 +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 and expects bootstrap and a connected clique
23# After a successful clique it shuts down all peers and starts the non-bootstrap
24# peers, expecting them to reconnect
25#
26# Conditions for successful exit:
27# Both peers have 1 connected peer in transport, core, topology, fs
28
29import sys
30import os
31import subprocess
32import re
33import shutil
34import time
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
43
44testname = "test_integration_clique"
45verbose = True
46check_timeout = 180
47
48if os.name == "nt":
49 tmp = os.getenv ("TEMP")
50else:
51 tmp = "/tmp"
52
53def cleanup ():
54 retries = 10
55 path = os.path.join (tmp, "c_bootstrap_server")
56 test.p ("Removing " + path)
57 while ((os.path.exists(path)) and (retries > 0)):
58 shutil.rmtree ((path), False)
59 time.sleep (1)
60 retries -= 1
61 if (os.path.exists(path)):
62 test.p ("Failed to remove " + path)
63
64 retries = 10
65 path = os.path.join (tmp, "c_no_nat_client")
66 test.p ("Removing " + path)
67 while ((os.path.exists(path)) and (retries > 0)):
68 shutil.rmtree ((path), False)
69 time.sleep (1)
70 retries -= 1
71 if (os.path.exists(path)):
72 test.p ("Failed to remove " + path)
73
74 retries = 10
75 path = os.path.join (tmp, "c_no_nat_client_2")
76 test.p ("Removing " + path)
77 while ((os.path.exists(path)) and (retries > 0)):
78 shutil.rmtree ((path), False)
79 time.sleep (1)
80 retries -= 1
81 if (os.path.exists(path)):
82 test.p ("Failed to remove " + path)
83 shutil.rmtree (os.path.join (tmp, "c_no_nat_client_2"), True)
84
85
86def success_cont (check):
87 global success
88 success = True;
89 check.evaluate(True)
90
91def fail_cont (check):
92 global success
93 success = False;
94 check.evaluate(False)
95
96
97def success_connect_cont (check):
98 check.evaluate(True)
99 print "Connected clique, shutdown"
100 server.stop ()
101 client.stop ()
102 client2.stop ()
103 time.sleep (3)
104 client.start ()
105 client2.start ()
106
107 check = Check (test)
108 check.add (StatisticsCondition (client, 'transport', '# peers connected',1))
109 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',1))
110 check.add (StatisticsCondition (client, 'core', '# peers connected',1))
111 check.add (StatisticsCondition (client, 'topology', '# peers connected',1))
112 check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
113
114 check.add (StatisticsCondition (client2, 'transport', '# peers connected',1))
115 check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',1))
116 check.add (StatisticsCondition (client2, 'core', '# peers connected',1))
117 check.add (StatisticsCondition (client2, 'topology', '# peers connected',1))
118 check.add (StatisticsCondition (client2, 'fs', '# peers connected',1))
119
120 check.run_blocking (check_timeout, success_cont, fail_cont)
121
122
123def fail_connect_cont (check):
124 global success
125 print "Failed to connect clique, shutdown"
126 success = False;
127 check.evaluate(False)
128
129
130def check_connect ():
131 check = Check (test)
132 check.add (StatisticsCondition (client, 'transport', '# peers connected',2))
133 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',2))
134 check.add (StatisticsCondition (client, 'core', '# peers connected',2))
135 check.add (StatisticsCondition (client, 'topology', '# peers connected',2))
136 check.add (StatisticsCondition (client, 'fs', '# peers connected',2))
137
138 check.add (StatisticsCondition (client2, 'transport', '# peers connected',2))
139 check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',2))
140 check.add (StatisticsCondition (client2, 'core', '# peers connected',2))
141 check.add (StatisticsCondition (client2, 'topology', '# peers connected',2))
142 check.add (StatisticsCondition (client2, 'fs', '# peers connected',2))
143
144 check.add (StatisticsCondition (server, 'transport', '# peers connected',2))
145 check.add (StatisticsCondition (server, 'core', '# neighbour entries allocated',2))
146 check.add (StatisticsCondition (server, 'core', '# peers connected',2))
147 check.add (StatisticsCondition (server, 'topology', '# peers connected',2))
148 check.add (StatisticsCondition (server, 'fs', '# peers connected',2))
149
150 check.run_blocking (check_timeout, success_connect_cont, fail_connect_cont)
151
152#
153# Test execution
154#
155def run ():
156 global success
157 global test
158 global server
159 global client
160 global client2
161
162 success = False
163
164 test = Test ('test_integration_disconnect', verbose)
165 cleanup ()
166
167 server = Peer(test, './confs/c_bootstrap_server.conf');
168 server.start();
169
170 client = Peer(test, './confs/c_no_nat_client.conf');
171 client.start();
172
173 client2 = Peer(test, './confs/c_no_nat_client_2.conf');
174 client2.start();
175
176 if ((client.started == True) and (client2.started == True) and (server.started == True)):
177 test.p ('Peers started, running check')
178 check_connect ()
179
180 server.stop ()
181 client.stop ()
182 client2.stop ()
183
184 cleanup ()
185
186 if (success == False):
187 print ('Test failed')
188 return False
189 else:
190 return True
191
192
193try:
194 run ()
195except (KeyboardInterrupt, SystemExit):
196 print 'Test interrupted'
197 server.stop ()
198 client.stop ()
199 client2.stop ()
200 cleanup ()
201if (success == False):
202 sys.exit(1)
203else:
204 sys.exit(0)
205
206