aboutsummaryrefslogtreecommitdiff
path: root/src/integration-tests/test_integration_bootstrap_and_connect.py.in
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-12-09 14:48:25 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-12-09 14:48:25 +0000
commit3edb9f0c49a95493e67549e5ccb2016782c5b17c (patch)
tree52d1c6b81971899403038827927da1f9250f480e /src/integration-tests/test_integration_bootstrap_and_connect.py.in
parenta7acd081b77cb34147578be4cab5e9e0ad0a69c3 (diff)
downloadgnunet-3edb9f0c49a95493e67549e5ccb2016782c5b17c.tar.gz
gnunet-3edb9f0c49a95493e67549e5ccb2016782c5b17c.zip
first test ready
Diffstat (limited to 'src/integration-tests/test_integration_bootstrap_and_connect.py.in')
-rwxr-xr-xsrc/integration-tests/test_integration_bootstrap_and_connect.py.in90
1 files changed, 74 insertions, 16 deletions
diff --git a/src/integration-tests/test_integration_bootstrap_and_connect.py.in b/src/integration-tests/test_integration_bootstrap_and_connect.py.in
index 2d0290a26..1e0533d52 100755
--- a/src/integration-tests/test_integration_bootstrap_and_connect.py.in
+++ b/src/integration-tests/test_integration_bootstrap_and_connect.py.in
@@ -26,23 +26,21 @@ import shutil
26import time 26import time
27import pexpect 27import pexpect
28 28
29
30
31
32# 29#
33# This test tests if a fresh peer bootstraps from a hostlist server and then 30# This test tests if a fresh peer bootstraps from a hostlist server and then
34# successfully connects to the server 31# successfully connects to the server
35# 32#
33# Conditions for successful exit:
34# Both peers have 1 connected peer in transport, core, topology, fs
36 35
37#definitions 36#definitions
38 37
39testname = "test_integration_bootstrap_and_connect" 38testname = "test_integration_bootstrap_and_connect"
40verbose = True 39verbose = False
41gnunetarm = "" 40gnunetarm = ""
42gnunetstatistics = "" 41gnunetstatistics = ""
43#fix this!
44success = False 42success = False
45timeout = 10 43timeout = 100
46 44
47#test conditions 45#test conditions
48 46
@@ -50,11 +48,12 @@ timeout = 10
50server_transport_connected = False 48server_transport_connected = False
51server_topology_connected = False 49server_topology_connected = False
52server_core_connected = False 50server_core_connected = False
51server_fs_connected = False
53 52
54client_transport_connected = False 53client_transport_connected = False
55client_topology_connected = False 54client_topology_connected = False
56client_core_connected = False 55client_core_connected = False
57 56client_fs_connected = False
58 57
59def vprintf (msg): 58def vprintf (msg):
60 if verbose == True: 59 if verbose == True:
@@ -115,8 +114,10 @@ def stop ():
115def cleanup (): 114def cleanup ():
116 if os.name == "nt": 115 if os.name == "nt":
117 shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-fs-py-ns"), True) 116 shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-fs-py-ns"), True)
117 shutil.rmtree (os.path.join (os.getenv ("TEMP"), "c_no_nat_client"), True)
118 else: 118 else:
119 shutil.rmtree ("/tmp/gnunet-test-fs-py-ns", True) 119 shutil.rmtree ("/tmp/c_bootstrap_server/", True)
120 shutil.rmtree ("/tmp/c_no_nat_client/", True)
120 121
121def check_statistics (conf, subsystem, name, value): 122def check_statistics (conf, subsystem, name, value):
122 from gnunet_pyexpect import pexpect 123 from gnunet_pyexpect import pexpect
@@ -135,16 +136,73 @@ def check ():
135 global success 136 global success
136 global timeout 137 global timeout
137 global publish 138 global publish
139 global server_transport_connected
140 global server_topology_connected
141 global server_core_connected
142 global server_fs_connected
143
144 global client_transport_connected
145 global client_topology_connected
146 global client_core_connected
147 global client_fs_connected
138 148
139 count = 1 149 count = 1
140 print 'check'
141 while ((success == False) and (count <= timeout)): 150 while ((success == False) and (count <= timeout)):
142 if (True == check_statistics ('./confs/c_bootstrap_server.conf', 'transport', '# peers connected',1)): 151 # Perform checks
143 vprintf ('Server transport services is connected') 152 if ((False == server_transport_connected) and (True == check_statistics ('./confs/c_bootstrap_server.conf', 'transport', '# peers connected',1))):
144 if (True == check_statistics ('./confs/c_no_nat_client.conf', 'transport', '# peers connected',1)): 153 server_transport_connected = True
145 vprintf ('Client transport services is connected') 154 vprintf ('Server transport services is connected')
146 time.sleep(1) 155
147 count += 1 156 if ((False == client_transport_connected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'transport', '# peers connected',1))):
157 client_transport_connected = True
158 vprintf ('Client transport services is connected')
159
160 if ((False == server_core_connected) and (True == check_statistics ('./confs/c_bootstrap_server.conf', 'core', '# neighbour entries allocated',1))):
161 server_core_connected = True
162 vprintf ('Server core services is connected')
163
164 if ((False == client_core_connected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'core', '# neighbour entries allocated',1))):
165 client_core_connected = True
166 vprintf ('Client core services is connected')
167
168 if ((False == server_topology_connected) and (True == check_statistics ('./confs/c_bootstrap_server.conf', 'topology', '# peers connected',1))):
169 server_topology_connected = True
170 vprintf ('Server topology services is connected')
171
172 if ((False == client_topology_connected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'topology', '# peers connected',1))):
173 client_topology_connected = True
174 vprintf ('Client topology services is connected')
175
176 if ((False == client_fs_connected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'fs', '# peers connected',1))):
177 client_fs_connected = True
178 vprintf ('Client fs services is connected')
179 if ((False == server_fs_connected) and (True == check_statistics ('./confs/c_bootstrap_server.conf', 'fs', '# peers connected',1))):
180 server_fs_connected = True
181 vprintf ('Server fs services is connected')
182
183 # Check if conditions fulfilled
184 if ((True == client_transport_connected) and (True == server_transport_connected) and
185 (True == client_topology_connected) and (True == server_topology_connected) and
186 (True == client_core_connected) and (True == server_core_connected) and
187 (True == client_fs_connected) and (True == server_fs_connected)):
188 success = True
189 break
190 print '.'
191 time.sleep(1)
192 count += 1
193 if (success == False):
194 if (client_transport_connected == False):
195 print ('Client transport was NOT connected')
196 if (server_transport_connected == False):
197 print ('Server transport was NOT connected')
198 if (client_topology_connected == False):
199 print ('Client topology was NOT connected')
200 if (server_topology_connected == False):
201 print ('Server topology was NOT connected')
202 if (client_core_connected == False):
203 print ('Client core was NOT connected')
204 if (server_core_connected == False):
205 print ('Server core was NOT connected')
148 206
149# 207#
150# Test execution 208# Test execution
@@ -156,7 +214,7 @@ start ()
156 214
157check () 215check ()
158 216
159#stop () 217stop ()
160cleanup () 218cleanup ()
161 219
162if (success == False): 220if (success == False):