]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-bug-602412-dequote-redirect
pass --force-remove-essential to dpkg only if needed
[apt.git] / test / integration / test-bug-602412-dequote-redirect
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
7configarchitecture 'amd64'
8
9buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable'
10buildsimplenativepackage 'unrelated2' 'all' '0.5~squeeze1' 'unstable'
11insertinstalledpackage 'unrelated2' 'all' '0.1'
12
13setupaptarchive --no-update
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
20testrun() {
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
27Reading package lists..." aptget update
28
29 msgtest 'Test redirection works in' 'package download'
30 testsuccess --nomsg aptget install unrelated --download-only -y
31}
32
33for CODE in 301 302 307; do
34 webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
35 testrun "$CODE" "http://localhost:${APTHTTPPORT}"
36 testsuccess grep "^HTTP/1.1 $CODE " aptarchive/webserver.log
37 rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
38done
39
40changetohttpswebserver
41
42for CODE in 301 302 307; do
43 webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
44 testrun "$CODE" "https://localhost:${APTHTTPSPORT}"
45 rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
46done
47
48testsuccess apt update
49testsuccess aptget install unrelated --download-only
50testsuccessequal 'Reading package lists...
51Building dependency tree...
52Calculating upgrade...
53The following NEW packages will be installed:
54 unrelated
55The following packages have been kept back:
56 unrelated2
570 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
58Inst unrelated (0.5~squeeze1 unstable [all])
59Conf unrelated (0.5~squeeze1 unstable [all])' aptget dist-upgrade unrelated --no-download --fix-missing -s
60testsuccess aptget dist-upgrade unrelated --no-download --fix-missing -y
61testdpkginstalled unrelated