summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-05-10 19:15:17 +0200
committerJulian Andres Klode <jak@debian.org>2016-05-10 20:14:02 +0200
commit35664152e47a1d4d712fd52e0f0a2dc8ed359d32 (patch)
tree756765bc6f68260a842ea53557d8883048efd5c5 /test
parentc7b7d4da7f8b8edd9c3d6b13f0b935853ad8a039 (diff)
update: Run Post-Invoke-Success if not all sources failed
Failures can happen and APT regardless will do a partial cache update anyway. Because APT ensures that the list directory is in a sane state, it makes sense to also call success hooks if success was only partial - otherwise it loses sync with APT. Most importantly, this causes the appstream cache to be empty, see launchpad bug #1562733. This is somewhat overly optimistic though: As soon as any repository has nonexisting optional files, the missing optional files are also treated as success, which means a single broken repository without an InRelease file still runs Success hooks, even though it really should not.
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-apt-update-hooks43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/integration/test-apt-update-hooks b/test/integration/test-apt-update-hooks
new file mode 100755
index 000000000..0a4ee59b4
--- /dev/null
+++ b/test/integration/test-apt-update-hooks
@@ -0,0 +1,43 @@
+#!/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' 'any' '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"
+signreleasefiles
+testfailure aptget update
+cp rootdir/tmp/testfailure.output aptupdate.output
+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
+testfailure aptget update
+cp rootdir/tmp/testfailure.output aptupdate.output
+testsuccess grep "RUN" aptupdate.output
+testfailure grep "SUCCESS" aptupdate.output