summaryrefslogtreecommitdiffstats
path: root/test/runTest
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-11-20 16:11:59 +0100
committerPierre Schmitz <pierre@archlinux.de>2010-11-20 16:11:59 +0100
commitcb2dcc6ee207e9c5ba4b875d70e387e6347591ed (patch)
tree5874d805bb6fdca2011417fc23f34a09a943d458 /test/runTest
parenta1ba979a0e3c763449d91fc787333f4058e89aa8 (diff)
downloaddbscripts-cb2dcc6ee207e9c5ba4b875d70e387e6347591ed.tar.gz
dbscripts-cb2dcc6ee207e9c5ba4b875d70e387e6347591ed.tar.xz
Fix sourceballs cron job
* add unit test for sourceballs and cleanup * introduce SRCPOOL and LOGDIR variables in config
Diffstat (limited to 'test/runTest')
-rwxr-xr-xtest/runTest59
1 files changed, 59 insertions, 0 deletions
diff --git a/test/runTest b/test/runTest
index 4681944..d3e2eff 100755
--- a/test/runTest
+++ b/test/runTest
@@ -535,5 +535,64 @@ testUpdateSameAnyPackageToDifferentRepositoriesWithoutPool() {
done
}
+#
+#sourceballs tests
+#
+
+testSourceballs() {
+ local arches=('i686' 'x86_64')
+ local pkgs=('pkg-simple-a' 'pkg-simple-b')
+ local pkgbase
+ local arch
+
+ for pkgbase in ${pkgs[@]}; do
+ for arch in ${arches[@]}; do
+ releasePackage extra ${pkgbase} ${arch}
+ done
+ done
+ ../db-update
+
+ ../cron-jobs/sourceballs
+
+ for log in errors failed; do
+ if [ -s "${LOGDIR}/sourceballs/${log}.txt" ]; then
+ fail "${LOGDIR}/sourceballs/${log}.txt includes the following errors:"
+ cat "${LOGDIR}/sourceballs/${log}.txt"
+ fi
+ done
+ for pkgbase in ${pkgs[@]}; do
+ [ ! -r ${FTP_BASE}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!"
+ done
+}
+
+testSourceballsCleanup() {
+ local arches=('i686' 'x86_64')
+ local pkgs=('pkg-simple-a' 'pkg-simple-b')
+ local pkgbase
+ local arch
+
+ for pkgbase in ${pkgs[@]}; do
+ for arch in ${arches[@]}; do
+ releasePackage extra ${pkgbase} ${arch}
+ done
+ done
+ ../db-update
+ ../cron-jobs/sourceballs
+
+ for arch in ${arches[@]}; do
+ ../db-remove pkg-simple-a extra ${arch}
+ done
+ ../cron-jobs/ftpdir-cleanup >/dev/null
+
+ ../cron-jobs/sourceballs
+ for log in errors failed; do
+ if [ -s "${LOGDIR}/sourceballs/${log}.txt" ]; then
+ fail "${LOGDIR}/sourceballs/${log}.txt includes the following errors:"
+ cat "${LOGDIR}/sourceballs/${log}.txt"
+ fi
+ done
+ [ -r ${FTP_BASE}/${SRCPOOL}/pkg-simple-a-*${SRCEXT} ] && fail "source package was not removed!"
+ [ ! -r ${FTP_BASE}/${SRCPOOL}/pkg-simple-b-*${SRCEXT} ] && fail "source package not found!"
+}
. "${curdir}/lib/shunit2"