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