]> git.saurik.com Git - apt.git/blame - test/integration/test-handle-redirect-as-used-mirror-change
The entire concept of PendingError() is flawed :/.
[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
e1ae0531
DK
24grepwebserverlogs() {
25 testsuccess grep -h "$1" aptarchive/webserver.log.client*.log
26 shift
27 sort rootdir/tmp/testsuccess.output > aptwebserver.log
28 testfileequal 'aptwebserver.log' "$@"
29}
30
9b8034a9 31# ensure we asked the redirector only once
e1ae0531 32grepwebserverlogs '^Location:' "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease"
9b8034a9 33
6c0765c0
DK
34testsuccessequal "Hit:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease
35Reading package lists..." aptget update
9b8034a9 36
e1ae0531
DK
37grepwebserverlogs '^Location:' "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease
38Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease"
9b8034a9
DK
39
40rm -rf rootdir/var/lib/apt/lists
41testsuccess apt update -o Debug::Acquire::http=1 -o Acquire::SameMirrorForAllIndexes=0
e1ae0531 42grepwebserverlogs '^Location:' "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease
9b8034a9
DK
43Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease
44Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease
9b8034a9 45Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.gz
e1ae0531
DK
46Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.gz
47Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/source/Sources.gz"
84ac6edf 48
737ce313 49cd downloaded
84ac6edf
DK
50testsuccess apthelper download-file "http://localhost:${APTHTTPPORT}/redirectme/dists/unstable/InRelease" inrelease
51testsuccess test -s inrelease
03a34b88
DK
52cd - >/dev/null
53
ad941661
DK
54webserverconfig "aptwebserver::redirect::replace::http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" "http://0.0.0.0:${APTHTTPPORT}/storage/dists/unstable/InRelease"
55mkdir -p aptarchive/storage/dists/unstable
56mv aptarchive/dists/unstable/InRelease aptarchive/storage/dists/unstable
57rm -rf rootdir/var/lib/apt/lists
58testsuccessequal "Get:1 http://0.0.0.0:${APTHTTPPORT}/storage unstable InRelease [$(stat -c %s aptarchive/storage/dists/unstable/InRelease) B]
59Ign:2 http://0.0.0.0:${APTHTTPPORT}/storage unstable/main Sources
60 404 Not Found
61Ign:3 http://0.0.0.0:${APTHTTPPORT}/storage unstable/main all Packages
62 404 Not Found
63Ign:4 http://0.0.0.0:${APTHTTPPORT}/storage unstable/main Translation-en
64 404 Not Found
65Get:2 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B]
66Get:3 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B]
67Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
68Reading package lists...
69Building dependency tree...
70All packages are up to date." apt update
71
03a34b88
DK
72find aptarchive -name 'InRelease' -delete
73rm -rf rootdir/var/lib/apt/lists
74
ad941661 75testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT}/storage unstable InRelease
03a34b88
DK
76 404 Not Found
77Get:2 http://0.0.0.0:${APTHTTPPORT} unstable Release [$(stat -c %s aptarchive/dists/unstable/Release) B]
78Get:3 http://0.0.0.0:${APTHTTPPORT} unstable Release.gpg [$(stat -c %s aptarchive/dists/unstable/Release.gpg) B]
79Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B]
80Get:5 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B]
81Get:6 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
82Reading package lists..." aptget update
83
ad941661 84testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT}/storage unstable InRelease
03a34b88
DK
85 404 Not Found
86Hit:2 http://0.0.0.0:${APTHTTPPORT} unstable Release
87Reading package lists..." aptget update
2e2865ae
DK
88
89rm -rf rootdir/var/lib/apt/lists
90find aptarchive -name 'Release.gpg' -delete
91find aptarchive -name 'Release' -delete
92testwarning aptget update
93testsuccess grep 'does not have a Release file' rootdir/tmp/testwarning.output