summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2022-04-28 16:44:13 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2024-11-22 12:40:10 +0000
commitafc7b0dbf1114f3d723ff0e1ab9d0796cd799970 (patch)
tree90f5cc06822d73102b9ec3620ab01793d40ad0d8 /test
parentd9601bce6e1fa61cbb3dc4d66e5492f9885eef8f (diff)
Do not assume mirror-URIs end in a filename causing a hang
In practice most of them will, but making the acquire process hang in response if they don't seems like an overly excessive response if we can just support it gracefully to reply with an error (or actually succeed in the unlikely event this URI is actually correct).
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-method-mirror15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/integration/test-method-mirror b/test/integration/test-method-mirror
index ce44b86e3..1784e1ecb 100755
--- a/test/integration/test-method-mirror
+++ b/test/integration/test-method-mirror
@@ -124,9 +124,22 @@ msgmsg 'all mirrored via file'
APTARCHIVE="$(readlink -f ./aptarchive)"
sed -i -e "s#mirror+http://localhost:${APTHTTPPORT}#mirror+file:${APTARCHIVE}#" rootdir/etc/apt/sources.list.d/*
testrun '*_localhost_*' '*_aptarchive_mirror.txt.gz_*'
+sed -i -e 's#/mirror\.txt\.gz stable#/mirror.txt stable#' rootdir/etc/apt/sources.list.d/*
+
+mv rootdir/etc/apt/sources.list.d rootdir/etc/apt/sources.list.d.bak
+mkdir rootdir/etc/apt/sources.list.d
+msgmsg 'fail gracefully if mirror uri has no filename'
+echo "deb mirror://localhost:${APTHTTPPORT}/ stable main" > rootdir/etc/apt/sources.list.d/mirrordir.list
+testfailure apt update
+
+msgmsg 'but succeed if it is indeed a mirror list'
+ln -s mirror.txt aptarchive/index.html
+testsuccess apt update
+rm aptarchive/index.html rootdir/etc/apt/sources.list.d/mirrordir.list
+rmdir rootdir/etc/apt/sources.list.d
+mv rootdir/etc/apt/sources.list.d.bak rootdir/etc/apt/sources.list.d
msgmsg 'fallback mirrors are used if needed' 'as usual'
-sed -i -e 's#/mirror\.txt\.gz stable#/mirror.txt stable#' rootdir/etc/apt/sources.list.d/*
echo "http://localhost:${APTHTTPPORT}/failure2 priority:3
http://localhost:${APTHTTPPORT}/redirectme priority:2
http://localhost:${APTHTTPPORT}/failure priority:1" > aptarchive/mirror.txt