diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-17 15:32:54 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-17 15:32:54 +0000 |
commit | 00b211d05bf9ba8a82d120237963c5e84e57afeb (patch) | |
tree | 0860a2f0fd4212f242235a08f7535ea7c55006a6 /src/integration-tests | |
parent | 2098bde27ecaa44210d225db9cf45773785e4ba4 (diff) | |
download | gnunet-00b211d05bf9ba8a82d120237963c5e84e57afeb.tar.gz gnunet-00b211d05bf9ba8a82d120237963c5e84e57afeb.zip |
restructuring configs + enabling additional plugins
Diffstat (limited to 'src/integration-tests')
-rw-r--r-- | src/integration-tests/Makefile.am | 54 | ||||
-rw-r--r-- | src/integration-tests/confs/c_bootstrap_server.conf | 51 | ||||
-rw-r--r-- | src/integration-tests/confs/c_nat_client.conf | 55 | ||||
-rw-r--r-- | src/integration-tests/confs/c_no_nat_client.conf | 51 | ||||
-rw-r--r-- | src/integration-tests/confs/test_defaults.conf | 6 | ||||
-rwxr-xr-x | src/integration-tests/test_integration_reconnect.py.in (renamed from src/integration-tests/test_integration_restart.py.in) | 0 | ||||
-rwxr-xr-x | src/integration-tests/test_integration_reconnect_nat.py.in | 225 |
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 | |||
17 | check_SCRIPTS = \ | 17 | check_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 | ||
55 | test_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 | ||
59 | test_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 | ||
63 | test_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 | ||
57 | test_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 | ||
61 | test_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 | ||
66 | test_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 | ||
74 | test_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 | ||
78 | test_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 | ||
82 | test_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 | ||
86 | test_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 | ||
91 | EXTRA_DIST = \ | 99 | EXTRA_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] |
5 | GNUNET_TEST_HOME = /tmp/c_bootstrap_server/ | 4 | GNUNET_TEST_HOME = /tmp/c_bootstrap_server/ |
6 | 5 | ||
7 | [PEER] | 6 | [PEER] |
8 | PRIVATE_KEY = hostkeys/c_bootstrap_server | 7 | PRIVATE_KEY = hostkeys/c_bootstrap_server |
9 | 8 | ||
9 | |||
10 | [transport] | ||
11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-8 | ||
12 | PORT = 20011 | ||
13 | PLUGINS = tcp udp http_client https_client http_server https_server | ||
14 | |||
15 | [transport-tcp] | ||
16 | PORT = 20010 | ||
17 | ADVERTISED_PORT = 20010 | ||
18 | |||
19 | [transport-udp] | ||
20 | PORT = 20009 | ||
21 | |||
22 | [transport-http_server] | ||
23 | PORT = 20008 | ||
24 | |||
25 | [transport-https_server] | ||
26 | PORT = 20007 | ||
27 | |||
28 | [hostlist] | ||
29 | OPTIONS = -p | ||
30 | SERVERs = | ||
31 | |||
32 | [nat] | ||
33 | BEHIND_NAT = NO | ||
34 | DISABLEV6 = NO | ||
35 | |||
36 | |||
10 | [arm] | 37 | [arm] |
11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-4 | 38 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-4 |
12 | PORT = 20004 | 39 | PORT = 20004 |
@@ -45,17 +72,6 @@ BEHIND_NAT = NO | |||
45 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-6 | 72 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-6 |
46 | PORT = 20005 | 73 | PORT = 20005 |
47 | 74 | ||
48 | [transport] | ||
49 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-8 | ||
50 | PORT = 20011 | ||
51 | |||
52 | [transport-tcp] | ||
53 | PORT = 20010 | ||
54 | ADVERTISED_PORT = 20010 | ||
55 | |||
56 | [transport-udp] | ||
57 | PORT = 20009 | ||
58 | |||
59 | [gns] | 75 | [gns] |
60 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-gns-15 | 76 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-gns-15 |
61 | PORT = 20018 | 77 | PORT = 20018 |
@@ -64,12 +80,6 @@ PORT = 20018 | |||
64 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-16 | 80 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-16 |
65 | PORT = 20019 | 81 | PORT = 20019 |
66 | 82 | ||
67 | |||
68 | |||
69 | [hostlist] | ||
70 | OPTIONS = -p | ||
71 | SERVERs = | ||
72 | |||
73 | [vpn] | 83 | [vpn] |
74 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-vpn-15 | 84 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-vpn-15 |
75 | 85 | ||
@@ -85,10 +95,5 @@ PORT = 20001 | |||
85 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-nse-12 | 95 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-nse-12 |
86 | PORT = 20015 | 96 | PORT = 20015 |
87 | 97 | ||
88 | [transport-http] | ||
89 | PORT = 20008 | ||
90 | |||
91 | [transport-https] | ||
92 | PORT = 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] | ||
4 | GNUNET_TEST_HOME = /tmp/c_nat_client/ | ||
5 | |||
6 | [PEER] | ||
7 | PRIVATE_KEY = hostkeys/c_nat_client | ||
8 | |||
9 | |||
10 | [transport] | ||
11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-50 | ||
12 | PORT = 20065 | ||
13 | PLUGINS = tcp udp | ||
14 | |||
15 | [transport-tcp] | ||
16 | PORT = 0 | ||
17 | ADVERTISED_PORT = 20064 | ||
18 | |||
19 | [transport-udp] | ||
20 | PORT = 0 | ||
21 | |||
22 | [hostlist] | ||
23 | SERVERS = http://localhost:8080/ | ||
24 | |||
25 | [nat] | ||
26 | BEHIND_NAT = YES | ||
27 | DISABLEV6 = NO | ||
28 | |||
29 | |||
3 | [arm] | 30 | [arm] |
4 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-46 | 31 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-46 |
5 | PORT = 20058 | 32 | PORT = 20058 |
@@ -28,20 +55,6 @@ PORT = 20054 | |||
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-48 | 55 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-48 |
29 | PORT = 20059 | 56 | PORT = 20059 |
30 | 57 | ||
31 | [transport] | ||
32 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-50 | ||
33 | PORT = 20065 | ||
34 | |||
35 | [transport-tcp] | ||
36 | PORT = 0 | ||
37 | ADVERTISED_PORT = 20064 | ||
38 | |||
39 | [transport-udp] | ||
40 | PORT = 0 | ||
41 | |||
42 | [hostlist] | ||
43 | SERVERS = http://localhost:8080/ | ||
44 | |||
45 | [dv] | 58 | [dv] |
46 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-b_nat_c-1 | 59 | UNIXPATH = $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 | |||
49 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-peerinfo-52 | 62 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-peerinfo-52 |
50 | PORT = 20067 | 63 | PORT = 20067 |
51 | 64 | ||
52 | [PATHS] | ||
53 | GNUNET_TEST_HOME = /tmp/c_nat_client | ||
54 | |||
55 | [PEER] | ||
56 | PRIVATE_KEY = hostkeys/c_nat_client | ||
57 | |||
58 | [nse] | 65 | [nse] |
59 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-nse-54 | 66 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-nse-54 |
60 | PORT = 20069 | 67 | PORT = 20069 \ No newline at end of file |
61 | |||
62 | [transport-http] | ||
63 | PORT = 0 | ||
64 | |||
65 | [transport-https] | ||
66 | PORT = 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] |
7 | PRIVATE_KEY = hostkeys/c_no_nat_client | 7 | PRIVATE_KEY = hostkeys/c_no_nat_client |
8 | 8 | ||
9 | |||
10 | [transport] | ||
11 | PLUGINS = tcp udp http_client https_client | ||
12 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-22 | ||
13 | PORT = 20029 | ||
14 | |||
15 | [transport-tcp] | ||
16 | PORT = 20028 | ||
17 | ADVERTISED_PORT = 20028 | ||
18 | |||
19 | [transport-udp] | ||
20 | PORT = 20027 | ||
21 | BROADCAST_INTERVAL = 30 s | ||
22 | |||
23 | [hostlist] | ||
24 | SERVERS = http://localhost:8080/ | ||
25 | |||
26 | [nat] | ||
27 | BEHIND_NAT = NO | ||
28 | DISABLEV6 = NO | ||
29 | |||
30 | |||
9 | [arm] | 31 | [arm] |
10 | DEFAULTSERVICES = topology hostlist dht nse mesh fs | ||
11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-18 | 32 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-18 |
12 | PORT = 20022 | 33 | PORT = 20022 |
13 | 34 | ||
@@ -53,10 +74,6 @@ PORT = 20018 | |||
53 | DATABASE = heap | 74 | DATABASE = heap |
54 | QUOTA = 50 MB | 75 | QUOTA = 50 MB |
55 | 76 | ||
56 | [nat] | ||
57 | BEHIND_NAT = NO | ||
58 | DISABLEV6 = NO | ||
59 | |||
60 | [gnunet-nat-server] | 77 | [gnunet-nat-server] |
61 | PORT = 20020 | 78 | PORT = 20020 |
62 | 79 | ||
@@ -64,23 +81,6 @@ PORT = 20020 | |||
64 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-20 | 81 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-20 |
65 | PORT = 20023 | 82 | PORT = 20023 |
66 | 83 | ||
67 | [transport] | ||
68 | PLUGINS = tcp udp | ||
69 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-22 | ||
70 | UNIX_MATCH_UID = NO | ||
71 | PORT = 20029 | ||
72 | |||
73 | [transport-tcp] | ||
74 | PORT = 20028 | ||
75 | ADVERTISED_PORT = 20028 | ||
76 | |||
77 | [transport-udp] | ||
78 | PORT = 20027 | ||
79 | BROADCAST_INTERVAL = 30 s | ||
80 | |||
81 | [hostlist] | ||
82 | SERVERS = http://localhost:8080/ | ||
83 | |||
84 | [vpn] | 84 | [vpn] |
85 | BINARY = gnunet-service-vpn | 85 | BINARY = gnunet-service-vpn |
86 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-vpn-29 | 86 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-vpn-29 |
@@ -114,10 +114,3 @@ PORT = 20038 | |||
114 | [dv] | 114 | [dv] |
115 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-36 | 115 | UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-36 |
116 | PORT = 20039 | 116 | PORT = 20039 |
117 | |||
118 | [transport-http] | ||
119 | PORT = 20026 | ||
120 | |||
121 | [transport-https] | ||
122 | PORT = 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 | |||
40 | WEAKRANDOM = NO | 40 | WEAKRANDOM = NO |
41 | 41 | ||
42 | [nat] | 42 | [nat] |
43 | BEHIND_NAT = YES | 43 | BEHIND_NAT = NO |
44 | DISABLEV6 = YES | ||
45 | EXTERNAL_ADDRESS = 127.0.0.1 | 44 | EXTERNAL_ADDRESS = 127.0.0.1 |
46 | INTERNAL_ADDRESS = 127.0.0.1 | 45 | INTERNAL_ADDRESS = 127.0.0.1 |
47 | BINDTO = 127.0.0.1 | 46 | BINDTO = 127.0.0.1 |
@@ -53,9 +52,6 @@ STATE_DIR = $GNUNET_TEST_HOME/persistence/ | |||
53 | UPDATE_DIR = $GNUNET_TEST_HOME/updates/ | 52 | UPDATE_DIR = $GNUNET_TEST_HOME/updates/ |
54 | TRUST = $GNUNET_TEST_HOME/data/credit/ | 53 | TRUST = $GNUNET_TEST_HOME/data/credit/ |
55 | 54 | ||
56 | [transport] | ||
57 | PLUGINS = tcp | ||
58 | |||
59 | [transport-tcp] | 55 | [transport-tcp] |
60 | USE_LOCALADDR = YES | 56 | USE_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 | # | ||
21 | import sys | ||
22 | import os | ||
23 | import subprocess | ||
24 | import re | ||
25 | import shutil | ||
26 | import time | ||
27 | import signal | ||
28 | from gnunet_testing import Peer | ||
29 | from gnunet_testing import Test | ||
30 | from gnunet_testing import Check | ||
31 | from gnunet_testing import Condition | ||
32 | from 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 | |||
46 | testname = "test_integration_restart" | ||
47 | verbose = True | ||
48 | check_timeout = 180 | ||
49 | |||
50 | if os.name == "nt": | ||
51 | tmp = os.getenv ("TEMP") | ||
52 | else: | ||
53 | tmp = "/tmp" | ||
54 | |||
55 | def 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 | |||
77 | def 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 | |||
85 | def fail_restart_cont (check): | ||
86 | global success | ||
87 | success = False; | ||
88 | print 'Peers failed to connect after restart' | ||
89 | check.evaluate(True) | ||
90 | |||
91 | |||
92 | def 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 | |||
119 | def fail_connect_cont (check): | ||
120 | global success | ||
121 | success= False; | ||
122 | print 'Peers failed to connect' | ||
123 | check.evaluate(True) | ||
124 | |||
125 | |||
126 | def 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 | |||
147 | def 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 | |||
160 | def 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 | |||
213 | try: | ||
214 | run () | ||
215 | except (KeyboardInterrupt, SystemExit): | ||
216 | print 'Test interrupted' | ||
217 | server.stop () | ||
218 | client.stop () | ||
219 | cleanup () | ||
220 | if (success == False): | ||
221 | sys.exit(1) | ||
222 | else: | ||
223 | sys.exit(0) | ||
224 | |||
225 | \ No newline at end of file | ||