From cb2dcc6ee207e9c5ba4b875d70e387e6347591ed Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 20 Nov 2010 16:11:59 +0100 Subject: Fix sourceballs cron job * add unit test for sourceballs and cleanup * introduce SRCPOOL and LOGDIR variables in config --- test/runTest | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'test/runTest') 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" -- cgit v1.2.3