]> git.saurik.com Git - apt.git/blob - test/integration/test-bug-602412-dequote-redirect
unlinkat is way way too modern to not autoconf :/.
[apt.git] / test / integration / test-bug-602412-dequote-redirect
1 #!/bin/sh
2 set -e
3
4 TESTDIR="$(readlink -f "$(dirname "$0")")"
5 . "$TESTDIR/framework"
6 setupenvironment
7 configarchitecture 'amd64'
8
9 buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable'
10 buildsimplenativepackage 'unrelated2' 'all' '0.5~squeeze1' 'unstable'
11 insertinstalledpackage 'unrelated2' 'all' '0.1'
12
13 setupaptarchive --no-update
14 changetowebserver -o aptwebserver::redirect::replace::/pool/=/newpool/ \
15 -o aptwebserver::redirect::replace::/dists/=/newdists/
16
17 mv aptarchive/pool aptarchive/newpool
18 mv aptarchive/dists aptarchive/newdists
19
20 testrun() {
21 msgmsg "Test $1 redirection works in method boundaries" "$2"
22 msgtest 'Test redirection works in' 'apt-get update'
23 testsuccess --nomsg aptget update
24
25 # check that I-M-S header is kept in redirections
26 testsuccessequal "Hit:1 $2 unstable InRelease
27 Reading package lists..." aptget update
28
29 msgtest 'Test redirection works in' 'package download'
30 testsuccess --nomsg aptget install unrelated --download-only -y
31 }
32
33 for CODE in 301 302 307; do
34 webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
35 rm -f aptarchive/webserver.log.client*.log
36 testrun "$CODE" "http://localhost:${APTHTTPPORT}"
37 testsuccess grep "^HTTP/1.1 $CODE " aptarchive/webserver.log.client*.log
38 rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
39 done
40
41 changetohttpswebserver
42
43 for CODE in 301 302 307; do
44 webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
45 rm -f aptarchive/webserver.log.client*.log
46 testrun "$CODE" "https://localhost:${APTHTTPSPORT}"
47 testsuccess grep "^HTTP/1.1 $CODE " aptarchive/webserver.log.client*.log
48 rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
49 done
50
51 testsuccess apt update
52 testsuccess aptget install unrelated --download-only
53 testsuccessequal 'Reading package lists...
54 Building dependency tree...
55 Calculating upgrade...
56 The following NEW packages will be installed:
57 unrelated
58 The following packages have been kept back:
59 unrelated2
60 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
61 Inst unrelated (0.5~squeeze1 unstable [all])
62 Conf unrelated (0.5~squeeze1 unstable [all])' aptget dist-upgrade unrelated --no-download --fix-missing -s
63 testsuccess aptget dist-upgrade unrelated --no-download --fix-missing -y
64 testdpkginstalled unrelated