]> git.saurik.com Git - apt.git/blame - test/integration/test-different-methods-for-same-source
implement generic config fallback for methods
[apt.git] / test / integration / test-different-methods-for-same-source
CommitLineData
b90faf24
DK
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
7configarchitecture 'amd64'
8
9insertpackage 'stable' 'foo' 'all' '1'
10insertsource 'stable' 'foo' 'all' '1'
11setupaptarchive --no-update
12
13# install a slowed down file: otherwise its to fast to reproduce combining
14NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods"
15OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)"
16rm "$NEWMETHODS"
17mkdir "$NEWMETHODS"
18backupIFS="$IFS"
19IFS="$(printf "\n\b")"
782c60a6 20for METH in $(find "$OLDMETHODS" -maxdepth 1 ! -type d); do
b90faf24
DK
21 ln -s "$OLDMETHODS/$(basename "$METH")" "$NEWMETHODS"
22done
23IFS="$backupIFS"
24ln -s "${OLDMETHODS}/http" "${NEWMETHODS}/http-ng"
25
26changetowebserver
30060442 27webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://localhost:${APTHTTPPORT}/"
b90faf24
DK
28sed -i -e 's# http:# http-ng:#' $(find rootdir/etc/apt/sources.list.d -name '*-deb-src.list')
29
30060442 30testsuccess apt update -o Debug::Acquire::http-ng=1
b90faf24
DK
31cp rootdir/tmp/testsuccess.output update.log
32# all requests are folded into the first Release file
33testsuccess grep ' http-ng://' update.log
34testfailure grep ' http://' update.log
30060442
DK
35# see if method-specific debug was enabled
36testsuccess grep '^Answer for: http-ng:' update.log
37
38rm -rf rootdir/var/lib/apt/lists
39sed -i -e "s#:${APTHTTPPORT}/#:${APTHTTPPORT}/redirectme#" rootdir/etc/apt/sources.list.d/*
40testsuccess apt update -o Debug::Acquire::http-ng=1
41cp rootdir/tmp/testsuccess.output update.log
42# all requests are folded into the first Release file
43testsuccess grep ' http-ng://' update.log
44testfailure grep '^[^L].* http://' update.log
45# see if method-specific debug was enabled
46testsuccess grep '^Answer for: http-ng:' update.log