mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
Refactor: set $CR and $HT in testdefs.sh
Fix some bugs in test scripts that used $CR without setting it
This commit is contained in:
parent
51f21f3183
commit
45c6b9ecfa
@ -27,6 +27,10 @@ addr_localhost="127.0.0.1"
|
||||
|
||||
declare -a instance_stack=()
|
||||
|
||||
# Some useful string constants.
|
||||
CR='
'
|
||||
HT=' '
|
||||
|
||||
# Some useful regular expressions. These must work in grep(1) as basic
|
||||
# expressions, and also in sed(1).
|
||||
rexp_sid='[0-9a-fA-F]\{64\}'
|
||||
|
@ -25,13 +25,10 @@ source "${0%/*}/../testdefs_json.sh"
|
||||
shopt -s extglob
|
||||
|
||||
setup() {
|
||||
CR='
|
||||
'
|
||||
setup_curl 7
|
||||
setup_json
|
||||
setup_servald
|
||||
set_instance +A
|
||||
|
||||
executeOk_servald config \
|
||||
set api.restful.users.harry.password potter \
|
||||
set api.restful.users.ron.password weasley \
|
||||
|
@ -26,7 +26,6 @@ source "${0%/*}/../testdefs_meshms.sh"
|
||||
shopt -s extglob
|
||||
|
||||
setup() {
|
||||
CR='
'
|
||||
setup_curl 7
|
||||
setup_json
|
||||
setup_servald
|
||||
|
@ -203,17 +203,17 @@ test_RhizomeListNewSince() {
|
||||
|
||||
assert_metadata() {
|
||||
local n=$1
|
||||
assertStdoutGrep --matches=1 "^id=${BID[$n]}$CR\$"
|
||||
assertStdoutGrep --matches=1 "^version=${VERSION[$n]}$CR\$"
|
||||
assertStdoutGrep --matches=1 "^filesize=${SIZE[$n]}$CR\$"
|
||||
assertStdoutGrep --matches=1 "^filehash=${HASH[$n]}$CR\$"
|
||||
assertStdoutGrep --matches=1 "^BK=${BK[$n]}$CR\$"
|
||||
assertStdoutGrep --matches=1 "^date=${DATE[$n]}$CR\$"
|
||||
assertStdoutGrep --matches=1 "^name=${NAME[$n]}$CR\$"
|
||||
assertStdoutGrep --matches=1 "^service=file$CR\$"
|
||||
assertStdoutGrep --matches=1 "^_insertTime=${INSERTTIME[$n]}$CR\$"
|
||||
assertStdoutGrep --matches=1 "^_author=${AUTHOR[$n]}$CR\$"
|
||||
assertStdoutGrep --matches=1 "^_secret=${SECRET[$n]}$CR\$"
|
||||
assertStdoutGrep --matches=1 "^id=${BID[$n]}\$"
|
||||
assertStdoutGrep --matches=1 "^version=${VERSION[$n]}\$"
|
||||
assertStdoutGrep --matches=1 "^filesize=${SIZE[$n]}\$"
|
||||
assertStdoutGrep --matches=1 "^filehash=${HASH[$n]}\$"
|
||||
assertStdoutGrep --matches=1 "^BK=${BK[$n]}\$"
|
||||
assertStdoutGrep --matches=1 "^date=${DATE[$n]}\$"
|
||||
assertStdoutGrep --matches=1 "^name=${NAME[$n]}\$"
|
||||
assertStdoutGrep --matches=1 "^service=file\$"
|
||||
assertStdoutGrep --matches=1 "^_insertTime=${INSERTTIME[$n]}\$"
|
||||
assertStdoutGrep --matches=1 "^_author=${AUTHOR[$n]}\$"
|
||||
assertStdoutGrep --matches=1 "^_secret=${SECRET[$n]}\$"
|
||||
}
|
||||
|
||||
doc_RhizomeManifest="Java API fetch Rhizome manifest"
|
||||
@ -412,10 +412,10 @@ test_RhizomeInsert() {
|
||||
if [ -n "${author[$n]}" ]; then
|
||||
assertStdoutGrep '^_status=NEW$'
|
||||
assertStdoutGrep "^id=${BID[$n]}\$"
|
||||
assertStderrGrep --matches=1 "^bundle_status_code=NEW$CR\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^bundle_status_message=.*bundle new to store.*$CR\$"
|
||||
assertStderrGrep --matches=1 "^payload_status_code=NEW$CR\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^payload_status_message=.*payload new to store.*$CR\$"
|
||||
assertStderrGrep --matches=1 "^bundle_status_code=NEW\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^bundle_status_message=.*bundle new to store.*\$"
|
||||
assertStderrGrep --matches=1 "^payload_status_code=NEW\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^payload_status_message=.*payload new to store.*\$"
|
||||
else
|
||||
assertStdoutGrep RhizomeReadOnlyException
|
||||
assertStderrGrep --ignore-case "missing bundle secret"
|
||||
@ -440,10 +440,10 @@ test_RhizomeInsertAnon() {
|
||||
tfw_cat --stdout --stderr -v ifile2.manifest
|
||||
assertStdoutGrep '^_status=NEW$'
|
||||
assertStdoutGrep "^id=$BID\$"
|
||||
assertStderrGrep --matches=1 "^bundle_status_code=NEW$CR\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^bundle_status_message=.*bundle new to store.*$CR\$"
|
||||
assertStderrGrep --matches=1 "^payload_status_code=NEW$CR\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^payload_status_message=.*payload new to store.*$CR\$"
|
||||
assertStderrGrep --matches=1 "^bundle_status_code=NEW\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^bundle_status_message=.*bundle new to store.*\$"
|
||||
assertStderrGrep --matches=1 "^payload_status_code=NEW\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^payload_status_message=.*payload new to store.*\$"
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list --fromhere=0 --manifest=ifile2.manifest file2
|
||||
}
|
||||
@ -462,10 +462,10 @@ test_RhizomeInsertEmptyNew() {
|
||||
assertStdoutGrep "^id=$BID\$"
|
||||
assertStdoutGrep "^filesize=0\$"
|
||||
assertStdoutGrep --matches=0 "^filehash="
|
||||
assertStderrGrep --matches=1 "^bundle_status_code=NEW$CR\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^bundle_status_message=.*bundle new to store.*$CR\$"
|
||||
assertStderrGrep --matches=1 "^payload_status_code=EMPTY$CR\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^payload_status_message=.*payload empty.*$CR\$"
|
||||
assertStderrGrep --matches=1 "^bundle_status_code=NEW\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^bundle_status_message=.*bundle new to store.*\$"
|
||||
assertStderrGrep --matches=1 "^payload_status_code=EMPTY\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^payload_status_message=.*payload empty.*\$"
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list empty
|
||||
executeOk_servald rhizome extract bundle "$BID" xempty.manifest xempty
|
||||
@ -492,10 +492,10 @@ test_RhizomeInsertEmptyUpdate() {
|
||||
assertStdoutGrep "^id=$BID\$"
|
||||
assertStdoutGrep "^filesize=0\$"
|
||||
assertStdoutGrep --matches=0 "^filehash="
|
||||
assertStderrGrep --matches=1 "^bundle_status_code=NEW$CR\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^bundle_status_message=.*bundle new to store.*$CR\$"
|
||||
assertStderrGrep --matches=1 "^payload_status_code=EMPTY$CR\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^payload_status_message=.*payload empty.*$CR\$"
|
||||
assertStderrGrep --matches=1 "^bundle_status_code=NEW\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^bundle_status_message=.*bundle new to store.*\$"
|
||||
assertStderrGrep --matches=1 "^payload_status_code=EMPTY\$"
|
||||
assertStderrGrep --matches=1 --ignore-case "^payload_status_message=.*payload empty.*\$"
|
||||
executeOk_servald rhizome list
|
||||
assert_rhizome_list empty
|
||||
executeOk_servald rhizome extract bundle "$BID" xempty.manifest xempty
|
||||
|
@ -26,8 +26,6 @@ source "${0%/*}/../testdefs_rhizome.sh"
|
||||
shopt -s extglob
|
||||
|
||||
setup() {
|
||||
CR='
'
|
||||
HT=' '
|
||||
setup_curl 7
|
||||
setup_json
|
||||
setup_servald
|
||||
|
Loading…
Reference in New Issue
Block a user