2012-07-06 05:09:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Tests for Serval rhizome protocol.
|
|
|
|
#
|
2013-02-06 08:25:31 +00:00
|
|
|
# Copyright 2012 Serval Project, Inc.
|
2012-07-06 05:09:25 +00:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
source "${0%/*}/../testframework.sh"
|
|
|
|
source "${0%/*}/../testdefs.sh"
|
|
|
|
source "${0%/*}/../testdefs_rhizome.sh"
|
|
|
|
|
|
|
|
shopt -s extglob
|
|
|
|
|
2012-10-18 01:16:32 +00:00
|
|
|
finally() {
|
|
|
|
stop_all_servald_servers
|
|
|
|
}
|
|
|
|
|
2012-07-06 05:09:25 +00:00
|
|
|
teardown() {
|
|
|
|
kill_all_servald_processes
|
|
|
|
assert_no_servald_processes
|
2012-10-18 01:16:32 +00:00
|
|
|
report_all_servald_servers
|
2012-07-06 05:09:25 +00:00
|
|
|
}
|
|
|
|
|
2012-07-11 07:13:21 +00:00
|
|
|
# Called by start_servald_instances for each instance.
|
2012-07-06 05:09:25 +00:00
|
|
|
configure_servald_server() {
|
2012-12-06 02:01:19 +00:00
|
|
|
executeOk_servald config \
|
|
|
|
set log.show_pid on \
|
|
|
|
set log.show_time on \
|
|
|
|
set debug.rhizome on \
|
2012-12-11 05:29:46 +00:00
|
|
|
set debug.rhizome_tx on \
|
|
|
|
set debug.rhizome_rx on \
|
2012-12-06 02:01:19 +00:00
|
|
|
set server.respawn_on_crash off \
|
2012-12-07 03:39:55 +00:00
|
|
|
set mdp.iftype.wifi.tick_ms 500
|
2012-07-06 05:09:25 +00:00
|
|
|
}
|
|
|
|
|
2012-09-28 08:20:49 +00:00
|
|
|
setup_curl_7() {
|
2012-09-27 08:06:22 +00:00
|
|
|
case "$(curl --version | tr '\n' ' ')" in
|
|
|
|
curl\ @(7|8|9|[1-9][0-1]).*\ Protocols:*\ http\ *) ;;
|
|
|
|
'') fail "curl(1) command is not present";;
|
|
|
|
*) fail "curl(1) version is not adequate (expecting 7 or higher)";;
|
|
|
|
esac
|
2012-09-28 08:20:49 +00:00
|
|
|
unset http_proxy
|
|
|
|
unset HTTP_PROXY
|
|
|
|
unset HTTPS_PROXY
|
|
|
|
unset ALL_PROXY
|
2012-09-27 08:06:22 +00:00
|
|
|
}
|
|
|
|
|
2012-07-17 04:39:35 +00:00
|
|
|
setup_common() {
|
2012-07-06 05:09:25 +00:00
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
2012-10-18 01:16:32 +00:00
|
|
|
foreach_instance +A +B create_single_identity
|
|
|
|
set_instance +B
|
2012-07-16 08:59:29 +00:00
|
|
|
}
|
|
|
|
|
2012-07-17 04:39:35 +00:00
|
|
|
doc_FileTransfer="New bundle and update transfer to one node"
|
|
|
|
setup_FileTransfer() {
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
2012-10-18 07:16:17 +00:00
|
|
|
rhizome_add_file file1
|
2012-07-16 08:59:29 +00:00
|
|
|
start_servald_instances +A +B
|
2012-09-14 06:39:28 +00:00
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
2012-07-17 04:39:35 +00:00
|
|
|
}
|
|
|
|
test_FileTransfer() {
|
2012-10-17 07:40:39 +00:00
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
2012-07-17 04:39:35 +00:00
|
|
|
set_instance +B
|
2012-10-04 04:55:08 +00:00
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=0 file1
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file1
|
2012-07-17 04:39:35 +00:00
|
|
|
set_instance +A
|
2012-10-18 07:16:17 +00:00
|
|
|
rhizome_update_file file1 file2
|
2012-07-11 07:13:21 +00:00
|
|
|
set_instance +B
|
2012-10-17 07:40:39 +00:00
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
2012-10-04 04:55:08 +00:00
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=0 file2
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file2
|
2012-07-06 05:09:25 +00:00
|
|
|
}
|
2012-07-17 04:39:35 +00:00
|
|
|
|
2013-01-03 05:42:24 +00:00
|
|
|
doc_EncryptedTransfer="Encrypted payload can be opened by destination"
|
|
|
|
setup_EncryptedTransfer() {
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
|
|
|
echo "Clear Text" >file1
|
|
|
|
echo -e "service=MeshMS1\nsender=$SIDA\nrecipient=$SIDB" >file1.manifest
|
|
|
|
executeOk_servald rhizome add file $SIDA '' file1 file1.manifest
|
|
|
|
extract_manifest_id BID file1.manifest
|
|
|
|
extract_manifest_version VERSION file1.manifest
|
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
|
|
|
}
|
|
|
|
test_EncryptedTransfer() {
|
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald rhizome extract file $BID file1x
|
|
|
|
assert diff file1 file1x
|
|
|
|
}
|
|
|
|
|
2012-11-30 04:32:34 +00:00
|
|
|
doc_DisablingHTTPServer="Disabling HTTP rhizome transports works"
|
|
|
|
setup_DisablingHTTPServer() {
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
|
|
|
rhizome_add_file file1
|
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
start_servald_instances +A
|
|
|
|
}
|
|
|
|
test_DisablingHTTPServer() {
|
2012-11-30 04:36:31 +00:00
|
|
|
!rhizome_http_server_started
|
2012-11-30 04:32:34 +00:00
|
|
|
}
|
|
|
|
|
2012-11-30 07:12:17 +00:00
|
|
|
doc_HTTPTransport="Rhizome over HTTP transport"
|
|
|
|
setup_HTTPTransport() {
|
|
|
|
setup_common
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
|
|
|
rhizome_add_file file1
|
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
|
|
|
}
|
|
|
|
test_HTTPTransport() {
|
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald rhizome list ''
|
|
|
|
assert_rhizome_list --fromhere=0 file1
|
|
|
|
assert_rhizome_received file1
|
|
|
|
set_instance +A
|
|
|
|
rhizome_update_file file1 file2
|
|
|
|
set_instance +B
|
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
|
|
|
executeOk_servald rhizome list ''
|
|
|
|
assert_rhizome_list --fromhere=0 file2
|
|
|
|
assert_rhizome_received file2
|
|
|
|
}
|
|
|
|
|
|
|
|
doc_MDPTransport="Rhizome over MDP transport"
|
|
|
|
setup_MDPTransport() {
|
|
|
|
setup_common
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
rhizome_add_file file1
|
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
|
|
|
}
|
|
|
|
test_MDPTransport() {
|
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald rhizome list ''
|
|
|
|
assert_rhizome_list --fromhere=0 file1
|
|
|
|
assert_rhizome_received file1
|
|
|
|
set_instance +A
|
|
|
|
rhizome_update_file file1 file2
|
|
|
|
set_instance +B
|
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
|
|
|
executeOk_servald rhizome list ''
|
|
|
|
assert_rhizome_list --fromhere=0 file2
|
|
|
|
assert_rhizome_received file2
|
|
|
|
}
|
|
|
|
|
2012-11-30 12:27:34 +00:00
|
|
|
doc_FileTransferBigMDP="Big new bundle transfers to one node via MDP"
|
|
|
|
setup_FileTransferBigMDP() {
|
|
|
|
setup_common
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
dd if=/dev/urandom of=file1 bs=1k count=1k 2>&1
|
|
|
|
echo x >>file1
|
|
|
|
ls -l file1
|
|
|
|
rhizome_add_file file1
|
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
|
|
|
}
|
|
|
|
test_FileTransferBigMDP() {
|
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald rhizome list ''
|
|
|
|
assert_rhizome_list --fromhere=0 file1
|
|
|
|
assert_rhizome_received file1
|
|
|
|
}
|
|
|
|
|
|
|
|
doc_FileTransferBig="Big new bundle transfers to one node via HTTP"
|
2012-07-17 04:39:35 +00:00
|
|
|
setup_FileTransferBig() {
|
|
|
|
setup_common
|
2012-11-30 12:27:34 +00:00
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
2012-07-17 04:39:35 +00:00
|
|
|
set_instance +A
|
2012-11-30 12:27:34 +00:00
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
2012-07-17 04:39:35 +00:00
|
|
|
dd if=/dev/urandom of=file1 bs=1k count=1k 2>&1
|
|
|
|
echo x >>file1
|
|
|
|
ls -l file1
|
2012-10-18 07:16:17 +00:00
|
|
|
rhizome_add_file file1
|
2012-07-17 04:39:35 +00:00
|
|
|
start_servald_instances +A +B
|
2012-09-14 06:39:28 +00:00
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
2012-07-17 04:39:35 +00:00
|
|
|
}
|
|
|
|
test_FileTransferBig() {
|
2012-10-17 07:40:39 +00:00
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
2012-07-17 04:39:35 +00:00
|
|
|
set_instance +B
|
2012-10-04 04:55:08 +00:00
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=0 file1
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file1
|
2012-07-17 04:39:35 +00:00
|
|
|
}
|
|
|
|
|
2012-12-01 00:26:48 +00:00
|
|
|
doc_FileTransferMulti="New bundle transfers to four nodes via HTTP"
|
2012-07-17 04:39:35 +00:00
|
|
|
setup_FileTransferMulti() {
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
2012-12-01 00:26:48 +00:00
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
|
|
|
set_instance +C
|
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
|
|
|
set_instance +D
|
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
|
|
|
set_instance +E
|
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
|
|
|
set_instance +A
|
2012-10-18 07:16:17 +00:00
|
|
|
rhizome_add_file file1
|
2012-07-11 08:12:30 +00:00
|
|
|
start_servald_instances +A +B +C +D +E
|
2012-09-14 06:39:28 +00:00
|
|
|
foreach_instance +A assert_peers_are_instances +B +C +D +E
|
|
|
|
foreach_instance +B assert_peers_are_instances +A +C +D +E
|
|
|
|
foreach_instance +C assert_peers_are_instances +A +B +D +E
|
|
|
|
foreach_instance +D assert_peers_are_instances +A +B +C +E
|
2012-07-11 08:12:30 +00:00
|
|
|
}
|
2012-07-17 04:39:35 +00:00
|
|
|
test_FileTransferMulti() {
|
2012-10-17 07:40:39 +00:00
|
|
|
wait_until bundle_received_by $BID:$VERSION +B +C +D +E
|
|
|
|
for i in B C D E; do
|
|
|
|
set_instance +$i
|
2012-10-04 04:55:08 +00:00
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=0 file1
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file1
|
2012-07-11 08:12:30 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2012-12-01 00:26:48 +00:00
|
|
|
doc_FileTransferMultiMDP="New bundle transfers to four nodes via MDP"
|
|
|
|
setup_FileTransferMultiMDP() {
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
set_instance +C
|
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
set_instance +D
|
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
set_instance +E
|
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
set_instance +A
|
|
|
|
rhizome_add_file file1
|
|
|
|
start_servald_instances +A +B +C +D +E
|
|
|
|
foreach_instance +A assert_peers_are_instances +B +C +D +E
|
|
|
|
foreach_instance +B assert_peers_are_instances +A +C +D +E
|
|
|
|
foreach_instance +C assert_peers_are_instances +A +B +D +E
|
|
|
|
foreach_instance +D assert_peers_are_instances +A +B +C +E
|
|
|
|
}
|
|
|
|
test_FileTransferMultiMDP() {
|
|
|
|
wait_until bundle_received_by $BID:$VERSION +B +C +D +E
|
|
|
|
for i in B C D E; do
|
|
|
|
set_instance +$i
|
|
|
|
executeOk_servald rhizome list ''
|
|
|
|
assert_rhizome_list --fromhere=0 file1
|
|
|
|
assert_rhizome_received file1
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-17 04:39:35 +00:00
|
|
|
doc_FileTransferDelete="Payload deletion transfers to one node"
|
2012-07-16 08:59:29 +00:00
|
|
|
setup_FileTransferDelete() {
|
2012-07-17 04:39:35 +00:00
|
|
|
setup_common
|
|
|
|
set_instance +A
|
2012-10-18 07:16:17 +00:00
|
|
|
rhizome_add_file file1
|
2012-07-16 08:59:29 +00:00
|
|
|
start_servald_instances +A +B
|
2012-09-14 06:39:28 +00:00
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
2012-10-17 07:40:39 +00:00
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
2012-07-16 08:59:29 +00:00
|
|
|
set_instance +A
|
|
|
|
>file1_2
|
2012-10-18 07:16:17 +00:00
|
|
|
rhizome_update_file file1 file1_2
|
2012-07-16 08:59:29 +00:00
|
|
|
}
|
|
|
|
test_FileTransferDelete() {
|
2012-10-17 07:40:39 +00:00
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
2012-07-16 08:59:29 +00:00
|
|
|
set_instance +B
|
2012-10-04 04:55:08 +00:00
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=0 file1_2
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file1_2
|
2012-07-16 08:59:29 +00:00
|
|
|
}
|
|
|
|
|
2012-10-02 07:46:44 +00:00
|
|
|
doc_HttpImport="Import bundle using HTTP POST multi-part form."
|
|
|
|
setup_HttpImport() {
|
|
|
|
setup_curl_7
|
|
|
|
setup_common
|
|
|
|
cat >README.WHYNOTSIPS <<'EOF'
|
|
|
|
When we were looking at implementing secure calls for OpenBTS it was suggested
|
|
|
|
that we configure Asterisk to use SIPS/ZRTP. This would have been relatively
|
|
|
|
easy to setup, however there are a few problems.
|
2012-10-18 07:16:17 +00:00
|
|
|
.
|
2012-10-02 07:46:44 +00:00
|
|
|
Number one is that when Asterisk checks the certificates it will either
|
|
|
|
validate the certificate (checking the chain of trust and so on) and then
|
|
|
|
check that the common name attribute on the certificate matches the hostname
|
|
|
|
of the peer, or it will do none of these checks. This code is in main/tcptls.c
|
|
|
|
line 206 (in version 1.8.14.1).
|
2012-10-18 07:16:17 +00:00
|
|
|
.
|
2012-10-02 07:46:44 +00:00
|
|
|
This is undesirable in a setup where there is limited or no infrastructure as
|
|
|
|
there is not likely to be a DNS server setup, or even rigid IP assignments
|
|
|
|
that would allow a static hosts file based setup. This situation would force
|
|
|
|
the administrator to disable the checks completely which would allow a trivial
|
|
|
|
man in the middle attack.
|
2012-10-18 07:16:17 +00:00
|
|
|
.
|
2012-10-02 07:46:44 +00:00
|
|
|
It would be possible to modify Asterisk to have a third way where it validates
|
|
|
|
the certificate and checks the chain of trust but does not look at the common
|
|
|
|
name. We decided against this approach as the VOMP channel driver was written
|
|
|
|
in time to avoid it.
|
|
|
|
EOF
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald rhizome add file $SIDB '' README.WHYNOTSIPS README.WHYNOTSIPS.manifest
|
|
|
|
assert_manifest_complete README.WHYNOTSIPS.manifest
|
|
|
|
assert_stdout_add_file README.WHYNOTSIPS
|
|
|
|
set_instance +A
|
|
|
|
start_servald_instances +A
|
|
|
|
wait_until rhizome_http_server_started +A
|
|
|
|
get_rhizome_server_port PORTA +A
|
|
|
|
}
|
|
|
|
test_HttpImport() {
|
|
|
|
executeOk curl \
|
|
|
|
--silent --fail --show-error \
|
|
|
|
--output http.output \
|
|
|
|
--dump-header http.headers \
|
|
|
|
--write-out '%{http_code}\n' \
|
|
|
|
--form 'data=@README.WHYNOTSIPS' \
|
|
|
|
--form 'manifest=@README.WHYNOTSIPS.manifest' \
|
|
|
|
"$addr_localhost:$PORTA/rhizome/import"
|
|
|
|
tfw_cat http.headers http.output
|
2012-10-04 04:55:08 +00:00
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=0 README.WHYNOTSIPS
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received README.WHYNOTSIPS
|
2012-10-02 07:46:44 +00:00
|
|
|
}
|
|
|
|
|
2012-10-04 04:55:08 +00:00
|
|
|
doc_HttpAddLocal="Add file locally using HTTP, returns manifest"
|
|
|
|
setup_HttpAddLocal() {
|
|
|
|
setup_curl_7
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
2012-12-06 02:01:19 +00:00
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.api.addfile.uri_path "/rhizome/secretaddfile" \
|
|
|
|
set rhizome.api.addfile.default_author $SIDA
|
2012-10-04 04:55:08 +00:00
|
|
|
start_servald_instances +A
|
|
|
|
wait_until rhizome_http_server_started +A
|
|
|
|
get_rhizome_server_port PORTA +A
|
|
|
|
}
|
|
|
|
test_HttpAddLocal() {
|
|
|
|
echo 'File file1' >file1
|
2012-12-05 04:53:59 +00:00
|
|
|
executeOk curl --silent --form 'data=@file1' "http://${addr_localhost}:$PORTA/rhizome/secretaddfile" --output file1.manifest
|
2012-10-04 04:55:08 +00:00
|
|
|
assert_manifest_complete file1.manifest
|
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=1 file1
|
2012-10-04 04:55:08 +00:00
|
|
|
extract_manifest_name name file1.manifest
|
|
|
|
assert [ "$name" = file1 ]
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file1
|
2012-10-04 04:55:08 +00:00
|
|
|
}
|
|
|
|
|
2012-08-27 06:59:46 +00:00
|
|
|
setup_sync() {
|
|
|
|
set_instance +A
|
2012-10-18 07:16:17 +00:00
|
|
|
rhizome_add_file file1
|
2012-08-27 06:59:46 +00:00
|
|
|
BID1=$BID
|
|
|
|
VERSION1=$VERSION
|
|
|
|
start_servald_instances dummy1 +A
|
|
|
|
wait_until rhizome_http_server_started +A
|
|
|
|
get_rhizome_server_port PORTA +A
|
|
|
|
set_instance +B
|
2012-12-06 02:01:19 +00:00
|
|
|
executeOk_servald config \
|
|
|
|
set log.show_time on \
|
|
|
|
set debug.rhizome on \
|
2012-12-11 05:29:46 +00:00
|
|
|
set debug.rhizome_tx on \
|
|
|
|
set debug.rhizome_rx on \
|
2012-12-06 02:01:19 +00:00
|
|
|
set rhizome.direct.peer.0 "http://${addr_localhost}:${PORTA}"
|
2012-10-18 07:16:17 +00:00
|
|
|
rhizome_add_file file2
|
2012-08-27 06:59:46 +00:00
|
|
|
BID2=$BID
|
|
|
|
VERSION2=$VERSION
|
|
|
|
}
|
|
|
|
|
2012-10-04 04:55:08 +00:00
|
|
|
doc_DirectPush="One way push bundle to unconnected node"
|
|
|
|
setup_DirectPush() {
|
2012-08-27 06:59:46 +00:00
|
|
|
setup_common
|
|
|
|
setup_sync
|
|
|
|
}
|
2012-10-04 04:55:08 +00:00
|
|
|
test_DirectPush() {
|
2012-10-03 16:15:09 +00:00
|
|
|
set_instance +B
|
2012-10-03 15:55:55 +00:00
|
|
|
executeOk_servald rhizome direct push
|
2012-10-04 08:08:33 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2012-10-17 07:40:39 +00:00
|
|
|
assert bundle_received_by $BID2:$VERSION2 +A
|
2012-10-03 16:15:09 +00:00
|
|
|
set_instance +A
|
2012-10-02 11:30:56 +00:00
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=1 file1 --fromhere=0 file2
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file2
|
2012-10-02 10:31:46 +00:00
|
|
|
set_instance +B
|
2012-10-02 11:30:56 +00:00
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=1 file2
|
2012-08-27 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2012-10-04 04:55:08 +00:00
|
|
|
doc_DirectPull="One way pull bundle from unconnected node"
|
|
|
|
setup_DirectPull() {
|
2012-08-27 06:59:46 +00:00
|
|
|
setup_common
|
|
|
|
setup_sync
|
|
|
|
}
|
2012-10-04 04:55:08 +00:00
|
|
|
test_DirectPull() {
|
2012-10-03 16:15:09 +00:00
|
|
|
set_instance +B
|
2012-10-03 15:55:55 +00:00
|
|
|
executeOk_servald rhizome direct pull
|
2012-10-04 08:08:33 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2012-10-17 07:40:39 +00:00
|
|
|
assert bundle_received_by $BID1:$VERSION1 --stderr
|
2012-10-03 16:15:09 +00:00
|
|
|
set_instance +A
|
2012-10-02 13:22:56 +00:00
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=1 file1
|
2012-10-02 13:22:56 +00:00
|
|
|
set_instance +B
|
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=0 file1 --fromhere=1 file2
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file1
|
2012-08-27 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2012-10-04 04:55:08 +00:00
|
|
|
doc_DirectSync="Two-way sync bundles between unconnected nodes"
|
|
|
|
setup_DirectSync() {
|
2012-08-27 06:59:46 +00:00
|
|
|
setup_common
|
|
|
|
setup_sync
|
|
|
|
}
|
2012-10-04 04:55:08 +00:00
|
|
|
test_DirectSync() {
|
2012-10-03 16:17:12 +00:00
|
|
|
set_instance +B
|
2012-10-02 23:45:18 +00:00
|
|
|
executeOk_servald rhizome direct sync
|
2012-10-04 08:08:33 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2012-10-17 07:40:39 +00:00
|
|
|
assert bundle_received_by $BID1:$VERSION1 --stderr $BID2:$VERSION2 +A
|
2012-10-03 16:17:12 +00:00
|
|
|
set_instance +A
|
2012-10-02 13:22:56 +00:00
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=1 file1 --fromhere=0 file2
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file2
|
2012-08-27 06:59:46 +00:00
|
|
|
set_instance +B
|
2012-10-02 13:22:56 +00:00
|
|
|
executeOk_servald rhizome list ''
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=0 file1 --fromhere=1 file2
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file1
|
2012-10-17 07:40:39 +00:00
|
|
|
}
|
|
|
|
|
2012-07-06 05:09:25 +00:00
|
|
|
runTests "$@"
|