]> git.saurik.com Git - apt.git/blame - test/integration/test-releasefile-valid-until
test-apt-download-progress: Allow smaller progress change
[apt.git] / test / integration / test-releasefile-valid-until
CommitLineData
884a4c0a
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture 'i386'
8
9insertpackage 'wheezy' 'apt' 'all' '0.8.15'
10
718f797c
DK
11getlabelfromsuite() {
12 echo -n 'Testcases'
13}
14
1df24acf 15setupaptarchive --no-update
718f797c 16
1df24acf
DK
17runtest() {
18 local MSG="$1"
6bf93605 19 msgtest "Release file is $MSG as it has" "$2"
884a4c0a 20 rm -rf rootdir/var/lib/apt/lists
1df24acf 21 generatereleasefiles "$3" "$4"
884a4c0a 22 signreleasefiles
1df24acf 23 shift 4
6bf93605 24 if [ "$MSG" = 'accepted' ]; then
1df24acf
DK
25 testsuccess --nomsg aptget update "$@"
26 testfailure grep -q 'is expired' rootdir/tmp/testsuccess.output
884a4c0a 27 else
1df24acf
DK
28 testfailure --nomsg aptget update "$@"
29 testsuccess grep -q 'is expired' rootdir/tmp/testfailure.output
884a4c0a
DK
30 fi
31}
32
6bf93605
DK
33runtest 'accepted' 'no Until' '' ''
34runtest 'accepted' 'no Until and good Max-Valid' '' '' -o Acquire::Max-ValidTime=3600
35runtest 'rejected' 'no Until, but bad Max-Valid' 'now - 2 days' '' -o Acquire::Max-ValidTime=3600
36runtest 'accepted' 'good Until' 'now - 3 days' 'now + 1 day'
37runtest 'rejected' 'bad Until' 'now - 7 days' 'now - 4 days'
38runtest 'rejected' 'bad Until (ignore good Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=1209600
39runtest 'rejected' 'bad Max-Valid (bad Until)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=86400
40runtest 'rejected' 'bad Max-Valid (good Until)' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400
41runtest 'accepted' 'good labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600
42runtest 'rejected' 'bad labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400
43runtest 'accepted' 'good Until (good Min-Valid, no Max-Valid)' 'now - 7 days' 'now + 1 days' -o Acquire::Min-ValidTime=1209600
44runtest 'accepted' 'good Min-Valid (bad Until, no Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Min-ValidTime=1209600
45runtest 'accepted' 'good Min-Valid (bad Until, good Max-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200
46runtest 'rejected' 'bad Max-Valid (bad Until, good Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200
47runtest 'rejected' 'bad Max-Valid (bad Until, bad Min-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920
48runtest 'rejected' 'bad Max-Valid (bad Until, bad Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920
0741daeb
DK
49
50sed -i -e 's#\(deb\(-src\)\?\) #\1 [check-valid-until=no] #' rootdir/etc/apt/sources.list.d/*
51runtest 'accepted' 'bad Until but overriden by sources option' 'now - 7 days' 'now - 4 days'
52
53sed -i -e 's#\(deb\(-src\)\?\) \[check-valid-until=no\] #\1 [valid-until-max=86400] #' rootdir/etc/apt/sources.list.d/*
54runtest 'rejected' 'bad Max-Valid (good Until) via sources option' 'now - 7 days' 'now + 4 days'
55
56sed -i -e 's#\(deb\(-src\)\?\) \[valid-until-max=86400\] #\1 [valid-until-min=1209600] #' rootdir/etc/apt/sources.list.d/*
57runtest 'accepted' 'good Min-Valid (bad Until) via sources option' 'now - 7 days' 'now - 4 days'