aboutsummaryrefslogtreecommitdiff
path: root/src/integration-tests/test_integration_clique.py.in
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-12-17 16:14:26 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-12-17 16:14:26 +0000
commitd626dae9f02dd793a0175cbb89d17785caee8cf5 (patch)
tree7c2ac17f3dd5c6a79a9afdd8250ee0e820d08252 /src/integration-tests/test_integration_clique.py.in
parentaba51a8fe1f22b62ce735a725e2badc4f21b21d0 (diff)
downloadgnunet-d626dae9f02dd793a0175cbb89d17785caee8cf5.tar.gz
gnunet-d626dae9f02dd793a0175cbb89d17785caee8cf5.zip
clique test
removed unusued confs, tests
Diffstat (limited to 'src/integration-tests/test_integration_clique.py.in')
-rwxr-xr-xsrc/integration-tests/test_integration_clique.py.in138
1 files changed, 66 insertions, 72 deletions
diff --git a/src/integration-tests/test_integration_clique.py.in b/src/integration-tests/test_integration_clique.py.in
index 17bd60776..e1856ba2b 100755
--- a/src/integration-tests/test_integration_clique.py.in
+++ b/src/integration-tests/test_integration_clique.py.in
@@ -19,12 +19,14 @@
19# 19#
20# 20#
21# 21#
22# This test starts 3 peers and expects bootstrap and a connected clique 22# This test starts 3 peers (nated, server, no nat)and expects bootstrap
23# and a connected clique
23# 24#
24# Conditions for successful exit: 25# Conditions for successful exit:
25# Both peers have 1 connected peer in transport, core, topology, fs 26# Both peers have 2 connected peers in transport, core, topology, fs and dht
26 27
27import sys 28import sys
29import signal
28import os 30import os
29import subprocess 31import subprocess
30import re 32import re
@@ -68,7 +70,7 @@ def cleanup ():
68 if (os.path.exists(path)): 70 if (os.path.exists(path)):
69 test.p ("Failed to remove " + path) 71 test.p ("Failed to remove " + path)
70 retries = 10 72 retries = 10
71 path = os.path.join (tmp, "c_no_nat_client_2") 73 path = os.path.join (tmp, "c_nat_client")
72 test.p ("Removing " + path) 74 test.p ("Removing " + path)
73 while ((os.path.exists(path)) and (retries > 0)): 75 while ((os.path.exists(path)) and (retries > 0)):
74 shutil.rmtree ((path), False) 76 shutil.rmtree ((path), False)
@@ -81,65 +83,13 @@ def cleanup ():
81def success_cont (check): 83def success_cont (check):
82 global success 84 global success
83 success = True; 85 success = True;
86 print 'Connected clique successfully'
84 87
85def fail_cont (check): 88def fail_cont (check):
86 global success 89 global success
87 success= False; 90 success= False;
88 check.evaluate(True)
89
90
91def check_disconnect_client ():
92 test.p ('Shutting down bootstrap client')
93 client.stop ()
94 check = Check (test)
95
96 check.add (StatisticsCondition (client2, 'transport', '# peers connected',0))
97 check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',0))
98 check.add (StatisticsCondition (client2, 'core', '# peers connected',0))
99 check.add (StatisticsCondition (client2, 'topology', '# peers connected',0))
100 check.add (StatisticsCondition (client2, 'fs', '# peers connected',0))
101
102 check.run_blocking (check_timeout, success_cont, fail_cont)
103
104
105def success_disconnect_server_cont (check):
106 check_disconnect_client ()
107
108
109def fail_disconnect_server_cont (check):
110 global success
111 success= False;
112 check.evaluate(True)
113
114
115def check_disconnect_server ():
116 test.p ('Shutting down bootstrap server')
117 server.stop ()
118 check = Check (test)
119 check.add (StatisticsCondition (client, 'transport', '# peers connected',1))
120 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',1))
121 check.add (StatisticsCondition (client, 'core', '# peers connected',1))
122 check.add (StatisticsCondition (client, 'topology', '# peers connected',1))
123 check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
124
125 check.add (StatisticsCondition (client2, 'transport', '# peers connected',1))
126 check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',1))
127 check.add (StatisticsCondition (client2, 'core', '# peers connected',1))
128 check.add (StatisticsCondition (client2, 'topology', '# peers connected',1))
129 check.add (StatisticsCondition (client2, 'fs', '# peers connected',1))
130
131 check.run_blocking (check_timeout, success_disconnect_server_cont, fail_disconnect_server_cont)
132
133
134def success_connect_cont (check):
135 check_disconnect_server ()
136
137
138def fail_connect_cont (check):
139 global success
140 success= False;
141 check.evaluate(True) 91 check.evaluate(True)
142 92 print 'Failed to connect clique'
143 93
144def check_connect (): 94def check_connect ():
145 check = Check (test) 95 check = Check (test)
@@ -147,52 +97,96 @@ def check_connect ():
147 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',2)) 97 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',2))
148 check.add (StatisticsCondition (client, 'core', '# peers connected',2)) 98 check.add (StatisticsCondition (client, 'core', '# peers connected',2))
149 check.add (StatisticsCondition (client, 'topology', '# peers connected',2)) 99 check.add (StatisticsCondition (client, 'topology', '# peers connected',2))
100 check.add (StatisticsCondition (client, 'dht', '# peers connected',2))
150 check.add (StatisticsCondition (client, 'fs', '# peers connected',2)) 101 check.add (StatisticsCondition (client, 'fs', '# peers connected',2))
151 102
152 check.add (StatisticsCondition (client2, 'transport', '# peers connected',2)) 103 check.add (StatisticsCondition (client_nat, 'transport', '# peers connected',2))
153 check.add (StatisticsCondition (client2, 'core', '# neighbour entries allocated',2)) 104 check.add (StatisticsCondition (client_nat, 'core', '# neighbour entries allocated',2))
154 check.add (StatisticsCondition (client2, 'core', '# peers connected',2)) 105 check.add (StatisticsCondition (client_nat, 'core', '# peers connected',2))
155 check.add (StatisticsCondition (client2, 'topology', '# peers connected',2)) 106 check.add (StatisticsCondition (client_nat, 'topology', '# peers connected',2))
156 check.add (StatisticsCondition (client2, 'fs', '# peers connected',2)) 107 check.add (StatisticsCondition (client_nat, 'dht', '# peers connected',2))
108 check.add (StatisticsCondition (client_nat, 'fs', '# peers connected',2))
157 109
158 check.add (StatisticsCondition (server, 'transport', '# peers connected',2)) 110 check.add (StatisticsCondition (server, 'transport', '# peers connected',2))
159 check.add (StatisticsCondition (server, 'core', '# neighbour entries allocated',2)) 111 check.add (StatisticsCondition (server, 'core', '# neighbour entries allocated',2))
160 check.add (StatisticsCondition (server, 'core', '# peers connected',2)) 112 check.add (StatisticsCondition (server, 'core', '# peers connected',2))
161 check.add (StatisticsCondition (server, 'topology', '# peers connected',2)) 113 check.add (StatisticsCondition (server, 'topology', '# peers connected',2))
114 check.add (StatisticsCondition (server, 'dht', '# peers connected',2))
162 check.add (StatisticsCondition (server, 'fs', '# peers connected',2)) 115 check.add (StatisticsCondition (server, 'fs', '# peers connected',2))
163 116
164 check.run_blocking (check_timeout, success_connect_cont, fail_connect_cont) 117 check.run_blocking (check_timeout, success_cont, fail_cont)
165 118
166# 119#
167# Test execution 120# Test execution
168# 121#
122
123def SigHandler(signum = None, frame = None):
124 global success
125 global server
126 global client
127 global client_nat
128
129 print 'Test was aborted!'
130 if (None != server):
131 server.stop ()
132 if (None != client):
133 client.stop ()
134 if (None != client_nat):
135 client_nat.stop ()
136 cleanup ()
137 sys.exit(success)
138
169def run (): 139def run ():
170 global success 140 global success
171 global test 141 global test
172 global server 142 global server
173 global client 143 global client
174 global client2 144 global client_nat
175 145
176 success = False 146 success = False
177 test = Test ('test_integration_disconnect', verbose) 147 server = None
148 client = None
149 client_nat = None
150 test = Test ('test_integration_clique', verbose)
178 cleanup () 151 cleanup ()
179 152
180 server = Peer(test, './confs/c_bootstrap_server.conf'); 153 server = Peer(test, './confs/c_bootstrap_server.conf');
181 server.start(); 154 if (True != server.start()):
155 print 'Failed to start server'
156 if (None != server):
157 server.stop ()
158 cleanup ()
159 sys.exit(success)
182 160
183 client = Peer(test, './confs/c_no_nat_client.conf'); 161 client = Peer(test, './confs/c_no_nat_client.conf');
184 client.start(); 162 if (True != client.start()):
163 print 'Failed to start client'
164 if (None != server):
165 server.stop ()
166 if (None != client):
167 client.stop ()
168 cleanup ()
169 sys.exit(success)
185 170
186 client2 = Peer(test, './confs/c_no_nat_client_2.conf'); 171 client_nat = Peer(test, './confs/c_nat_client.conf');
187 client2.start(); 172 if (True != client_nat.start()):
173 print 'Failed to start client_nat'
174 if (None != server):
175 server.stop ()
176 if (None != client):
177 client.stop ()
178 if (None != client_nat):
179 client_nat.stop ()
180 cleanup ()
181 sys.exit(success)
188 182
189 if ((client.started == True) and (client2.started == True) and (server.started == True)): 183 if ((client.started == True) and (client_nat.started == True) and (server.started == True)):
190 test.p ('Peers started, running check') 184 test.p ('Peers started, running check')
191 check_connect () 185 check_connect ()
192 186
193 server.stop () 187 server.stop ()
194 client.stop () 188 client.stop ()
195 client2.stop () 189 client_nat.stop ()
196 190
197 cleanup () 191 cleanup ()
198 192
@@ -209,7 +203,7 @@ except (KeyboardInterrupt, SystemExit):
209 print 'Test interrupted' 203 print 'Test interrupted'
210 server.stop () 204 server.stop ()
211 client.stop () 205 client.stop ()
212 client2.stop () 206 client_nat.stop ()
213 cleanup () 207 cleanup ()
214if (success == False): 208if (success == False):
215 sys.exit(1) 209 sys.exit(1)