[Dev] [dbscripts] [PATCH 09/31] ftpdir-cleanup: Test removal of old packages
Luke Shumaker
lukeshu at lukeshu.com
Fri Apr 6 18:43:42 GMT 2018
From: Pierre Schmitz <pierre at archlinux.de>
(cherry picked from commit 961c9407982315ba52f5fa4371b20e0db95e7cdb)
---
test/cases/ftpdir-cleanup.bats | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
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
}
+
+ at 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} ]
+}
--
2.16.2
More information about the Dev
mailing list