summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-update-transactions
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-10-18 17:48:55 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-10-20 10:37:46 +0200
commitde81b2e20f80bb5f42034863a9a974c815a45da5 (patch)
tree4c601ca61dcdd8090adf198fba2191c18d9c87d4 /test/integration/test-apt-update-transactions
parent12796fa241ad6b0e8ccd1025a3723e18324e17b0 (diff)
aborted reverify restores file owner and permission
If we get an IMS hit for an InRelease file we use the file we already have and pass it into reverification, but this changes the permissions and on abort of the transaction they weren't switched back. This is now done, additionally, every file in partial which hasn't failed gets permission and owner changed for root access as well, as it is very well possible that the next invocation will (re)use these files.
Diffstat (limited to 'test/integration/test-apt-update-transactions')
-rwxr-xr-xtest/integration/test-apt-update-transactions65
1 files changed, 57 insertions, 8 deletions
diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions
index 247334991..2d5d9e721 100755
--- a/test/integration/test-apt-update-transactions
+++ b/test/integration/test-apt-update-transactions
@@ -1,24 +1,73 @@
#!/bin/sh
set -e
+# ensure that an update will only succeed entirely or not at all
+
TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
-configarchitecture "i386"
+configarchitecture 'i386'
insertpackage 'unstable' 'foo' 'all' '1.0'
+insertsource 'unstable' 'foo' 'all' '1.0'
setupaptarchive --no-update
-changetowebserver
-# break package file
-cat > aptarchive/dists/unstable/main/binary-i386/Packages <<EOF
+breakfile() {
+ mv "$1" "${1}.bak"
+ cat > "$1" <<EOF
Package: bar
EOF
-compressfile aptarchive/dists/unstable/main/binary-i386/Packages '+1hour'
+ compressfile "$1"
+}
+restorefile() {
+ mv "${1}.bak" "$1"
+}
+
+listscheck() {
+ testequal "$(cat $1)" ls rootdir/var/lib/apt/lists
+ # all copied files are properly chmodded
+ find rootdir/var/lib/apt/lists -maxdepth 1 -type f | while read file; do
+ testaccessrights "$file" '644'
+ testfilestats "$file" '%U' '!=' '_apt'
+ done
+}
+
+testrun() {
+ # produce an unsigned repository
+ find aptarchive \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
+ testfailure aptget update --no-allow-insecure-repositories
+ listscheck "$1"
+
+ # signed but broken
+ signreleasefiles
-# ensure that a update will only succeed entirely or not at all
-testfailure aptget update
-testequal "partial" ls rootdir/var/lib/apt/lists
+ breakfile aptarchive/dists/unstable/main/binary-i386/Packages
+ testfailure aptget update
+ listscheck "$1"
+ restorefile aptarchive/dists/unstable/main/binary-i386/Packages
+
+ breakfile aptarchive/dists/unstable/main/source/Sources
+ testfailure aptget update
+ listscheck "$1"
+ restorefile aptarchive/dists/unstable/main/source/Sources
+}
+
+testsetup() {
+ msgmsg 'Test with no initial data over' "$1"
+ rm -rf rootdir/var/lib/apt/lists
+ mkdir -p rootdir/var/lib/apt/lists/partial
+ ls rootdir/var/lib/apt/lists > listsdir.lst
+ testrun 'listsdir.lst'
+
+ msgmsg 'Test with initial data over' "$1"
+ testsuccess aptget update
+ ls rootdir/var/lib/apt/lists > listsdir.lst
+ testrun 'listsdir.lst'
+}
+
+testsetup 'file'
+changetowebserver
+testsetup 'http'