aboutsummaryrefslogtreecommitdiff
path: root/src/integration-tests
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-12-17 15:32:54 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-12-17 15:32:54 +0000
commit00b211d05bf9ba8a82d120237963c5e84e57afeb (patch)
tree0860a2f0fd4212f242235a08f7535ea7c55006a6 /src/integration-tests
parent2098bde27ecaa44210d225db9cf45773785e4ba4 (diff)
downloadgnunet-00b211d05bf9ba8a82d120237963c5e84e57afeb.tar.gz
gnunet-00b211d05bf9ba8a82d120237963c5e84e57afeb.zip
restructuring configs + enabling additional plugins
Diffstat (limited to 'src/integration-tests')
-rw-r--r--src/integration-tests/Makefile.am54
-rw-r--r--src/integration-tests/confs/c_bootstrap_server.conf51
-rw-r--r--src/integration-tests/confs/c_nat_client.conf55
-rw-r--r--src/integration-tests/confs/c_no_nat_client.conf51
-rw-r--r--src/integration-tests/confs/test_defaults.conf6
-rwxr-xr-xsrc/integration-tests/test_integration_reconnect.py.in (renamed from src/integration-tests/test_integration_restart.py.in)0
-rwxr-xr-xsrc/integration-tests/test_integration_reconnect_nat.py.in225
7 files changed, 335 insertions, 107 deletions
diff --git a/src/integration-tests/Makefile.am b/src/integration-tests/Makefile.am
index 393184181..708b878c9 100644
--- a/src/integration-tests/Makefile.am
+++ b/src/integration-tests/Makefile.am
@@ -17,7 +17,8 @@ if HAVE_PYTHON
17check_SCRIPTS = \ 17check_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_restart.py 20 test_integration_reconnect.py \
21 test_integration_reconnect_nat.py
21# test_integration_bootstrap_and_connect_and_disconnect.py \ 22# test_integration_bootstrap_and_connect_and_disconnect.py \
22# test_integration_bootstrap_and_connect_and_disconnect_nat.py \ 23# test_integration_bootstrap_and_connect_and_disconnect_nat.py \
23# test_integration_clique.py \ 24# test_integration_clique.py \
@@ -51,41 +52,48 @@ test_integration_bootstrap_and_connect.py: test_integration_bootstrap_and_connec
51 $(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect.py.in > test_integration_bootstrap_and_connect.py 52 $(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect.py.in > test_integration_bootstrap_and_connect.py
52 chmod +x test_integration_bootstrap_and_connect.py 53 chmod +x test_integration_bootstrap_and_connect.py
53 54
55test_integration_disconnect.py: test_integration_disconnect.py.in Makefile
56 $(do_subst) < $(srcdir)/test_integration_disconnect.py.in > test_integration_disconnect.py
57 chmod +x test_integration_disconnect.py
54 58
59test_integration_reconnect.py: test_integration_reconnect.py.in Makefile
60 $(do_subst) < $(srcdir)/test_integration_reconnect.py.in > test_integration_reconnect.py
61 chmod +x test_integration_reconnect.py
55 62
63test_integration_reconnect_nat.py: test_integration_reconnect_nat.py.in Makefile
64 $(do_subst) < $(srcdir)/test_integration_reconnect_nat.py.in > test_integration_reconnect_nat.py
65 chmod +x test_integration_reconnect_nat.py
56 66
57test_integration_bootstrap_and_connect_and_disconnect.py: test_integration_bootstrap_and_connect_and_disconnect.py.in Makefile
58 $(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect_and_disconnect.py.in > test_integration_bootstrap_and_connect_and_disconnect.py
59 chmod +x test_integration_bootstrap_and_connect_and_disconnect.py
60 67
61test_integration_bootstrap_and_connect_and_disconnect_nat.py: test_integration_bootstrap_and_connect_and_disconnect_nat.py.in Makefile
62 $(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect_and_disconnect_nat.py.in > test_integration_bootstrap_and_connect_and_disconnect_nat.py
63 chmod +x test_integration_bootstrap_and_connect_and_disconnect_nat.py
64 68
65 69
66test_integration_disconnect.py: test_integration_disconnect.py.in Makefile 70#test_integration_bootstrap_and_connect_and_disconnect.py: test_integration_bootstrap_and_connect_and_disconnect.py.in Makefile
67 $(do_subst) < $(srcdir)/test_integration_disconnect.py.in > test_integration_disconnect.py 71# $(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect_and_disconnect.py.in > test_integration_bootstrap_and_connect_and_disconnect.py
68 chmod +x test_integration_disconnect.py 72# chmod +x test_integration_bootstrap_and_connect_and_disconnect.py
73
74#test_integration_bootstrap_and_connect_and_disconnect_nat.py: test_integration_bootstrap_and_connect_and_disconnect_nat.py.in Makefile
75# $(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect_and_disconnect_nat.py.in > test_integration_bootstrap_and_connect_and_disconnect_nat.py
76# chmod +x test_integration_bootstrap_and_connect_and_disconnect_nat.py
77
78
69 79
70#test_integration_disconnect_nat.py: test_integration_disconnect_nat.py.in Makefile 80#test_integration_disconnect_nat.py: test_integration_disconnect_nat.py.in Makefile
71# $(do_subst) < $(srcdir)/test_integration_disconnect_nat.py.in > test_integration_disconnect_nat.py 81# $(do_subst) < $(srcdir)/test_integration_disconnect_nat.py.in > test_integration_disconnect_nat.py
72# chmod +x test_integration_disconnect_nat.py 82# chmod +x test_integration_disconnect_nat.py
73 83
74test_integration_restart.py: test_integration_restart.py.in Makefile
75 $(do_subst) < $(srcdir)/test_integration_restart.py.in > test_integration_restart.py
76 chmod +x test_integration_restart.py
77 84
78test_integration_clique.py: test_integration_clique.py.in Makefile
79 $(do_subst) < $(srcdir)/test_integration_clique.py.in > test_integration_clique.py
80 chmod +x test_integration_clique.py
81 85
82test_integration_clique_nat.py: test_integration_clique_nat.py.in Makefile 86#test_integration_clique.py: test_integration_clique.py.in Makefile
83 $(do_subst) < $(srcdir)/test_integration_clique_nat.py.in > test_integration_clique_nat.py 87# $(do_subst) < $(srcdir)/test_integration_clique.py.in > test_integration_clique.py
84 chmod +x test_integration_clique_nat.py 88# chmod +x test_integration_clique.py
89
90#test_integration_clique_nat.py: test_integration_clique_nat.py.in Makefile
91# $(do_subst) < $(srcdir)/test_integration_clique_nat.py.in > test_integration_clique_nat.py
92# chmod +x test_integration_clique_nat.py
85 93
86test_integration_connect_on_restart.py: test_integration_connect_on_restart.py.in Makefile 94#test_integration_connect_on_restart.py: test_integration_connect_on_restart.py.in Makefile
87 $(do_subst) < $(srcdir)/test_integration_connect_on_restart.py.in > test_integration_connect_on_restart.py 95# $(do_subst) < $(srcdir)/test_integration_connect_on_restart.py.in > test_integration_connect_on_restart.py
88 chmod +x test_integration_connect_on_restart.py 96# chmod +x test_integration_connect_on_restart.py
89 97
90 98
91EXTRA_DIST = \ 99EXTRA_DIST = \
@@ -96,7 +104,7 @@ EXTRA_DIST = \
96 test_integration_bootstrap_and_connect_and_disconnect_nat.py.in \ 104 test_integration_bootstrap_and_connect_and_disconnect_nat.py.in \
97 test_integration_connect_on_restart.py.in \ 105 test_integration_connect_on_restart.py.in \
98 test_integration_disconnect.py.in \ 106 test_integration_disconnect.py.in \
99 test_integration_restart.py.in \ 107 test_integration_reconnect.py.in \
100 test_integration_clique.py.in \ 108 test_integration_clique.py.in \
101 test_integration_clique_nat.py.in \ 109 test_integration_clique_nat.py.in \
102 confs/test_defaults.conf \ 110 confs/test_defaults.conf \
diff --git a/src/integration-tests/confs/c_bootstrap_server.conf b/src/integration-tests/confs/c_bootstrap_server.conf
index f6bd4a439..b6653ccd5 100644
--- a/src/integration-tests/confs/c_bootstrap_server.conf
+++ b/src/integration-tests/confs/c_bootstrap_server.conf
@@ -1,12 +1,39 @@
1@INLINE@ confs/test_defaults.conf 1@INLINE@ confs/test_defaults.conf
2 2
3
4[PATHS] 3[PATHS]
5GNUNET_TEST_HOME = /tmp/c_bootstrap_server/ 4GNUNET_TEST_HOME = /tmp/c_bootstrap_server/
6 5
7[PEER] 6[PEER]
8PRIVATE_KEY = hostkeys/c_bootstrap_server 7PRIVATE_KEY = hostkeys/c_bootstrap_server
9 8
9
10[transport]
11UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-8
12PORT = 20011
13PLUGINS = tcp udp http_client https_client http_server https_server
14
15[transport-tcp]
16PORT = 20010
17ADVERTISED_PORT = 20010
18
19[transport-udp]
20PORT = 20009
21
22[transport-http_server]
23PORT = 20008
24
25[transport-https_server]
26PORT = 20007
27
28[hostlist]
29OPTIONS = -p
30SERVERs =
31
32[nat]
33BEHIND_NAT = NO
34DISABLEV6 = NO
35
36
10[arm] 37[arm]
11UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-4 38UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-4
12PORT = 20004 39PORT = 20004
@@ -45,17 +72,6 @@ BEHIND_NAT = NO
45UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-6 72UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-6
46PORT = 20005 73PORT = 20005
47 74
48[transport]
49UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-8
50PORT = 20011
51
52[transport-tcp]
53PORT = 20010
54ADVERTISED_PORT = 20010
55
56[transport-udp]
57PORT = 20009
58
59[gns] 75[gns]
60UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-gns-15 76UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-gns-15
61PORT = 20018 77PORT = 20018
@@ -64,12 +80,6 @@ PORT = 20018
64UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-16 80UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-16
65PORT = 20019 81PORT = 20019
66 82
67
68
69[hostlist]
70OPTIONS = -p
71SERVERs =
72
73[vpn] 83[vpn]
74UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-vpn-15 84UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-vpn-15
75 85
@@ -85,10 +95,5 @@ PORT = 20001
85UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-nse-12 95UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-nse-12
86PORT = 20015 96PORT = 20015
87 97
88[transport-http]
89PORT = 20008
90
91[transport-https]
92PORT = 20007
93 98
94 99
diff --git a/src/integration-tests/confs/c_nat_client.conf b/src/integration-tests/confs/c_nat_client.conf
index 942360c93..d4126a8b5 100644
--- a/src/integration-tests/confs/c_nat_client.conf
+++ b/src/integration-tests/confs/c_nat_client.conf
@@ -1,5 +1,32 @@
1@INLINE@ confs/test_defaults.conf 1@INLINE@ confs/test_defaults.conf
2 2
3[PATHS]
4GNUNET_TEST_HOME = /tmp/c_nat_client/
5
6[PEER]
7PRIVATE_KEY = hostkeys/c_nat_client
8
9
10[transport]
11UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-50
12PORT = 20065
13PLUGINS = tcp udp
14
15[transport-tcp]
16PORT = 0
17ADVERTISED_PORT = 20064
18
19[transport-udp]
20PORT = 0
21
22[hostlist]
23SERVERS = http://localhost:8080/
24
25[nat]
26BEHIND_NAT = YES
27DISABLEV6 = NO
28
29
3[arm] 30[arm]
4UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-46 31UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-46
5PORT = 20058 32PORT = 20058
@@ -28,20 +55,6 @@ PORT = 20054
28UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-48 55UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-48
29PORT = 20059 56PORT = 20059
30 57
31[transport]
32UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-50
33PORT = 20065
34
35[transport-tcp]
36PORT = 0
37ADVERTISED_PORT = 20064
38
39[transport-udp]
40PORT = 0
41
42[hostlist]
43SERVERS = http://localhost:8080/
44
45[dv] 58[dv]
46UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-b_nat_c-1 59UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-b_nat_c-1
47 60
@@ -49,18 +62,6 @@ UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-b_nat_c-1
49UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-peerinfo-52 62UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-peerinfo-52
50PORT = 20067 63PORT = 20067
51 64
52[PATHS]
53GNUNET_TEST_HOME = /tmp/c_nat_client
54
55[PEER]
56PRIVATE_KEY = hostkeys/c_nat_client
57
58[nse] 65[nse]
59UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-nse-54 66UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-nse-54
60PORT = 20069 67PORT = 20069 \ No newline at end of file
61
62[transport-http]
63PORT = 0
64
65[transport-https]
66PORT = 0
diff --git a/src/integration-tests/confs/c_no_nat_client.conf b/src/integration-tests/confs/c_no_nat_client.conf
index f26925265..731331ba3 100644
--- a/src/integration-tests/confs/c_no_nat_client.conf
+++ b/src/integration-tests/confs/c_no_nat_client.conf
@@ -6,8 +6,29 @@ GNUNET_TEST_HOME = /tmp/c_no_nat_client/
6[PEER] 6[PEER]
7PRIVATE_KEY = hostkeys/c_no_nat_client 7PRIVATE_KEY = hostkeys/c_no_nat_client
8 8
9
10[transport]
11PLUGINS = tcp udp http_client https_client
12UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-22
13PORT = 20029
14
15[transport-tcp]
16PORT = 20028
17ADVERTISED_PORT = 20028
18
19[transport-udp]
20PORT = 20027
21BROADCAST_INTERVAL = 30 s
22
23[hostlist]
24SERVERS = http://localhost:8080/
25
26[nat]
27BEHIND_NAT = NO
28DISABLEV6 = NO
29
30
9[arm] 31[arm]
10DEFAULTSERVICES = topology hostlist dht nse mesh fs
11UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-18 32UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-18
12PORT = 20022 33PORT = 20022
13 34
@@ -53,10 +74,6 @@ PORT = 20018
53DATABASE = heap 74DATABASE = heap
54QUOTA = 50 MB 75QUOTA = 50 MB
55 76
56[nat]
57BEHIND_NAT = NO
58DISABLEV6 = NO
59
60[gnunet-nat-server] 77[gnunet-nat-server]
61PORT = 20020 78PORT = 20020
62 79
@@ -64,23 +81,6 @@ PORT = 20020
64UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-20 81UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-20
65PORT = 20023 82PORT = 20023
66 83
67[transport]
68PLUGINS = tcp udp
69UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-22
70UNIX_MATCH_UID = NO
71PORT = 20029
72
73[transport-tcp]
74PORT = 20028
75ADVERTISED_PORT = 20028
76
77[transport-udp]
78PORT = 20027
79BROADCAST_INTERVAL = 30 s
80
81[hostlist]
82SERVERS = http://localhost:8080/
83
84[vpn] 84[vpn]
85BINARY = gnunet-service-vpn 85BINARY = gnunet-service-vpn
86UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-vpn-29 86UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-vpn-29
@@ -114,10 +114,3 @@ PORT = 20038
114[dv] 114[dv]
115UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-36 115UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-36
116PORT = 20039 116PORT = 20039
117
118[transport-http]
119PORT = 20026
120
121[transport-https]
122PORT = 20025
123
diff --git a/src/integration-tests/confs/test_defaults.conf b/src/integration-tests/confs/test_defaults.conf
index e5f5bd264..75677acc5 100644
--- a/src/integration-tests/confs/test_defaults.conf
+++ b/src/integration-tests/confs/test_defaults.conf
@@ -40,8 +40,7 @@ QUOTA = 1 MB
40WEAKRANDOM = NO 40WEAKRANDOM = NO
41 41
42[nat] 42[nat]
43BEHIND_NAT = YES 43BEHIND_NAT = NO
44DISABLEV6 = YES
45EXTERNAL_ADDRESS = 127.0.0.1 44EXTERNAL_ADDRESS = 127.0.0.1
46INTERNAL_ADDRESS = 127.0.0.1 45INTERNAL_ADDRESS = 127.0.0.1
47BINDTO = 127.0.0.1 46BINDTO = 127.0.0.1
@@ -53,9 +52,6 @@ STATE_DIR = $GNUNET_TEST_HOME/persistence/
53UPDATE_DIR = $GNUNET_TEST_HOME/updates/ 52UPDATE_DIR = $GNUNET_TEST_HOME/updates/
54TRUST = $GNUNET_TEST_HOME/data/credit/ 53TRUST = $GNUNET_TEST_HOME/data/credit/
55 54
56[transport]
57PLUGINS = tcp
58
59[transport-tcp] 55[transport-tcp]
60USE_LOCALADDR = YES 56USE_LOCALADDR = YES
61 57
diff --git a/src/integration-tests/test_integration_restart.py.in b/src/integration-tests/test_integration_reconnect.py.in
index 62bd4bd98..62bd4bd98 100755
--- a/src/integration-tests/test_integration_restart.py.in
+++ b/src/integration-tests/test_integration_reconnect.py.in
diff --git a/src/integration-tests/test_integration_reconnect_nat.py.in b/src/integration-tests/test_integration_reconnect_nat.py.in
new file mode 100755
index 000000000..4f55be463
--- /dev/null
+++ b/src/integration-tests/test_integration_reconnect_nat.py.in
@@ -0,0 +1,225 @@
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#
21import sys
22import os
23import subprocess
24import re
25import shutil
26import time
27import signal
28from gnunet_testing import Peer
29from gnunet_testing import Test
30from gnunet_testing import Check
31from gnunet_testing import Condition
32from gnunet_testing import *
33
34
35#
36# This test tests if a fresh peer bootstraps from a hostlist server and then
37# successfully connects to the server. When both peers are connected
38# in transport, core, topology, fs, botth peers are shutdown and restarted
39#
40# Conditions for successful exit:
41# Both peers have 1 connected peer in transport, core, topology, fs after restart
42
43#definitions
44
45
46testname = "test_integration_restart"
47verbose = True
48check_timeout = 180
49
50if os.name == "nt":
51 tmp = os.getenv ("TEMP")
52else:
53 tmp = "/tmp"
54
55def cleanup ():
56 retries = 10
57 path = os.path.join (tmp, "c_bootstrap_server")
58 test.p ("Removing " + path)
59 while ((os.path.exists(path)) and (retries > 0)):
60 shutil.rmtree ((path), False)
61 time.sleep (1)
62 retries -= 1
63 if (os.path.exists(path)):
64 test.p ("Failed to remove " + path)
65
66
67 retries = 10
68 path = os.path.join (tmp, "c_nat_client")
69 test.p ("Removing " + path)
70 while ((os.path.exists(path)) and (retries > 0)):
71 shutil.rmtree ((path), False)
72 time.sleep (1)
73 retries -= 1
74 if (os.path.exists(path)):
75 test.p ("Failed to remove " + path)
76
77def success_restart_cont (check):
78 global success
79 print 'Peers connected successfully after restart'
80 server.stop ()
81 client.stop ()
82 success = True;
83
84
85def fail_restart_cont (check):
86 global success
87 success = False;
88 print 'Peers failed to connect after restart'
89 check.evaluate(True)
90
91
92def success_connect_cont (check):
93 print 'Peers connected successfully'
94 server.stop ()
95 client.stop ()
96
97 time.sleep(5)
98
99 test.p ('Restarting client & server')
100 server.start ()
101 client.start ()
102
103 check = Check (test)
104 check.add (StatisticsCondition (client, 'transport', '# peers connected',1))
105 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',1))
106 check.add (StatisticsCondition (client, 'core', '# peers connected',1))
107 check.add (StatisticsCondition (client, 'topology', '# peers connected',1))
108 check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
109
110 check.add (StatisticsCondition (server, 'transport', '# peers connected',1))
111 check.add (StatisticsCondition (server, 'core', '# neighbour entries allocated',1))
112 check.add (StatisticsCondition (server, 'core', '# peers connected',1))
113 check.add (StatisticsCondition (server, 'topology', '# peers connected',1))
114 check.add (StatisticsCondition (server, 'fs', '# peers connected',1))
115
116 check.run_blocking (check_timeout, success_restart_cont, fail_restart_cont)
117
118
119def fail_connect_cont (check):
120 global success
121 success= False;
122 print 'Peers failed to connect'
123 check.evaluate(True)
124
125
126def check_connect ():
127 check = Check (test)
128 check.add (StatisticsCondition (client, 'transport', '# peers connected',1))
129 check.add (StatisticsCondition (client, 'core', '# neighbour entries allocated',1))
130 check.add (StatisticsCondition (client, 'core', '# peers connected',1))
131 check.add (StatisticsCondition (client, 'topology', '# peers connected',1))
132 check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
133
134 check.add (StatisticsCondition (server, 'transport', '# peers connected',1))
135 check.add (StatisticsCondition (server, 'core', '# neighbour entries allocated',1))
136 check.add (StatisticsCondition (server, 'core', '# peers connected',1))
137 check.add (StatisticsCondition (server, 'topology', '# peers connected',1))
138 check.add (StatisticsCondition (server, 'fs', '# peers connected',1))
139
140 check.run_blocking (check_timeout, success_connect_cont, fail_connect_cont)
141
142#
143# Test execution
144#
145
146
147def SigHandler(signum = None, frame = None):
148 global success
149 global server
150 global client
151
152 print 'Test was aborted!'
153 if (None != server):
154 server.stop ()
155 if (None != server):
156 client.stop ()
157 cleanup ()
158 sys.exit(success)
159
160def run ():
161 global success
162 global test
163 global server
164 global client
165
166 success = False
167 server = None
168 client = None
169
170 for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]:
171 signal.signal(sig, SigHandler)
172
173
174 test = Test ('test_integration_disconnect', verbose)
175 cleanup ()
176 server = Peer(test, './confs/c_bootstrap_server.conf');
177 server.start();
178
179 client = Peer(test, './confs/c_nat_client.conf');
180 client.start();
181
182
183 if (True != server.start()):
184 print 'Failed to start server'
185 if (None != server):
186 server.stop ()
187 if (None != server):
188 client.stop ()
189 cleanup ()
190 sys.exit(success)
191 if (True != client.start()):
192 print 'Failed to start client'
193 if (None != server):
194 server.stop ()
195 if (None != server):
196 client.stop ()
197 cleanup ()
198 sys.exit(success)
199
200 check_connect ()
201
202 server.stop ()
203 client.stop ()
204 cleanup ()
205
206 if (success == False):
207 print ('Test failed')
208 return True
209 else:
210 return False
211
212
213try:
214 run ()
215except (KeyboardInterrupt, SystemExit):
216 print 'Test interrupted'
217 server.stop ()
218 client.stop ()
219 cleanup ()
220if (success == False):
221 sys.exit(1)
222else:
223 sys.exit(0)
224
225 \ No newline at end of file