for test-upgrade, import a (hopefully large) mbox file, checking for performance/memory consumption

in the future, it would be good to actually start a mox and read
mailboxes/messages...
This commit is contained in:
Mechiel Lukkien
2023-07-24 11:00:11 +02:00
parent 840f3afb35
commit c0100f44e7
5 changed files with 64 additions and 4 deletions

View File

@ -1,10 +1,18 @@
#!/bin/sh
# note: If testdata/upgradetest.mbox.gz exists it will be imported it as part of
# testing the upgrades. If this is a large mailbox, it will highlight performance
# or resource consumption issues during upgrades.
# todo: should we also test with mox.conf and domains.conf files? should "mox backup" and "mox gentestdata" add them, and "mox verifydata" use them?
set -e
# set -x
# We'll allow max 256mb of memory during upgrades. We modify the softlimit when
# importing the potentially large mbox file.
ulimit -S -d 256000
(rm -r testdata/upgrade 2>/dev/null || exit 0)
mkdir testdata/upgrade
cd testdata/upgrade
@ -13,10 +21,11 @@ cd testdata/upgrade
../../mox gentestdata data
../../mox verifydata data
rm -r data
echo
# For each historic release (i.e. all tagged versions) except the first few that
# didn't have the gentestdata command, we generate a data directory for testing
# and simulate upgrade to currently checked out version.
# and simulate upgrading to the currently checked out version.
# The awk command reverses the tags, so we try the previous release first since
# it is the most likely to fail.
tagsrev=$(git tag --sort creatordate | grep -v '^v0\.0\.[123]$' | awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }')
@ -29,6 +38,7 @@ for tag in $tagsrev; do
./$tag/mox gentestdata $tag/data
# Verify with current code.
../../mox verifydata $tag/data
echo
rm -r $tag/data
done
@ -40,14 +50,25 @@ for tag in $tags; do
if test "$first" = yes; then
echo "Starting with test data for $tag."
./$tag/mox gentestdata stepdata
echo
first=
else
# v0.0.5 got the ximport command
if test $tag = v0.0.5 -a -f ../upgradetest.mbox.gz; then
ulimit -S -d unlimited
echo 'Importing bulk data for upgrading.'
gunzip < ../upgradetest.mbox.gz | time ./$tag/mox ximport mbox ./stepdata/accounts/test0 upgradetest /dev/stdin
echo
ulimit -S -d 256000
fi
echo "Upgrade data to $tag."
./$tag/mox verifydata stepdata
time ./$tag/mox verifydata stepdata
echo
fi
done
echo "Testing final upgrade to current."
../../mox verifydata stepdata
time ../../mox verifydata stepdata
rm -r stepdata
rm */mox
cd ../..