]>
Commit | Line | Data |
---|---|---|
9d2a8a73 DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
4 | TESTDIR=$(readlink -f $(dirname $0)) | |
5 | . $TESTDIR/framework | |
6 | setupenvironment | |
7 | configarchitecture 'amd64' | |
8 | ||
9 | TESTFILE="$TESTDIR/framework" | |
10 | cp $TESTFILE aptarchive/foo | |
11 | APTARCHIVE="$(readlink -f ./aptarchive)" | |
12 | ||
13 | getcodenamefromsuite() { echo "jessie"; } | |
14 | buildsimplenativepackage 'foo' 'all' '1.0' 'stable' | |
15 | setupaptarchive --no-update | |
16 | ln -s "${APTARCHIVE}/dists/stable" "${APTARCHIVE}/dists/jessie" | |
17 | for FILE in rootdir/etc/apt/sources.list.d/*-stable-* ; do | |
18 | sed 's#stable#jessie#g' $FILE > $(echo "$FILE" | sed 's#stable#jessie#g') | |
19 | done | |
20 | ||
21 | # install a slowed down file: otherwise its to fast to reproduce combining | |
22 | NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods" | |
23 | OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)" | |
24 | rm $NEWMETHODS | |
25 | mkdir $NEWMETHODS | |
26 | for METH in $(find $OLDMETHODS ! -type d); do | |
27 | ln -s $OLDMETHODS/$(basename $METH) $NEWMETHODS | |
28 | done | |
d2b7b130 DK |
29 | rm "${NEWMETHODS}/file" "${NEWMETHODS}/http" |
30 | cat >"${NEWMETHODS}/file" <<EOF | |
9d2a8a73 DK |
31 | #!/bin/sh |
32 | while read line; do | |
33 | echo "\$line" | |
34 | if [ -z "\$line" ]; then | |
533fe3d1 | 35 | sleep 0.5 |
9d2a8a73 | 36 | fi |
d2b7b130 | 37 | done | "$OLDMETHODS/\${0##*/}" |
9d2a8a73 | 38 | EOF |
d2b7b130 DK |
39 | chmod +x "${NEWMETHODS}/file" |
40 | ln -s "${NEWMETHODS}/file" "${NEWMETHODS}/http" | |
9d2a8a73 DK |
41 | |
42 | tworepos() { | |
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 | ||
62 | tworepos 'file' "$APTARCHIVE" 'no partial' | |
63 | testequal '12' grep -c '200%20URI%20Start' ./download.log | |
64 | testequal '12' grep -c '201%20URI%20Done' ./download.log | |
65 | testequal '6' grep -c '^ @ Queue: Action combined' ./download.log | |
66 | tworepos 'file' "$APTARCHIVE" 'hit' | |
67 | testequal '6' grep -c '200%20URI%20Start' ./download.log | |
68 | testequal '6' grep -c '201%20URI%20Done' ./download.log | |
69 | testequal '0' grep -c '^ @ Queue: Action combined' ./download.log | |
70 | rm -rf rootdir/var/lib/apt/lists | |
71 | ||
72 | changetowebserver | |
73 | ||
74 | tworepos 'http' '//localhost:8080' 'no partial' | |
75 | testequal '10' grep -c '200%20URI%20Start' ./download.log | |
76 | testequal '10' grep -c '201%20URI%20Done' ./download.log | |
77 | testequal '6' grep -c '^ @ Queue: Action combined' ./download.log | |
78 | tworepos 'http' '//localhost:8080' 'hit' | |
79 | testequal '2' grep -c '200%20URI%20Start' ./download.log | |
80 | testequal '4' grep -c '201%20URI%20Done' ./download.log | |
81 | testequal '0' grep -c '^ @ Queue: Action combined' ./download.log | |
82 | rm -rf rootdir/var/lib/apt/lists |