X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/6c0765c096ffb4df14169236c865bbb2b10974ae..d3930f8716f439c229cd3d11813823d847a2ecff:/test/integration/test-handle-redirect-as-used-mirror-change diff --git a/test/integration/test-handle-redirect-as-used-mirror-change b/test/integration/test-handle-redirect-as-used-mirror-change index a1842462a..2f6431e66 100755 --- a/test/integration/test-handle-redirect-as-used-mirror-change +++ b/test/integration/test-handle-redirect-as-used-mirror-change @@ -1,14 +1,15 @@ #!/bin/sh set -e -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" setupenvironment configarchitecture 'amd64' configcompression '.' 'gz' buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' +export APT_DONT_SIGN='' setupaptarchive --no-update changetowebserver webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://0.0.0.0:${APTHTTPPORT}/" @@ -16,9 +17,48 @@ rewritesourceslist "http://localhost:${APTHTTPPORT}/redirectme" testsuccessequal "Get:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease [$(stat -c %s aptarchive/dists/unstable/InRelease) B] Get:2 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B] -Get:3 http://0.0.0.0:${APTHTTPPORT} unstable/main amd64 Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-amd64/Packages.gz) B] +Get:3 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B] Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B] Reading package lists..." aptget update +# ensure we asked the redirector only once +testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" grep '^Location:' aptarchive/webserver.log + testsuccessequal "Hit:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease Reading package lists..." aptget update + +testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease +Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" grep '^Location:' aptarchive/webserver.log + +rm -rf rootdir/var/lib/apt/lists +testsuccess apt update -o Debug::Acquire::http=1 -o Acquire::SameMirrorForAllIndexes=0 +testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease +Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease +Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease +Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/source/Sources.gz +Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.gz +Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.gz" grep '^Location:' aptarchive/webserver.log + +cd downloaded +testsuccess apthelper download-file "http://localhost:${APTHTTPPORT}/redirectme/dists/unstable/InRelease" inrelease +testsuccess test -s inrelease +cd - >/dev/null + +find aptarchive -name 'InRelease' -delete +rm -rf rootdir/var/lib/apt/lists + +testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease + 404 Not Found +Get:2 http://0.0.0.0:${APTHTTPPORT} unstable Release [$(stat -c %s aptarchive/dists/unstable/Release) B] +Get:3 http://0.0.0.0:${APTHTTPPORT} unstable Release.gpg [$(stat -c %s aptarchive/dists/unstable/Release.gpg) B] +Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B] +Get:5 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B] +Get:6 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B] +Reading package lists..." aptget update + +testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease + 404 Not Found +Hit:2 http://0.0.0.0:${APTHTTPPORT} unstable Release +Reading package lists..." aptget update + +