]> git.saurik.com Git - apt.git/blame - test/integration/test-acquire-same-repository-multiple-times
tests: refactor printing of the quiet failure header
[apt.git] / test / integration / test-acquire-same-repository-multiple-times
CommitLineData
9d2a8a73
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture 'amd64'
8
9TESTFILE="$TESTDIR/framework"
10cp $TESTFILE aptarchive/foo
11APTARCHIVE="$(readlink -f ./aptarchive)"
12
13getcodenamefromsuite() { echo "jessie"; }
14buildsimplenativepackage 'foo' 'all' '1.0' 'stable'
15setupaptarchive --no-update
16ln -s "${APTARCHIVE}/dists/stable" "${APTARCHIVE}/dists/jessie"
17for FILE in rootdir/etc/apt/sources.list.d/*-stable-* ; do
18 sed 's#stable#jessie#g' $FILE > $(echo "$FILE" | sed 's#stable#jessie#g')
19done
20
21# install a slowed down file: otherwise its to fast to reproduce combining
22NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods"
23OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)"
24rm $NEWMETHODS
25mkdir $NEWMETHODS
26for METH in $(find $OLDMETHODS ! -type d); do
27 ln -s $OLDMETHODS/$(basename $METH) $NEWMETHODS
28done
d2b7b130
DK
29rm "${NEWMETHODS}/file" "${NEWMETHODS}/http"
30cat >"${NEWMETHODS}/file" <<EOF
9d2a8a73
DK
31#!/bin/sh
32while read line; do
33 echo "\$line"
34 if [ -z "\$line" ]; then
533fe3d1 35 sleep 0.5
9d2a8a73 36 fi
d2b7b130 37done | "$OLDMETHODS/\${0##*/}"
9d2a8a73 38EOF
d2b7b130
DK
39chmod +x "${NEWMETHODS}/file"
40ln -s "${NEWMETHODS}/file" "${NEWMETHODS}/http"
9d2a8a73
DK
41
42tworepos() {
43 msgtest "Downloading the same repository twice over $1" "$3"
44 testsuccess --nomsg aptget update -o Debug::pkgAcquire::Worker=1
45 cp rootdir/tmp/testsuccess.output download.log
46 #cat download.log
c2a4a8dd 47 aptget indextargets --format '$(FILENAME)' --no-release-info | sort > file.lst
9d2a8a73
DK
48 testequal "$(find $(readlink -f ./rootdir/var/lib/apt/lists) -name '*_dists_*' \( ! -name '*InRelease' \) -type f | sort)" cat file.lst
49 testsuccess aptcache policy
50 testequal "foo:
51 Installed: (none)
52 Candidate: 1.0
53 Version table:
76b004d1 54 1.0 500
9d2a8a73
DK
55 500 $1:$2 jessie/main amd64 Packages
56 500 $1:$2 stable/main amd64 Packages" aptcache policy foo
57 testfailure aptcache show foo/unstable
58 testsuccess aptcache show foo/stable
59 testsuccess aptcache show foo/jessie
60}
61
62tworepos 'file' "$APTARCHIVE" 'no partial'
63testequal '12' grep -c '200%20URI%20Start' ./download.log
64testequal '12' grep -c '201%20URI%20Done' ./download.log
65testequal '6' grep -c '^ @ Queue: Action combined' ./download.log
66tworepos 'file' "$APTARCHIVE" 'hit'
67testequal '6' grep -c '200%20URI%20Start' ./download.log
68testequal '6' grep -c '201%20URI%20Done' ./download.log
69testequal '0' grep -c '^ @ Queue: Action combined' ./download.log
70rm -rf rootdir/var/lib/apt/lists
71
72changetowebserver
73
74tworepos 'http' '//localhost:8080' 'no partial'
75testequal '10' grep -c '200%20URI%20Start' ./download.log
76testequal '10' grep -c '201%20URI%20Done' ./download.log
77testequal '6' grep -c '^ @ Queue: Action combined' ./download.log
78tworepos 'http' '//localhost:8080' 'hit'
79testequal '2' grep -c '200%20URI%20Start' ./download.log
80testequal '4' grep -c '201%20URI%20Done' ./download.log
81testequal '0' grep -c '^ @ Queue: Action combined' ./download.log
82rm -rf rootdir/var/lib/apt/lists