From 9d2a8a7388cf3b0bbbe92f6b0b30a533e1167f40 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 15 Jun 2015 23:06:56 +0200 Subject: condense parallel requests with the same hashes to one It shouldn't be too common, but sometimes people have multiple mirrors in the sources or otherwise repositories with the same content. Now that we gracefully can handle multiple requests to the same URI, we can also fold multiple requests with the same expected hashes into one. Note that this isn't trying to find oppertunities for merging, but just merges if it happens to encounter the oppertunity for it. This is most obvious in the new testcase actually as it needs to delay the action to give the acquire system enough time to figure out that they can be merged. --- .../test-acquire-same-repository-multiple-times | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 test/integration/test-acquire-same-repository-multiple-times (limited to 'test/integration/test-acquire-same-repository-multiple-times') diff --git a/test/integration/test-acquire-same-repository-multiple-times b/test/integration/test-acquire-same-repository-multiple-times new file mode 100755 index 000000000..bfeaf88db --- /dev/null +++ b/test/integration/test-acquire-same-repository-multiple-times @@ -0,0 +1,81 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +TESTFILE="$TESTDIR/framework" +cp $TESTFILE aptarchive/foo +APTARCHIVE="$(readlink -f ./aptarchive)" + +getcodenamefromsuite() { echo "jessie"; } +buildsimplenativepackage 'foo' 'all' '1.0' 'stable' +setupaptarchive --no-update +ln -s "${APTARCHIVE}/dists/stable" "${APTARCHIVE}/dists/jessie" +for FILE in rootdir/etc/apt/sources.list.d/*-stable-* ; do + sed 's#stable#jessie#g' $FILE > $(echo "$FILE" | sed 's#stable#jessie#g') +done + +# install a slowed down file: otherwise its to fast to reproduce combining +NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods" +OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)" +rm $NEWMETHODS +mkdir $NEWMETHODS +for METH in $(find $OLDMETHODS ! -type d); do + ln -s $OLDMETHODS/$(basename $METH) $NEWMETHODS +done +rm $NEWMETHODS/file +cat >$NEWMETHODS/file < file.lst + testequal "$(find $(readlink -f ./rootdir/var/lib/apt/lists) -name '*_dists_*' \( ! -name '*InRelease' \) -type f | sort)" cat file.lst + testsuccess aptcache policy + testequal "foo: + Installed: (none) + Candidate: 1.0 + Version table: + 1.0 0 + 500 $1:$2 jessie/main amd64 Packages + 500 $1:$2 stable/main amd64 Packages" aptcache policy foo + testfailure aptcache show foo/unstable + testsuccess aptcache show foo/stable + testsuccess aptcache show foo/jessie +} + +tworepos 'file' "$APTARCHIVE" 'no partial' +testequal '12' grep -c '200%20URI%20Start' ./download.log +testequal '12' grep -c '201%20URI%20Done' ./download.log +testequal '6' grep -c '^ @ Queue: Action combined' ./download.log +tworepos 'file' "$APTARCHIVE" 'hit' +testequal '6' grep -c '200%20URI%20Start' ./download.log +testequal '6' grep -c '201%20URI%20Done' ./download.log +testequal '0' grep -c '^ @ Queue: Action combined' ./download.log +rm -rf rootdir/var/lib/apt/lists + +changetowebserver + +tworepos 'http' '//localhost:8080' 'no partial' +testequal '10' grep -c '200%20URI%20Start' ./download.log +testequal '10' grep -c '201%20URI%20Done' ./download.log +testequal '6' grep -c '^ @ Queue: Action combined' ./download.log +tworepos 'http' '//localhost:8080' 'hit' +testequal '2' grep -c '200%20URI%20Start' ./download.log +testequal '4' grep -c '201%20URI%20Done' ./download.log +testequal '0' grep -c '^ @ Queue: Action combined' ./download.log +rm -rf rootdir/var/lib/apt/lists -- cgit v1.2.3 From 533fe3d13927798c17bdef84eba60ed9441d9608 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 15 Jun 2015 23:59:14 +0200 Subject: allow ratelimiting progress reporting for testcases Progress reports once in a while which is a bit to unpredictable for testcases, so we enforce a steady progress for them in the hope that this makes the tests (mostly test-apt-progress-fd) a bit more stable. Git-Dch: Ignore --- test/integration/test-acquire-same-repository-multiple-times | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration/test-acquire-same-repository-multiple-times') diff --git a/test/integration/test-acquire-same-repository-multiple-times b/test/integration/test-acquire-same-repository-multiple-times index bfeaf88db..a46e0d73c 100755 --- a/test/integration/test-acquire-same-repository-multiple-times +++ b/test/integration/test-acquire-same-repository-multiple-times @@ -32,7 +32,7 @@ cat >$NEWMETHODS/file < Date: Mon, 10 Aug 2015 15:36:51 +0200 Subject: Fix test case breakage from the new policy implementation Everything's working now. --- test/integration/test-acquire-same-repository-multiple-times | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration/test-acquire-same-repository-multiple-times') diff --git a/test/integration/test-acquire-same-repository-multiple-times b/test/integration/test-acquire-same-repository-multiple-times index a46e0d73c..ad9cd6d7e 100755 --- a/test/integration/test-acquire-same-repository-multiple-times +++ b/test/integration/test-acquire-same-repository-multiple-times @@ -50,7 +50,7 @@ tworepos() { Installed: (none) Candidate: 1.0 Version table: - 1.0 0 + 1.0 500 500 $1:$2 jessie/main amd64 Packages 500 $1:$2 stable/main amd64 Packages" aptcache policy foo testfailure aptcache show foo/unstable -- cgit v1.2.3 From c2a4a8dded2dfb56dbcab9689b6cb4b96c9999b6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 10 Jul 2015 00:07:37 +0200 Subject: rename 'apt-get files' to 'apt-get indextargets' 'files' is a bit too generic as a name for a command usually only used programmatically (if at all) by developers, so instead of "wasting" this generic name for this we use "indextargets" which is actually the name of the datastructure the displayed data is stored in. Along with this rename the config options are renamed accordingly. --- test/integration/test-acquire-same-repository-multiple-times | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration/test-acquire-same-repository-multiple-times') diff --git a/test/integration/test-acquire-same-repository-multiple-times b/test/integration/test-acquire-same-repository-multiple-times index ad9cd6d7e..d3cb46c14 100755 --- a/test/integration/test-acquire-same-repository-multiple-times +++ b/test/integration/test-acquire-same-repository-multiple-times @@ -43,7 +43,7 @@ tworepos() { testsuccess --nomsg aptget update -o Debug::pkgAcquire::Worker=1 cp rootdir/tmp/testsuccess.output download.log #cat download.log - aptget files --format '$(FILENAME)' --no-release-info | sort > file.lst + aptget indextargets --format '$(FILENAME)' --no-release-info | sort > file.lst testequal "$(find $(readlink -f ./rootdir/var/lib/apt/lists) -name '*_dists_*' \( ! -name '*InRelease' \) -type f | sort)" cat file.lst testsuccess aptcache policy testequal "foo: -- cgit v1.2.3