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-16 12:25:28 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-12-16 12:25:28 +0000
commit4997b98b69d53d14085f0da4d7d4b002f3d59100 (patch)
tree95dc9c487b9a23124f7aae48409d18fa6c20b574 /src/integration-tests/test_integration_bootstrap_and_connect.py.in
parent17f94e7fc0dfabbbd9868b72f957209549a16b5a (diff)
downloadgnunet-4997b98b69d53d14085f0da4d7d4b002f3d59100.tar.gz
gnunet-4997b98b69d53d14085f0da4d7d4b002f3d59100.zip
added support for interupting a test
Diffstat (limited to 'src/integration-tests/test_integration_bootstrap_and_connect.py.in')
-rwxr-xr-xsrc/integration-tests/test_integration_bootstrap_and_connect.py.in78
1 files changed, 53 insertions, 25 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 581179f99..a8aff73d7 100755
--- a/src/integration-tests/test_integration_bootstrap_and_connect.py.in
+++ b/src/integration-tests/test_integration_bootstrap_and_connect.py.in
@@ -39,11 +39,18 @@ from gnunet_testing import *
39# Conditions for successful exit: 39# Conditions for successful exit:
40# Both peers have 1 connected peer in transport, core, topology, fs 40# Both peers have 1 connected peer in transport, core, topology, fs
41 41
42#
43# This test tests if a fresh peer bootstraps from a hostlist server and then
44# successfully connects to the server
45#
46# Conditions for successful exit:
47# Both peers have 1 connected peer in transport, core, topology, fs
48
42#definitions 49#definitions
43 50
44testname = "test_integration_bootstrap_and_connect" 51testname = "test_integration_bootstrap_and_connect"
45verbose = False 52verbose = True
46timeout = 100 53check_timeout = 30
47 54
48 55
49def cleanup (): 56def cleanup ():
@@ -64,7 +71,10 @@ def fail_cont (check):
64 check.eval(True) 71 check.eval(True)
65 72
66def check (): 73def check ():
67 74 global test
75 global server
76 global client
77 global success
68 check = Check (test) 78 check = Check (test)
69 check.add (StatisticsCondition (client, 'transport', '# peers connected',1)) 79 check.add (StatisticsCondition (client, 'transport', '# peers connected',1))
70 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',1)) 80 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',1))
@@ -79,32 +89,50 @@ def check ():
79 check.add (StatisticsCondition (server, 'topology', '# peers connected',1)) 89 check.add (StatisticsCondition (server, 'topology', '# peers connected',1))
80 check.add (StatisticsCondition (server, 'fs', '# peers connected',1)) 90 check.add (StatisticsCondition (server, 'fs', '# peers connected',1))
81 91
82 check.run_blocking (10, success_cont, fail_cont) 92 check.run_blocking (check_timeout, success_cont, fail_cont)
83 93
84# 94#
85# Test execution 95# Test execution
86# 96#
87success = False
88
89test = Test ('test_integration_bootstrap_and_connect.py', verbose)
90 97
91server = Peer(test, './confs/c_bootstrap_server.conf'); 98def run ():
92server.start(); 99 global test
93 100 global server
94client = Peer(test, './confs/c_no_nat_client.conf'); 101 global client
95client.start(); 102 global success
96 103
97if ((client.started == True) and (server.started == True)): 104 success = False
98 test.p ('Peers started, running check') 105 test = Test ('test_integration_bootstrap_and_connect.py', verbose)
99 check () 106
100 107 server = Peer(test, './confs/c_bootstrap_server.conf');
101server.stop () 108 client = Peer(test, './confs/c_no_nat_client.conf');
102client.stop ()
103 109
104cleanup () 110 server.start();
111 client.start();
112
113 if ((client.started == True) and (server.started == True)):
114 test.p ('Peers started, running check')
115 time.sleep(5)
116 check ()
117
118 print 'stop in run'
119 server.stop ()
120 client.stop ()
121
122 cleanup ()
123
124 if (success == False):
125 print ('Test failed')
126 return False
127 else:
128 return True
105 129
106if (success == False): 130try:
107 print ('Test failed') 131 run ()
108 exit (1) 132except (KeyboardInterrupt, SystemExit):
109else: 133 print 'Test interrupted'
110 exit (0) 134 server.stop ()
135 client.stop ()
136 cleanup ()
137sys.exit(success)
138 \ No newline at end of file