summaryrefslogtreecommitdiffstats
path: root/test/integration/test-apt-update-hooks
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:14:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:14:41 +0000
commit549a391d6438e828001eeeaf235b080c054a7bf3 (patch)
tree1bb6b1ea5987fa167a1d13abe82209cc882dd94b /test/integration/test-apt-update-hooks
parentInitial commit. (diff)
downloadapt-upstream/2.2.4.tar.xz
apt-upstream/2.2.4.zip
Adding upstream version 2.2.4.upstream/2.2.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/test-apt-update-hooks')
-rwxr-xr-xtest/integration/test-apt-update-hooks49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/integration/test-apt-update-hooks b/test/integration/test-apt-update-hooks
new file mode 100755
index 0000000..d81ef29
--- /dev/null
+++ b/test/integration/test-apt-update-hooks
@@ -0,0 +1,49 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+configarchitecture 'i386'
+confighashes 'SHA512'
+
+insertpackage 'unstable' 'foo' 'i386' '1.0'
+insertpackage 'testing' 'foo' 'i386' '1.0'
+
+setupaptarchive --no-update
+APTARCHIVE="$(readlink -f ./aptarchive)"
+
+signreleasefiles 'Joe Sixpack'
+
+echo 'APT::Update::Post-Invoke-Success { "echo SUCCESS"; };' >> rootdir/etc/apt/apt.conf.d/display-success.conf
+echo 'APT::Update::Post-Invoke { "echo RUN"; };' >> rootdir/etc/apt/apt.conf.d/display-success.conf
+
+
+msgmsg "All sources OK => run Post-Invoke-Success and Post-Invoke"
+testsuccess aptget update
+cp rootdir/tmp/testsuccess.output aptupdate.output
+testsuccess grep "RUN" aptupdate.output
+testsuccess grep "SUCCESS" aptupdate.output
+
+msgmsg "Some sources broken => run Post-Invoke-Success and Post-Invoke"
+sed -i -e '/^ / d' -e '/^SHA512:/ d' "$APTARCHIVE/dists/unstable/Release"
+testsuccess rm "$(aptget indextargets 'Created-By: Packages' 'Suite: testing' --format '$(FILENAME)')"
+signreleasefiles
+listcurrentlistsdirectory > lists.before
+testfailure apt update
+cp rootdir/tmp/testfailure.output aptupdate.output
+listcurrentlistsdirectory > lists.after
+testfailure cmp lists.before lists.after
+testsuccess grep "RUN" aptupdate.output
+testsuccess grep "SUCCESS" aptupdate.output
+
+msgmsg "All sources broken => run Post-Invoke"
+sed -i -e '/^ / d' -e '/^SHA512:/ d' "$APTARCHIVE/dists/testing/Release"
+signreleasefiles
+mv lists.after lists.before
+testfailure apt update
+cp rootdir/tmp/testfailure.output aptupdate.output
+testfileequal lists.before "$(listcurrentlistsdirectory)"
+testsuccess grep "RUN" aptupdate.output
+testfailure grep "SUCCESS" aptupdate.output