diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2017-04-18 17:45:27 +0200 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2018-04-06 13:51:50 -0400 |
commit | 4564727cb680e6566c1b6685b9b74cb74e70cd77 (patch) | |
tree | 7a98d9356cafb59083476872fa13e6056e54bf94 | |
parent | 64317a38339b8fe5755983b255be68db93e77a4f (diff) |
ftpdir-cleanup: Test removal of old packages
(cherry picked from commit 961c9407982315ba52f5fa4371b20e0db95e7cdb)
-rwxr-xr-x | test/cases/ftpdir-cleanup.bats | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/cases/ftpdir-cleanup.bats b/test/cases/ftpdir-cleanup.bats index 220418b..417e32b 100755 --- a/test/cases/ftpdir-cleanup.bats +++ b/test/cases/ftpdir-cleanup.bats @@ -111,3 +111,36 @@ load ../lib/common done done } + +@test "cleanup old packages" { + local pkgs=('pkg-simple-a' 'pkg-simple-b') + local pkgbase + local arch + + for pkgbase in ${pkgs[@]}; do + for arch in "${ARCH_BUILD[@]}"; do + releasePackage extra ${pkgbase} ${arch} + done + done + + db-update + + for pkgbase in ${pkgs[@]}; do + for arch in "${ARCH_BUILD[@]}"; do + db-remove extra ${arch} ${pkgbase} + done + done + + ftpdir-cleanup >/dev/null + + local pkgfilea="pkg-simple-a-1-1-${arch}.pkg.tar.xz" + local pkgfileb="pkg-simple-b-1-1-${arch}.pkg.tar.xz" + for arch in "${ARCH_BUILD[@]}"; do + touch -d "-$(expr ${CLEANUP_KEEP} + 1)days" ${CLEANUP_DESTDIR}/${pkgfilea}{,.sig} + done + + ftpdir-cleanup >/dev/null + + [ ! -f ${CLEANUP_DESTDIR}/${pkgfilea} ] + [ -f ${CLEANUP_DESTDIR}/${pkgfileb} ] +} |