]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-602412-dequote-redirect
test-apt-update-reporting: Make more use of framework
[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'
10
27925d82 11setupaptarchive --no-update
7ea27d2a
DK
12changetowebserver -o aptwebserver::redirect::replace::/pool/=/newpool/ \
13 -o aptwebserver::redirect::replace::/dists/=/newdists/
14
15mv aptarchive/pool aptarchive/newpool
16mv aptarchive/dists aptarchive/newdists
17
f9b4f12d 18testrun() {
aa3e7b32 19 msgmsg "Test $1 redirection works in method boundaries" "$2"
f9b4f12d
DK
20 msgtest 'Test redirection works in' 'apt-get update'
21 testsuccess --nomsg aptget update
22
23 # check that I-M-S header is kept in redirections
aa3e7b32 24 testsuccessequal "Hit:1 $2 unstable InRelease
4bcb5f4b 25Reading package lists..." aptget update
f9b4f12d
DK
26
27 msgtest 'Test redirection works in' 'package download'
28 testsuccess --nomsg aptget install unrelated --download-only -y
29}
30
aa3e7b32
DK
31for CODE in 301 302 307; do
32 webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
33 testrun "$CODE" "http://localhost:${APTHTTPPORT}"
34 testsuccess grep "^HTTP/1.1 $CODE " aptarchive/webserver.log
35 rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
36done
f9b4f12d 37
f9b4f12d
DK
38changetohttpswebserver
39
aa3e7b32
DK
40for CODE in 301 302 307; do
41 webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
42 testrun "$CODE" "https://localhost:${APTHTTPSPORT}"
43 rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
44done