summaryrefslogtreecommitdiff
path: root/test
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
parenta1ba979a0e3c763449d91fc787333f4058e89aa8 (diff)
Fix sourceballs cron job
* add unit test for sourceballs and cleanup * introduce SRCPOOL and LOGDIR variables in config
Diffstat (limited to 'test')
-rw-r--r--test/lib/common.inc7
-rwxr-xr-xtest/runTest59
2 files changed, 63 insertions, 3 deletions
diff --git a/test/lib/common.inc b/test/lib/common.inc
index a0d864a..14dc000 100644
--- a/test/lib/common.inc
+++ b/test/lib/common.inc
@@ -43,9 +43,9 @@ setUp() {
mkdir -p "${TMP}/ftp/${r}/os/${a}"
done
done
- for p in ${PKGPOOL[@]}; do
- mkdir -p "${TMP}/ftp/${p}"
- done
+ mkdir -p "${TMP}/ftp/${PKGPOOL}"
+ mkdir -p "${TMP}/ftp/${SRCPOOL}"
+ mkdir -p "${TMP}/log"
msg 'Creating svn repository...'
svnadmin create "${TMP}/svn-packages-repo"
@@ -69,6 +69,7 @@ setUp() {
SOURCE_CLEANUP_DESTDIR="${TMP}/source-cleanup"
STAGING="${TMP}/staging"
TMPDIR="${TMP}/tmp"
+ LOGDIR="${TMP}/log"
CLEANUP_DRYRUN=false
eot
. "${curdir}/../config"
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"