From 12841e8320aa499554ac50b102b222900bb1b879 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 24 Jan 2014 23:48:11 +0100 Subject: use apt-key adv (+ gnupg) instead of gpgv for verify apt-key does the keyring merge as we need it, so we just call it instead of reimplementing it to do the merging before gpgv. This means we don't use gpgv anymore (we never depended on it explicitly - bad style), but it also means that the message in apt-cdrom add is a bit less friendly as it says loudly "untrusted key", but for a one-time command its okay. --- test/integration/test-apt-cdrom | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration/test-apt-cdrom') diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 8d8fdf167..9fbc4288d 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -29,7 +29,7 @@ aptcdromlog() { test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!" test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!" aptcdrom "$@" -o quiet=1 >rootdir/tmp/apt-cdrom.log 2>&1 Date: Wed, 15 Oct 2014 15:56:53 +0200 Subject: don't cleanup cdrom files in apt-get update Regression from merging 801745284905e7962aa77a9f37a6b4e7fcdc19d0 and b0f4b486e6850c5f98520ccf19da71d0ed748ae4. While fine by itself, merged the part fixing the filename is skipped if a cdrom source is encountered, so that our list-cleanup removes what seems to be orphaned files. Closes: 765458 --- test/integration/test-apt-cdrom | 49 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'test/integration/test-apt-cdrom') diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 8d8fdf167..44eccb7bf 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -66,22 +66,51 @@ CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: // testequal "CD::${CD_ID} \"${CD_LABEL}\"; CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list -testequal 'Reading package lists... +testcdromusage() { + touch rootdir/var/lib/apt/extended_states + + testequal 'Reading package lists... Building dependency tree... +Reading state information... The following NEW packages will be installed: testing 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst testing (0.8.15 stable [amd64]) Conf testing (0.8.15 stable [amd64])' aptget install testing -s -testequal 'Reading package lists... + testdpkgnotinstalled testing + testsuccess aptget install testing -y + testdpkginstalled testing + testsuccess aptget purge testing -y + testdpkgnotinstalled testing + + testequal 'Reading package lists... Building dependency tree... +Reading state information... The following NEW packages will be installed: testing:i386 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst testing:i386 (0.8.15 stable [i386]) Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s + testdpkgnotinstalled testing:i386 + testsuccess aptget install testing:i386 -y + testdpkginstalled testing:i386 + testsuccess aptget purge testing:i386 -y + testdpkgnotinstalled testing:i386 + + rm -f testing_0.8.15_amd64.deb + testsuccess aptget download testing + testsuccess test -s testing_0.8.15_amd64.deb + rm -f testing_0.8.15_amd64.deb + + rm -f testing_0.8.15.dsc + testsuccess aptget source testing --dsc-only -d + testsuccess test -s testing_0.8.15.dsc + rm -f testing_0.8.15.dsc +} +testcdromusage + # check Idempotence of apt-cdrom (and disabling of Translation dropping) testequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures @@ -101,7 +130,15 @@ $CDROM_POST" aptcdromlog add msgtest 'Test for the english description translation of' 'testing' aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail -# check that we really can install from a 'cdrom' -testdpkgnotinstalled testing -testsuccess aptget install testing -y -testdpkginstalled testing +# ensure cdrom method isn't trying to mount the cdrom +mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected +# ensure an update doesn't mess with cdrom sources +testsuccess aptget update +testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' +mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted +testcdromusage + +# and again to check that it withstands the temptation even if it could mount +testsuccess aptget update +testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' +testcdromusage -- cgit v1.2.3 From 03aa08472dcd689572a46ce6efdb1dccf6136334 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 23 Oct 2014 01:28:05 +0200 Subject: chown finished partial files earlier partial files are chowned by the Item baseclass to let the methods work with them. Now, this baseclass is also responsible for chowning the files back to root instead of having various deeper levels do this. The consequence is that all overloaded Failed() methods now call the Item::Failed base as their first step. The same is done for Done(). The effect is that even in partial files usually don't belong to _apt anymore, helping sneakernets and reducing possibilities of a bad method modifying files not belonging to them. The change is supported by the framework not only supporting being run as root, but with proper permission management, too, so that privilege dropping can be tested with them. --- test/integration/test-apt-cdrom | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/integration/test-apt-cdrom') diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 2220a290c..4489143e4 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -99,6 +99,7 @@ Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s testsuccess aptget purge testing:i386 -y testdpkgnotinstalled testing:i386 + cd downloaded rm -f testing_0.8.15_amd64.deb testsuccess aptget download testing testsuccess test -s testing_0.8.15_amd64.deb @@ -108,6 +109,7 @@ Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s testsuccess aptget source testing --dsc-only -d testsuccess test -s testing_0.8.15.dsc rm -f testing_0.8.15.dsc + cd - >/dev/null } testcdromusage -- cgit v1.2.3 From b0314abb0cbe5937d2d3cdcd6df9d322b69d03a0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 23 Oct 2014 10:42:18 +0200 Subject: add test for Basic Authentication scheme Git-Dch: Ignore --- test/integration/test-apt-cdrom | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test/integration/test-apt-cdrom') diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 4489143e4..3a33219fe 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -21,7 +21,7 @@ echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable ' >> Translation-de compressfile Translation-de rm -f Translation-en Translation-de -chmod -R -w . +chmod -R 555 . cd - > /dev/null aptcdromlog() { @@ -144,3 +144,8 @@ testcdromusage testsuccess aptget update testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' testcdromusage + +msgmsg 'Check that nothing touched our' 'CD-ROM' +for file in $(find rootdir/media/cdrom-unmounted/dists); do + testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:555" +done -- cgit v1.2.3 From 8fe964f148344b8a55252fe52b6292a4ab86ea98 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 14 Nov 2014 18:01:09 +0100 Subject: create our cache and lib directory always with mode 755 We autocreate for a while now the last two directories in /var/lib/apt/lists (similar for /var/cache/apt/archives) which is very nice for systems having any of those on tmpfs or other non-persistent storage. This also means though that this creation is effected by the default umask, so for people with aggressive umasks like 027 the directories will be created with 750, which means all non-root users are left out, which is usually exactly what we want then this umask is set, but the cache and lib directories contain public knowledge. There isn't any need to protect them from viewers and they render apt completely useless if not readable. --- test/integration/test-apt-cdrom | 1 - 1 file changed, 1 deletion(-) (limited to 'test/integration/test-apt-cdrom') diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 3a33219fe..7da645e83 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -125,7 +125,6 @@ $CDROM_POST" aptcdromlog add msgtest 'Test for the german description translation of' 'testing' aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail rm -rf rootdir/var/lib/apt/lists -mkdir -p rootdir/var/lib/apt/lists/partial testequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures $CDROM_POST" aptcdromlog add -- cgit v1.2.3 From 4bb006d1ddcf1807474067dcbef9fb0bb5def0ac Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 17 Nov 2014 22:54:29 +0100 Subject: fix file ownership tests to work on kfreebsd While on linux files are created in /tmp with $USER:$USER, on my kfreebsd testmachine they are created with $USER:root, so we pull some strings here to make it work on both. --- test/integration/test-apt-cdrom | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration/test-apt-cdrom') diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 7da645e83..7f4b3c257 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -146,5 +146,5 @@ testcdromusage msgmsg 'Check that nothing touched our' 'CD-ROM' for file in $(find rootdir/media/cdrom-unmounted/dists); do - testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:555" + testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:555" done -- cgit v1.2.3 From 25b86db159fbc3c043628e285c0c1ef24dec2c6e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Mar 2015 00:59:44 +0100 Subject: test exitcode as well as string equality We use test{success,failure} now all over the place in the framework, so its only consequencial to do this in the situations in which we test for a specific output as well. Git-Dch: Ignore --- test/integration/test-apt-cdrom | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'test/integration/test-apt-cdrom') diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 7f4b3c257..9906795ca 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -49,12 +49,12 @@ deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main Unmounting CD-ROM... Repeat this process for the rest of the CDs in your set." -testequal "$CDROM_PRE +testsuccessequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures Found label 'Debian APT Testdisk 0.8.15' $CDROM_POST" aptcdromlog add -testequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ +testsuccessequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ Mounting CD-ROM... Stored label: Debian APT Testdisk 0.8.15 Unmounting CD-ROM..." aptcdromlog ident @@ -63,13 +63,13 @@ Unmounting CD-ROM..." aptcdromlog ident ident="$(LC_ALL=C aptcdrom ident 2>&1 )" CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')" CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")" -testequal "CD::${CD_ID} \"${CD_LABEL}\"; -CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list +testfileequal rootdir/var/lib/apt/cdroms.list "CD::${CD_ID} \"${CD_LABEL}\"; +CD::${CD_ID}::Label \"${CD_LABEL}\";" testcdromusage() { touch rootdir/var/lib/apt/extended_states - testequal 'Reading package lists... + testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: @@ -84,7 +84,7 @@ Conf testing (0.8.15 stable [amd64])' aptget install testing -s testsuccess aptget purge testing -y testdpkgnotinstalled testing - testequal 'Reading package lists... + testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: @@ -114,18 +114,18 @@ Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s testcdromusage # check Idempotence of apt-cdrom (and disabling of Translation dropping) -testequal "$CDROM_PRE +testsuccessequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures $CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0 # take Translations from previous runs as needed -testequal "$CDROM_PRE +testsuccessequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures $CDROM_POST" aptcdromlog add msgtest 'Test for the german description translation of' 'testing' aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail rm -rf rootdir/var/lib/apt/lists -testequal "$CDROM_PRE +testsuccessequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures $CDROM_POST" aptcdromlog add msgtest 'Test for the english description translation of' 'testing' -- cgit v1.2.3 From d84da4995df24329e96d57a22136683a9e370f4e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 11 Apr 2015 20:13:19 +0200 Subject: ensure lists/ files have correct permissions after apt-cdrom add Its a bit unpredictable which permissons and owners we will encounter on a CD-ROM (or a USB stick, as apt-cdrom is responsible for those too), so we have to ensure in this codepath as well that everything is nicely setup without waiting for a 'apt-get update' to fix up the (potential) mess. --- test/integration/test-apt-cdrom | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test/integration/test-apt-cdrom') diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 9906795ca..34b35f745 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -33,6 +33,7 @@ aptcdromlog() { test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!" test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!" } +aptautotest_aptcdromlog_add() { aptautotest_aptget_update "$@"; } CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ Unmounting CD-ROM... @@ -133,13 +134,13 @@ aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && # ensure cdrom method isn't trying to mount the cdrom mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected -# ensure an update doesn't mess with cdrom sources +msgmsg "ensure an update doesn't mess with cdrom sources" testsuccess aptget update testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted testcdromusage -# and again to check that it withstands the temptation even if it could mount +msgmsg 'and again to check that it withstands the temptation even if it could mount' testsuccess aptget update testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' testcdromusage -- cgit v1.2.3