summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-08-08 01:26:11 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-08-08 01:26:11 +0200
commit1db7071b222207d2d924a03a48d0745387f11c7b (patch)
treed006768393fdd538a2bf6c1410afb1433315e15c /test
parent23d4669b8e330d131b2f78cd5858b30a07478c8a (diff)
downloaddbscripts-1db7071b222207d2d924a03a48d0745387f11c7b.tar.gz
dbscripts-1db7071b222207d2d924a03a48d0745387f11c7b.tar.xz
add test for ftpdir-cleanup
Diffstat (limited to 'test')
-rw-r--r--test/lib/common.inc3
-rwxr-xr-xtest/runTest97
2 files changed, 99 insertions, 1 deletions
diff --git a/test/lib/common.inc b/test/lib/common.inc
index 4080c38..dd3022e 100644
--- a/test/lib/common.inc
+++ b/test/lib/common.inc
@@ -16,7 +16,7 @@ oneTimeSetUp() {
}
oneTimeTearDown() {
- find "${pkgdir}" -name '*.pkg.tar.*' -delete
+ rm -rf "${pkgdir}"
}
setUp() {
@@ -54,6 +54,7 @@ setUp() {
SOURCE_CLEANUP_DESTDIR="${TMP}/source-cleanup"
STAGING="${TMP}/staging"
TMPDIR="${TMP}/tmp"
+ CLEANUP_DRYRUN=false
eot
. "${curdir}/../config"
}
diff --git a/test/runTest b/test/runTest
index 6a4f3de..7136508 100755
--- a/test/runTest
+++ b/test/runTest
@@ -25,6 +25,7 @@ testAddSimplePackages() {
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
@@ -61,6 +62,7 @@ testAddSplitPackages() {
local pkgs=('pkg-split-a' 'pkg-split-b')
local pkg
local pkgbase
+ local arch
for pkgbase in ${pkgs[@]}; do
for arch in ${arches[@]}; do
@@ -88,6 +90,7 @@ testRemovePackages() {
local arches=('i686' 'x86_64')
local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-split-a' 'pkg-split-b')
local pkgbase
+ local arch
for pkgbase in ${pkgs[@]}; do
for arch in ${arches[@]}; do
@@ -138,6 +141,7 @@ testMoveSimplePackages() {
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
@@ -180,6 +184,7 @@ testMoveSplitPackages() {
local pkgs=('pkg-split-a' 'pkg-split-b')
local pkg
local pkgbase
+ local arch
for pkgbase in ${pkgs[@]}; do
for arch in ${arches[@]}; do
@@ -207,4 +212,96 @@ testMoveSplitPackages() {
checkRemovedAnyPackage testing pkg-split-a
}
+
+#
+# ftpdir-cleanup
+#
+
+testCleanupSimplePackages() {
+ 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 extra
+
+ for arch in ${arches[@]}; do
+ ../db-remove pkg-simple-a extra ${arch}
+ done
+
+ ../cron-jobs/ftpdir-cleanup
+
+ for arch in ${arches[@]}; do
+ local pkg1="pkg-simple-a-1-1-${arch}.pkg.tar.xz"
+ [ -f "${FTP_BASE}/packages/arch/${arch}/${pkg1}" ] && fail "packages/arch/${arch}/${pkg1} found"
+ [ -f "${FTP_BASE}/${repo}/os/${arch}/${pkg1}" ] && fail "${repo}/os/${arch}/${pkg1} found"
+
+ local pkg2="pkg-simple-b-1-1-${arch}.pkg.tar.xz"
+ checkPackage extra ${pkg2} ${arch}
+ done
+}
+
+testCleanupAnyPackages() {
+ local pkgs=('pkg-any-a' 'pkg-any-b')
+ local pkgbase
+ local arch='any'
+
+ for pkgbase in ${pkgs[@]}; do
+ releasePackage extra ${pkgbase} any
+ done
+
+ ../db-update extra
+ ../db-remove pkg-any-a extra any
+ ../cron-jobs/ftpdir-cleanup
+
+ local pkg1='pkg-any-a-1-1-any.pkg.tar.xz'
+ [ -f "${FTP_BASE}/packages/arch/${arch}/${pkg1}" ] && fail "packages/arch/${arch}/${pkg1} found"
+ [ -f "${FTP_BASE}/${repo}/os/${arch}/${pkg1}" ] && fail "${repo}/os/${arch}/${pkg1} found"
+
+ local pkg2="pkg-any-b-1-1-${arch}.pkg.tar.xz"
+ checkAnyPackage extra ${pkg2}
+}
+
+testCleanupSplitPackages() {
+ local arches=('i686' 'x86_64')
+ local pkgs=('pkg-split-a' 'pkg-split-b')
+ local pkg
+ local pkgbase
+ local arch
+
+ for pkgbase in ${pkgs[@]}; do
+ for arch in ${arches[@]}; do
+ releasePackage extra ${pkgbase} ${arch}
+ done
+ done
+
+ ../db-update extra
+
+ for pkgbase in ${pkgs[@]}; do
+ for arch in ${arches[@]}; do
+ ../db-remove pkg-split-a extra ${arch}
+ done
+ done
+
+ ../cron-jobs/ftpdir-cleanup
+
+ for arch in ${arches[@]}; do
+ for pkg in "${pkgdir}/${pkgs[0]}"/*-${arch}.pkg.tar.*; do
+ [ -f "${FTP_BASE}/packages/arch/${arch}/${pkg}" ] && fail "packages/arch/${arch}/${pkg} found"
+ [ -f "${FTP_BASE}/${repo}/os/${arch}/${pkg}" ] && fail "${repo}/os/${arch}/${pkg} found"
+ done
+
+ for pkg in "${pkgdir}/${pkgs[1]}"/*-${arch}.pkg.tar.*; do
+ checkPackage extra $(basename ${pkg}) ${arch}
+ done
+ done
+}
+
+
. "${curdir}/lib/shunit2"