summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-09-21 21:50:28 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-09-29 22:07:24 +0200
commitc8c37477864638ca37088433f0061e5b62f6986f (patch)
tree2d1545e17bf8ac1cf7056e362bae553db4918a86
parentcc66259d339ec805265503662bf5da61f63512cc (diff)
Add tests for aurblup
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rw-r--r--test/setup.sh6
-rwxr-xr-xtest/t2400-aurblup.sh53
2 files changed, 59 insertions, 0 deletions
diff --git a/test/setup.sh b/test/setup.sh
index 622aab0..e379ada 100644
--- a/test/setup.sh
+++ b/test/setup.sh
@@ -14,6 +14,7 @@ GIT_UPDATE="$TOPLEVEL/git-interface/git-update.py"
MKPKGLISTS="$TOPLEVEL/scripts/mkpkglists.py"
TUVOTEREMINDER="$TOPLEVEL/scripts/tuvotereminder.py"
PKGMAINT="$TOPLEVEL/scripts/pkgmaint.py"
+AURBLUP="$TOPLEVEL/scripts/aurblup.py"
# Create the configuration file and a dummy notification script.
cat >config <<-EOF
@@ -44,6 +45,11 @@ ssh-cmdline = ssh aur@aur.archlinux.org
[update]
max-blob-size = 256000
+[aurblup]
+db-path = $(pwd)/sync/
+sync-dbs = test
+server = file://$(pwd)/remote/
+
[mkpkglists]
packagesfile = packages.gz
pkgbasefile = pkgbase.gz
diff --git a/test/t2400-aurblup.sh b/test/t2400-aurblup.sh
new file mode 100755
index 0000000..708281c
--- /dev/null
+++ b/test/t2400-aurblup.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+test_description='aurblup tests'
+
+. ./setup.sh
+
+test_expect_success 'Test official provider update script.' '
+ mkdir -p remote/test/foobar-1.0-1 &&
+ cat <<-EOD >remote/test/foobar-1.0-1/desc &&
+ %FILENAME%
+ foobar-1.0-any.pkg.tar.xz
+
+ %NAME%
+ foobar
+
+ %VERSION%
+ 1.0-1
+
+ %ARCH%
+ any
+ EOD
+ mkdir -p remote/test/foobar2-1.0-1 &&
+ cat <<-EOD >remote/test/foobar2-1.0-1/desc &&
+ %FILENAME%
+ foobar2-1.0-any.pkg.tar.xz
+
+ %NAME%
+ foobar2
+
+ %VERSION%
+ 1.0-1
+
+ %ARCH%
+ any
+
+ %PROVIDES%
+ foobar3
+ foobar4
+ EOD
+ ( cd remote/test && bsdtar -czf ../test.db * ) &&
+ mkdir sync &&
+ "$AURBLUP" &&
+ cat <<-EOD >expected &&
+ foobar|test|foobar
+ foobar2|test|foobar2
+ foobar2|test|foobar3
+ foobar2|test|foobar4
+ EOD
+ echo "SELECT Name, Repo, Provides FROM OfficialProviders ORDER BY Provides;" | sqlite3 aur.db >actual &&
+ test_cmp actual expected
+'
+
+test_done