]> git.saurik.com Git - apt.git/blame - test/integration/test-releasefile-valid-until
- add an Acquire::Min-ValidTime option (Closes: #640122)
[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
11setupaptarchive
12
13setupreleasefile() {
14 rm -rf rootdir/var/lib/apt/lists
15 aptget clean
16 generatereleasefiles "$1" "$2"
17 signreleasefiles
18}
19
20aptgetupdate() {
21 if aptget update $* 2>&1 | grep -q 'is expired'; then
22 return 1
23 else
24 return 0
25 fi
26}
27
28setupreleasefile
29msgtest 'Release file is accepted as it has' 'no Until'
30aptgetupdate && msgpass || msgfail
31
32setupreleasefile
33msgtest 'Release file is accepted as it has' 'no Until and good Max-Valid'
34aptgetupdate -o Acquire::Max-ValidTime=3600 && msgpass || msgfail
35
36setupreleasefile 'now - 2 days'
37msgtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid'
38aptgetupdate -o Acquire::Max-ValidTime=3600 && msgfail || msgpass
39
40setupreleasefile 'now - 3 days' 'now + 1 day'
41msgtest 'Release file is accepted as it has' 'good Until'
42aptgetupdate && msgpass || msgfail
43
44setupreleasefile 'now - 7 days' 'now - 4 days'
45msgtest 'Release file is rejected as it has' 'bad Until'
46aptgetupdate && msgfail || msgpass
47
48setupreleasefile 'now - 7 days' 'now - 4 days'
49msgtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)'
50aptgetupdate -o Acquire::Max-ValidTime=1209600 && msgfail || msgpass
51
52setupreleasefile 'now - 7 days' 'now - 4 days'
53msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)'
54aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass
55
56setupreleasefile 'now - 7 days' 'now + 4 days'
57msgtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)'
58aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass
59
60setupreleasefile 'now - 7 days' 'now + 4 days'
61msgtest 'Release file is accepted as it has' 'good labeled Max-Valid'
62aptgetupdate -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 && msgpass || msgfail
63
64setupreleasefile 'now - 7 days' 'now + 4 days'
65msgtest 'Release file is rejected as it has' 'bad labeled Max-Valid'
66aptgetupdate -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 && msgfail || msgpass
89500a25
DK
67
68setupreleasefile 'now - 7 days' 'now + 1 days'
69msgtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)'
70aptgetupdate -o Acquire::Min-ValidTime=1209600 && msgpass || msgfail
71
72setupreleasefile 'now - 7 days' 'now - 4 days'
73msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)'
74aptgetupdate -o Acquire::Min-ValidTime=1209600 && msgpass || msgfail
75
76setupreleasefile 'now - 7 days' 'now - 2 days'
77msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, good Max-Valid) <'
78aptgetupdate -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 && msgpass || msgfail
79
80setupreleasefile 'now - 7 days' 'now - 2 days'
81msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, good Min-Valid) >'
82aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 && msgfail || msgpass
83
84setupreleasefile 'now - 7 days' 'now - 2 days'
85msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) <'
86aptgetupdate -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 && msgfail || msgpass
87
88setupreleasefile 'now - 7 days' 'now - 2 days'
89msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >'
90aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 && msgfail || msgpass