]> git.saurik.com Git - apt.git/blame - test/integration/test-handle-redirect-as-used-mirror-change
implement generic config fallback for methods
[apt.git] / test / integration / test-handle-redirect-as-used-mirror-change
CommitLineData
a4b8112b
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
a4b8112b
DK
6setupenvironment
7configarchitecture 'amd64'
8configcompression '.' 'gz'
9
10buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable'
11
03a34b88 12export APT_DONT_SIGN=''
a4b8112b 13setupaptarchive --no-update
6c0765c0
DK
14changetowebserver
15webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://0.0.0.0:${APTHTTPPORT}/"
16rewritesourceslist "http://localhost:${APTHTTPPORT}/redirectme"
a4b8112b 17
6c0765c0
DK
18testsuccessequal "Get:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease [$(stat -c %s aptarchive/dists/unstable/InRelease) B]
19Get:2 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B]
b2fd8524
DK
20Get:3 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B]
21Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
a4b8112b
DK
22Reading package lists..." aptget update
23
9b8034a9
DK
24# ensure we asked the redirector only once
25testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" grep '^Location:' aptarchive/webserver.log
26
6c0765c0
DK
27testsuccessequal "Hit:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease
28Reading package lists..." aptget update
9b8034a9
DK
29
30testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease
31Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" grep '^Location:' aptarchive/webserver.log
32
33rm -rf rootdir/var/lib/apt/lists
34testsuccess apt update -o Debug::Acquire::http=1 -o Acquire::SameMirrorForAllIndexes=0
35testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease
36Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease
37Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease
38Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/source/Sources.gz
39Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.gz
40Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.gz" grep '^Location:' aptarchive/webserver.log
84ac6edf 41
737ce313 42cd downloaded
84ac6edf
DK
43testsuccess apthelper download-file "http://localhost:${APTHTTPPORT}/redirectme/dists/unstable/InRelease" inrelease
44testsuccess test -s inrelease
03a34b88
DK
45cd - >/dev/null
46
47find aptarchive -name 'InRelease' -delete
48rm -rf rootdir/var/lib/apt/lists
49
50testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease
51 404 Not Found
52Get:2 http://0.0.0.0:${APTHTTPPORT} unstable Release [$(stat -c %s aptarchive/dists/unstable/Release) B]
53Get:3 http://0.0.0.0:${APTHTTPPORT} unstable Release.gpg [$(stat -c %s aptarchive/dists/unstable/Release.gpg) B]
54Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B]
55Get:5 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B]
56Get:6 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
57Reading package lists..." aptget update
58
59testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease
60 404 Not Found
61Hit:2 http://0.0.0.0:${APTHTTPPORT} unstable Release
62Reading package lists..." aptget update
63
64