]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-handle-redirect-as-used-mirror-change
fix testcase expecting incorrect remove log from dpkg
[apt.git] / test / integration / test-handle-redirect-as-used-mirror-change
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
7configarchitecture 'amd64'
8configcompression '.' 'gz'
9
10buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable'
11
12export APT_DONT_SIGN=''
13setupaptarchive --no-update
14changetowebserver
15webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://0.0.0.0:${APTHTTPPORT}/"
16rewritesourceslist "http://localhost:${APTHTTPPORT}/redirectme"
17
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]
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]
22Reading package lists..." aptget update
23
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
27testsuccessequal "Hit:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease
28Reading package lists..." aptget update
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
41
42cd downloaded
43testsuccess apthelper download-file "http://localhost:${APTHTTPPORT}/redirectme/dists/unstable/InRelease" inrelease
44testsuccess test -s inrelease
45cd - >/dev/null
46
47webserverconfig "aptwebserver::redirect::replace::http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" "http://0.0.0.0:${APTHTTPPORT}/storage/dists/unstable/InRelease"
48mkdir -p aptarchive/storage/dists/unstable
49mv aptarchive/dists/unstable/InRelease aptarchive/storage/dists/unstable
50rm -rf rootdir/var/lib/apt/lists
51testsuccessequal "Get:1 http://0.0.0.0:${APTHTTPPORT}/storage unstable InRelease [$(stat -c %s aptarchive/storage/dists/unstable/InRelease) B]
52Ign:2 http://0.0.0.0:${APTHTTPPORT}/storage unstable/main Sources
53 404 Not Found
54Ign:3 http://0.0.0.0:${APTHTTPPORT}/storage unstable/main all Packages
55 404 Not Found
56Ign:4 http://0.0.0.0:${APTHTTPPORT}/storage unstable/main Translation-en
57 404 Not Found
58Get:2 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B]
59Get:3 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B]
60Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
61Reading package lists...
62Building dependency tree...
63All packages are up to date." apt update
64
65find aptarchive -name 'InRelease' -delete
66rm -rf rootdir/var/lib/apt/lists
67
68testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT}/storage unstable InRelease
69 404 Not Found
70Get:2 http://0.0.0.0:${APTHTTPPORT} unstable Release [$(stat -c %s aptarchive/dists/unstable/Release) B]
71Get:3 http://0.0.0.0:${APTHTTPPORT} unstable Release.gpg [$(stat -c %s aptarchive/dists/unstable/Release.gpg) B]
72Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B]
73Get:5 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B]
74Get:6 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
75Reading package lists..." aptget update
76
77testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT}/storage unstable InRelease
78 404 Not Found
79Hit:2 http://0.0.0.0:${APTHTTPPORT} unstable Release
80Reading package lists..." aptget update
81
82rm -rf rootdir/var/lib/apt/lists
83find aptarchive -name 'Release.gpg' -delete
84find aptarchive -name 'Release' -delete
85testwarning aptget update
86testsuccess grep 'does not have a Release file' rootdir/tmp/testwarning.output