summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-04-06 01:08:57 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-04-07 13:48:31 +0200
commit38f8704e419ed93f433129e20df5611df6652620 (patch)
treeb49599c1b86bb22109fc1f68468e385baf6d9ce0 /test/integration
parent57f16d51f4158dce1a49f6d5f5f05f057125b871 (diff)
stop handling items in doomed transactions
With the previous commit we track the state of transactions, so we can now use our knowledge to avoid processing data for a transaction which was already closed (via an abort in this case). This is needed as multiple independent processes are interacting in the process, so there isn't a simple immediate full-engine stop and it would also be bad to teach each and every item how to check if its manager has failed subordinate and what to do in that case. In the pdiff case, which deals (potentially) with many items during its lifetime e.g. a hashsum mismatch in another file can abort the transaction the file we try to patch via pdiff belongs to. This causes some of the items (which are already done) to be aborted with it, but items still in the process of acquisition continue in the processing and will later try to use all the items together failing in strange ways as cleanup already happened. The chosen solution is to dry up the communication channels instead by ignoring new requests for data acquisition, canceling requests which are not assigned to a queue and not calling Done/Failed on items anymore. This means that e.g. already started or pending (e.g. pipelined) downloads aren't stopped and continue as normal for now, but they remain in partial/ and aren't processed further so the next update command will pick them up and put them to good use while the current process fails updating (for this transaction group) in an orderly fashion. Closes: 817240 Thanks: Barr Detwix & Vincent Lefevre for log files
Diffstat (limited to 'test/integration')
-rwxr-xr-xtest/integration/test-pdiff-usage32
1 files changed, 31 insertions, 1 deletions
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index 11c8c4cc1..4e2d1f182 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -10,9 +10,24 @@ LOWCOSTEXT='lz4'
buildaptarchive
setupflataptarchive
-changetowebserver -o aptwebserver::support::modified-since=false
+changetowebserver
+
+cat >rootdir/etc/apt/apt.conf.d/contents.conf <<EOF
+Acquire::IndexTargets::deb::Contents {
+ MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
+ ShortDescription "Contents";
+ Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents";
+ MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
+ flatMetaKey "Contents-\$(ARCHITECTURE)";
+ flatDescription "\$(RELEASE) \$(ARCHITECTURE) Contents";
+};
+EOF
PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
+echo 'contents for stuff' > aptarchive/Contents-i386
+compressfile aptarchive/Contents-i386
+echo 'hacked' > aptarchive/hacked-i386
+compressfile aptarchive/hacked-i386
wasmergeused() {
testsuccess apt update "$@"
@@ -193,6 +208,21 @@ SHA256-Download:
" aptcache show apt newstuff futurestuff
# we reuse the archive state of the previous test here
+ msgmsg "Testcase: pdiff handling is stopped if transaction fails $*"
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ cp Packages-future aptarchive/Packages
+ rm -f rootdir/var/lib/apt/lists/*_Contents-*
+ webserverconfig 'aptwebserver::overwrite::.*Contents-.*::filename' '/hacked-i386.gz'
+ testfailure apt update "$@" -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1
+ webserverconfig 'aptwebserver::overwrite::.*Contents-.*::filename' '/Contents-i386.gz'
+ cp rootdir/tmp/testfailure.output patchdownload.output
+ testfailure grep 'rred:600' patchdownload.output
+ testnopackage newstuff futurestuff
+ testsuccessequal "$(cat "${PKGFILE}")
+" aptcache show apt oldstuff
+
+ # we reuse the archive state of the previous test here
msgmsg "Testcase: downloading a patch fails, but successful fallback: $*"
rm -rf rootdir/var/lib/apt/lists
cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists