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
}
doc_FileTransferStress="Stress - five nodes each sharing 16 bundles"
setup_FileTransferStress() {
doc_StressRhizomeTransfer="Stress - five nodes each sharing 16 bundles"
setup_StressRhizomeTransfer() {
setup_servald
assert_no_servald_processes
foreach_instance +A +B +C +D +E create_single_identity
@ -64,7 +64,7 @@ setup_FileTransferStress() {
done
done
}
test_FileTransferStress() {
test_StressRhizomeTransfer() {
start_servald_instances +A +B +C +D +E
wait_until --timeout=600 bundle_received_by \
${bundlesA[*]} +B +C +D +E \
@ -82,40 +82,39 @@ test_FileTransferStress() {
done
}
setup_AddStressTest() {
setup_StressRhizomeAdd() {
setup_servald
assert_no_servald_processes
foreach_instance +A +B +C +D +E +F +G +H create_single_identity
start_servald_instances +A +B +C +D +E +F +G +H
}
ammendfile() {
echo "XXX ${instance_name} XXX" >> $instance_dir/file
executeOk_servald rhizome add file "" "" "$instance_dir/file" "$instance_dir/file.manifest"
tfw_cat --stdout --stderr
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"
amend_file() {
create_file --append file$instance_name 100
rm -f file$instance_name.manifest # ensure 'rhizome add file' generates a new Bundle ID
rhizome_add_file file$instance_name
}
alldone() {
rhizome_list_bundle_count() {
executeOk_servald rhizome list ''
local lineCount=$(( $(cat $_tfw_tmp/stdout | wc -l) + 0 ))
tfw_log "lines $lineCount"
# total files = 26 * 8 + 2
if [ "$lineCount" -eq "210" ]; then return 0; fi
return 1
local lineCount=$(( $(replayStdout | wc -l) + 0 ))
tfw_log "lineCount=$lineCount"
echo $(($lineCount - 2))
}
doc_AddStressTest="Add files while transferring"
test_AddStressTest() {
rhizome_bundle_count_equals() {
[ $(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
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
foreach_instance +A +B +C +D +E +F +G +H wait_until --timeout=120 alldone
sleep 10
foreach_instance +A +B +C +D +E +F +G +H wait_until --timeout=120 rhizome_bundle_count_equals $total_files
}
runTests "$@"