]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-738785-switch-protocol
simplify code some more to make reddit happy
[apt.git] / test / integration / test-bug-738785-switch-protocol
CommitLineData
9082a1fc
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture "i386"
9
10buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
11
12# setup http redirecting to https
13setupaptarchive --no-update
14changetowebserver -o 'aptwebserver::redirect::replace::/redirectme/=https://localhost:4433/' \
15 -o 'aptwebserver::support::http=false'
16changetohttpswebserver
17sed -i -e 's#:4433/#:8080/redirectme#' -e 's# https:# http:#' rootdir/etc/apt/sources.list.d/*
18
19testsuccess aptget update -o Debug::Acquire::http=1 -o Debug::Acquire::https=1 -o Debug::pkgAcquire::Worker=1
20
21msgtest 'Test that the webserver does not answer' 'http requests'
dc95fee1 22downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog >/dev/null 2>&1 && msgfail || msgpass
9082a1fc
DK
23
24echo 'Apt::Changelogs::Server "http://localhost:8080/redirectme";' > rootdir/etc/apt/apt.conf.d/changelog.conf
25testequal "'http://localhost:8080/redirectme/pool/apt_1.0/changelog'" aptget changelog apt --print-uris
26
27testsuccess aptget changelog apt -d
28testsuccess test -s apt.changelog
29rm -f apt.changelog
30
31testsuccess aptget download apt
32testsuccess test -s apt_1.0_all.deb
33rm apt_1.0_all.deb
34
35testsuccess aptget install apt -y
36testdpkginstalled 'apt'
37
38# create a copy of all methods, expect https
39eval `aptconfig shell METHODS Dir::Bin::Methods/d`
40COPYMETHODS='usr/lib/apt/methods'
41rm rootdir/$COPYMETHODS
42mkdir -p rootdir/$COPYMETHODS
43cd rootdir/$COPYMETHODS
44find $METHODS \! -type d | while read meth; do
45 ln -s $meth
46done
47rm https
48cd - >/dev/null
49echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf
50
51aptget download apt
52testsuccess test ! -e apt_1.0_all.deb