summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-update-hashsum-mismatch
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-11-06 08:55:06 +0100
committerMichael Vogt <mvo@ubuntu.com>2014-11-06 08:55:06 +0100
commit9397ea947c23c0957a683152360909810340abce (patch)
tree6b29e35b9ef602c15d0aab20eefdec3138eb4692 /test/integration/test-apt-update-hashsum-mismatch
parent87ecd6a2d719aeaeedd99dd500b467e966376f1c (diff)
parent6e2261d0f250406058d66b360080aa986953ae19 (diff)
Merge remote-tracking branch 'upstream/debian/experimental' into feature/no-more-acquire-guessing
Conflicts: apt-pkg/acquire-item.cc
Diffstat (limited to 'test/integration/test-apt-update-hashsum-mismatch')
-rwxr-xr-xtest/integration/test-apt-update-hashsum-mismatch44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/integration/test-apt-update-hashsum-mismatch b/test/integration/test-apt-update-hashsum-mismatch
new file mode 100755
index 000000000..c2c5b3887
--- /dev/null
+++ b/test/integration/test-apt-update-hashsum-mismatch
@@ -0,0 +1,44 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+configcompression 'gz'
+
+insertpackage 'testing' 'foo' 'all' '1'
+insertpackage 'testing' 'foo2' 'all' '1'
+insertsource 'testing' 'foo' 'all' '1'
+insertsource 'testing' 'foo2' 'all' '1'
+
+setupaptarchive --no-update
+changetowebserver
+
+echo 'Package: bar
+Maintainer: Doctor Evil <evil@example.com>
+Description: come to the dark side
+' > aptarchive/DoctorEvil
+compressfile aptarchive/DoctorEvil
+
+find aptarchive \( -name 'Packages' -o -name 'Sources' -o -name 'Translation-en' \) -delete
+
+testsuccess aptget update
+testsuccess aptcache show foo
+testsuccess aptget install foo -s
+
+for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver.log); do
+ msgmsg 'Test hashsum mismatch with file' "$get"
+ rm -rf rootdir/var/lib/apt/lists
+ webserverconfig 'aptwebserver::overwrite' ''
+ webserverconfig "aptwebserver::overwrite::$(printf '%s' "${get}" | sed 's#/#%2F#g' )::filename" '%2FDoctorEvil.gz'
+
+ testfailure aptget update
+ cp rootdir/tmp/testfailure.output rootdir/tmp/update.output
+ testsuccess grep -E "$(basename -s '.gz' "$get").*Hash Sum mismatch" rootdir/tmp/update.output
+ testfailure aptcache show foo
+ testfailure aptget install foo -s
+
+ testfailure aptcache show bar
+ testfailure aptget install bar -s
+done