2013-02-11 08:11:36 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Stress tests for Serval rhizome protocol.
|
|
|
|
#
|
|
|
|
# Copyright 2012 Serval Project, Inc.
|
|
|
|
#
|
|
|
|
# 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"
|
|
|
|
|
|
|
|
shopt -s extglob
|
|
|
|
|
|
|
|
setup() {
|
|
|
|
setup_servald
|
2013-04-29 05:01:50 +00:00
|
|
|
executeOk_servald config \
|
|
|
|
set log.console.level debug \
|
|
|
|
set debug.keyring on
|
2013-03-06 03:45:27 +00:00
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 0
|
2013-02-11 08:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
assert_keyring_list() {
|
|
|
|
assertStdoutLineCount --stdout --stderr '==' $1
|
2013-02-28 05:57:26 +00:00
|
|
|
assertStdoutGrep --stderr --matches=$1 "^[0-9a-fA-F]\{64\}:[0-9*#+]*:.*\$"
|
2013-02-11 08:11:36 +00:00
|
|
|
tfw_cat --stdout
|
|
|
|
}
|
|
|
|
|
2013-02-13 06:19:52 +00:00
|
|
|
doc_KeyringCreate="Create keyring destroys existing keys"
|
2013-02-11 08:11:36 +00:00
|
|
|
test_KeyringCreate() {
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring add ''
|
2013-02-11 08:11:36 +00:00
|
|
|
executeOk_servald keyring add ''
|
|
|
|
executeOk_servald keyring list
|
2013-02-13 06:19:52 +00:00
|
|
|
assert_keyring_list 2
|
2013-02-11 08:11:36 +00:00
|
|
|
executeOk_servald keyring create
|
|
|
|
assert_keyring_list 0
|
|
|
|
}
|
|
|
|
|
2013-02-13 06:19:52 +00:00
|
|
|
doc_Pinless="No keyring PIN with PIN-less identities"
|
|
|
|
test_Pinless() {
|
2013-02-11 08:11:36 +00:00
|
|
|
executeOk_servald keyring add ''
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 1
|
|
|
|
executeOk_servald keyring add ''
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 2
|
|
|
|
executeOk_servald keyring add ''
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 3
|
|
|
|
}
|
|
|
|
|
2013-02-13 06:19:52 +00:00
|
|
|
doc_IdentityPins="No keyring PIN with identity PINs"
|
|
|
|
test_IdentityPins() {
|
2013-02-11 08:11:36 +00:00
|
|
|
executeOk_servald keyring add 'one'
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 0
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'one'
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 1
|
|
|
|
executeOk_servald keyring add 'two'
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 0
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'one'
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 1
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'one' --entry-pin 'two'
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 2
|
|
|
|
executeOk_servald keyring add 'three'
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 0
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'one'
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 1
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'one' --entry-pin 'two'
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 2
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'one' --entry-pin 'two' --entry-pin 'three'
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 3
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'two' --entry-pin 'three'
|
|
|
|
assert_keyring_list 2
|
|
|
|
executeOk_servald keyring list --entry-pin 'three'
|
|
|
|
assert_keyring_list 1
|
|
|
|
}
|
|
|
|
|
|
|
|
doc_KeyringPinIdentityPinless="Keyring PIN with PIN-less identities"
|
|
|
|
test_KeyringPinIdentityPinless() {
|
|
|
|
executeOk_servald keyring add --keyring-pin=hello ''
|
|
|
|
executeOk_servald keyring list --keyring-pin=hello
|
|
|
|
assert_keyring_list 1
|
|
|
|
executeOk_servald keyring add --keyring-pin=hello ''
|
|
|
|
executeOk_servald keyring list --keyring-pin=hello
|
|
|
|
assert_keyring_list 2
|
|
|
|
executeOk_servald keyring add --keyring-pin=hello ''
|
|
|
|
executeOk_servald keyring list --keyring-pin=hello
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 3
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 0
|
2013-02-11 08:11:36 +00:00
|
|
|
}
|
|
|
|
|
2013-02-28 05:57:26 +00:00
|
|
|
doc_KeyringAutoCreate="Starting a server with no keyring creates a valid identity"
|
|
|
|
test_KeyringAutoCreate() {
|
2013-03-06 04:59:27 +00:00
|
|
|
start_servald_server
|
2013-03-06 03:45:27 +00:00
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 1
|
|
|
|
}
|
|
|
|
finally_KeyringAutoCreate() {
|
|
|
|
stop_servald_server
|
|
|
|
}
|
|
|
|
teardown_KeyringAutoCreate() {
|
2013-03-06 04:59:27 +00:00
|
|
|
kill_all_servald_processes
|
|
|
|
assert_no_servald_processes
|
2013-03-06 03:45:27 +00:00
|
|
|
report_servald_server
|
2013-02-28 05:57:26 +00:00
|
|
|
}
|
|
|
|
|
2013-04-29 05:41:04 +00:00
|
|
|
doc_CompatibleBack1="Can read old keyring file (1)"
|
|
|
|
setup_CompatibleBack1() {
|
|
|
|
setup_servald
|
|
|
|
executeOk_servald config \
|
|
|
|
set log.console.level debug \
|
|
|
|
set debug.keyring on
|
|
|
|
assert mkdir -p "$SERVALINSTANCE_PATH"
|
|
|
|
assert cp "${TFWSOURCE%/*}/testdata/serval.keyring-1" "$SERVALINSTANCE_PATH/serval.keyring"
|
|
|
|
}
|
|
|
|
test_CompatibleBack1() {
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 3
|
|
|
|
assertStdoutGrep "^EEBF3AC19E7EE58722A0F6D4A4D5894A72F5C71030C3399FE75808DCF6C6254B::$"
|
|
|
|
assertStdoutGrep "^C10C91D24BF210DD6733ED2424B4509E6CC4402D34055B6D29F7A778701AA542:55500000:Smith$"
|
|
|
|
assertStdoutGrep "^6EE9BCA4AE1A264D18F42C18EF910915F98F0C5D9ECD853ECB1547B752119F05:555001234:Jones$"
|
|
|
|
}
|
|
|
|
|
2013-02-11 08:11:36 +00:00
|
|
|
runTests "$@"
|