summaryrefslogtreecommitdiff
path: root/test/integration/test-releasefile-valid-until
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-09-05 14:50:30 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-09-05 14:50:30 +0200
commit884a4c0a3a6cba654e77478a086f26539bc5bd32 (patch)
tree97c2aeedf0e53478784e9d797108fe30e0e84669 /test/integration/test-releasefile-valid-until
parent05b64a6f78e3bf39142808a3dae41a2c4618f6b0 (diff)
* apt-pkg/indexrecords.cc:
- fix Acquire::Max-ValidTime option by interpreting it really as seconds as specified in the manpage and not as days
Diffstat (limited to 'test/integration/test-releasefile-valid-until')
-rwxr-xr-xtest/integration/test-releasefile-valid-until66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/integration/test-releasefile-valid-until b/test/integration/test-releasefile-valid-until
new file mode 100755
index 000000000..35498f6d1
--- /dev/null
+++ b/test/integration/test-releasefile-valid-until
@@ -0,0 +1,66 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+insertpackage 'wheezy' 'apt' 'all' '0.8.15'
+
+setupaptarchive
+
+setupreleasefile() {
+ rm -rf rootdir/var/lib/apt/lists
+ aptget clean
+ generatereleasefiles "$1" "$2"
+ signreleasefiles
+}
+
+aptgetupdate() {
+ if aptget update $* 2>&1 | grep -q 'is expired'; then
+ return 1
+ else
+ return 0
+ fi
+}
+
+setupreleasefile
+msgtest 'Release file is accepted as it has' 'no Until'
+aptgetupdate && msgpass || msgfail
+
+setupreleasefile
+msgtest 'Release file is accepted as it has' 'no Until and good Max-Valid'
+aptgetupdate -o Acquire::Max-ValidTime=3600 && msgpass || msgfail
+
+setupreleasefile 'now - 2 days'
+msgtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid'
+aptgetupdate -o Acquire::Max-ValidTime=3600 && msgfail || msgpass
+
+setupreleasefile 'now - 3 days' 'now + 1 day'
+msgtest 'Release file is accepted as it has' 'good Until'
+aptgetupdate && msgpass || msgfail
+
+setupreleasefile 'now - 7 days' 'now - 4 days'
+msgtest 'Release file is rejected as it has' 'bad Until'
+aptgetupdate && msgfail || msgpass
+
+setupreleasefile 'now - 7 days' 'now - 4 days'
+msgtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)'
+aptgetupdate -o Acquire::Max-ValidTime=1209600 && msgfail || msgpass
+
+setupreleasefile 'now - 7 days' 'now - 4 days'
+msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)'
+aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass
+
+setupreleasefile 'now - 7 days' 'now + 4 days'
+msgtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)'
+aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass
+
+setupreleasefile 'now - 7 days' 'now + 4 days'
+msgtest 'Release file is accepted as it has' 'good labeled Max-Valid'
+aptgetupdate -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 && msgpass || msgfail
+
+setupreleasefile 'now - 7 days' 'now + 4 days'
+msgtest 'Release file is rejected as it has' 'bad labeled Max-Valid'
+aptgetupdate -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 && msgfail || msgpass