| 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 |
|
| 11 |
setupaptarchive |
| 12 |
changetowebserver --request-absolute='uri' |
| 13 |
|
| 14 |
msgtest 'Check that absolute paths are' 'not accepted' |
| 15 |
testfailure --nomsg aptget update --allow-insecure-repositories |
| 16 |
|
| 17 |
echo "Acquire::http::Proxy \"http://localhost:${APTHTTPPORT}\";" > rootdir/etc/apt/apt.conf.d/99proxy |
| 18 |
|
| 19 |
msgtest 'Check that requests to proxies are' 'absolute uris via config' |
| 20 |
testsuccess --nomsg aptget update |
| 21 |
|
| 22 |
testsuccessequal 'Reading package lists... |
| 23 |
Building dependency tree... |
| 24 |
The following NEW packages will be installed: |
| 25 |
unrelated |
| 26 |
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. |
| 27 |
Inst unrelated (0.5~squeeze1 unstable [all]) |
| 28 |
Conf unrelated (0.5~squeeze1 unstable [all])' aptget install unrelated -s |
| 29 |
|
| 30 |
rm -f rootdir/etc/apt/apt.conf.d/99proxy |
| 31 |
echo "Acquire::http::Proxy-Auto-Detect \"${TMPWORKINGDIRECTORY}/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect |
| 32 |
cat > "${TMPWORKINGDIRECTORY}/apt-proxy-detect" <<EOF |
| 33 |
#!/bin/sh |
| 34 |
set -e |
| 35 |
echo "http://localhost:${APTHTTPPORT}" |
| 36 |
EOF |
| 37 |
chmod 755 "${TMPWORKINGDIRECTORY}/apt-proxy-detect" |
| 38 |
|
| 39 |
msgtest 'Check that requests to proxies are' 'absolute uris via auto-detect' |
| 40 |
testsuccess aptget update -o Debug::Acquire::http=1 |
| 41 |
|
| 42 |
testsuccessequal 'Reading package lists... |
| 43 |
Building dependency tree... |
| 44 |
The following NEW packages will be installed: |
| 45 |
unrelated |
| 46 |
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. |
| 47 |
Inst unrelated (0.5~squeeze1 unstable [all]) |
| 48 |
Conf unrelated (0.5~squeeze1 unstable [all])' aptget install unrelated -s |
| 49 |
|
| 50 |
chmod 444 "${TMPWORKINGDIRECTORY}/apt-proxy-detect" |
| 51 |
msgtest 'Check that non-executable proxy commands result in' 'permission error' |
| 52 |
testfailure --nomsg aptget update |
| 53 |
testsuccess grep 'can not be executed' rootdir/tmp/testfailure.output |