Improve Rhizome stress tests

Rename tests to start with "Stress" prefix

Refactor StressRhizomeAdd test to use conventional utilities and be more
readable.  Remove trailing "sleep 10".
This commit is contained in:
Andrew Bettison 2013-02-08 12:08:24 +10:30
parent 2ca7bab7c0
commit 7a8323b31d

View File

@ -46,8 +46,8 @@ configure_servald_server() {
set mdp.iftype.wifi.tick_ms 500 set mdp.iftype.wifi.tick_ms 500
} }
doc_FileTransferStress="Stress - five nodes each sharing 16 bundles" doc_StressRhizomeTransfer="Stress - five nodes each sharing 16 bundles"
setup_FileTransferStress() { setup_StressRhizomeTransfer() {
setup_servald setup_servald
assert_no_servald_processes assert_no_servald_processes
foreach_instance +A +B +C +D +E create_single_identity foreach_instance +A +B +C +D +E create_single_identity
@ -64,7 +64,7 @@ setup_FileTransferStress() {
done done
done done
} }
test_FileTransferStress() { test_StressRhizomeTransfer() {
start_servald_instances +A +B +C +D +E start_servald_instances +A +B +C +D +E
wait_until --timeout=600 bundle_received_by \ wait_until --timeout=600 bundle_received_by \
${bundlesA[*]} +B +C +D +E \ ${bundlesA[*]} +B +C +D +E \
@ -82,40 +82,39 @@ test_FileTransferStress() {
done done
} }
setup_AddStressTest() { setup_StressRhizomeAdd() {
setup_servald setup_servald
assert_no_servald_processes assert_no_servald_processes
foreach_instance +A +B +C +D +E +F +G +H create_single_identity foreach_instance +A +B +C +D +E +F +G +H create_single_identity
start_servald_instances +A +B +C +D +E +F +G +H start_servald_instances +A +B +C +D +E +F +G +H
} }
ammendfile() { amend_file() {
echo "XXX ${instance_name} XXX" >> $instance_dir/file create_file --append file$instance_name 100
executeOk_servald rhizome add file "" "" "$instance_dir/file" "$instance_dir/file.manifest" rm -f file$instance_name.manifest # ensure 'rhizome add file' generates a new Bundle ID
tfw_cat --stdout --stderr rhizome_add_file file$instance_name
extract_manifest_id id "$instance_dir/file.manifest"
# read file contents to verify successful add
executeOk_servald rhizome extract file $id
rm "$instance_dir/file.manifest"
} }
alldone() { rhizome_list_bundle_count() {
executeOk_servald rhizome list '' executeOk_servald rhizome list ''
local lineCount=$(( $(cat $_tfw_tmp/stdout | wc -l) + 0 )) local lineCount=$(( $(replayStdout | wc -l) + 0 ))
tfw_log "lines $lineCount" tfw_log "lineCount=$lineCount"
# total files = 26 * 8 + 2 echo $(($lineCount - 2))
if [ "$lineCount" -eq "210" ]; then return 0; fi
return 1
} }
doc_AddStressTest="Add files while transferring" rhizome_bundle_count_equals() {
test_AddStressTest() { [ $(rhizome_list_bundle_count) -eq $1 ]
}
doc_StressRhizomeAdd="Add files while transferring"
test_StressRhizomeAdd() {
local total_files=0
for i in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z for i in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
do do
foreach_instance +A +B +C +D +E +F +G +H ammendfile foreach_instance +A +B +C +D +E +F +G +H amend_file
let total_files+=8
done done
foreach_instance +A +B +C +D +E +F +G +H wait_until --timeout=120 alldone foreach_instance +A +B +C +D +E +F +G +H wait_until --timeout=120 rhizome_bundle_count_equals $total_files
sleep 10
} }
runTests "$@" runTests "$@"