]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-update-not-modified
treat older Release files than we already have as an IMSHit
[apt.git] / test / integration / test-apt-update-not-modified
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6
7 setupenvironment
8 configarchitecture 'amd64' 'i386'
9
10 insertpackage 'unstable' 'apt' 'all' '1.0'
11
12 setupaptarchive --no-update
13
14 methodtest() {
15 msgmsg 'Test InRelease with' "$1"
16 rm -rf rootdir/var/lib/apt/lists
17 # get our cache populated
18 testsuccess aptget update
19 listcurrentlistsdirectory > listsdir.lst
20
21 # hit again with a good cache
22 testsuccessequal "Hit $1 unstable InRelease
23 Reading package lists..." aptget update
24 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
25
26 # drop an architecture, which means the file should be gone now
27 configarchitecture 'i386'
28 sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
29 testsuccessequal "Hit $1 unstable InRelease
30 Reading package lists..." aptget update
31 testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
32
33 # readd arch so its downloaded again
34 configarchitecture 'amd64' 'i386'
35 testsuccessequal "Hit $1 unstable InRelease
36 Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
37 Reading package lists..." aptget update
38 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
39
40 webserverconfig 'aptwebserver::support::modified-since' 'false'
41 webserverconfig 'aptwebserver::support::last-modified' 'false'
42 testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
43 Reading package lists..." aptget update
44 webserverconfig 'aptwebserver::support::modified-since' 'true'
45 webserverconfig 'aptwebserver::support::last-modified' 'true'
46
47 msgmsg 'Test Release.gpg with' "$1"
48 rm -rf rootdir/var/lib/apt/lists
49 cp -a aptarchive/dists aptarchive/dists.good
50 find aptarchive/dists -name 'InRelease' -delete
51 # get our cache populated
52 testsuccess aptget update
53 listcurrentlistsdirectory > listsdir.lst
54
55 # hit again with a good cache
56 testsuccessequal "Ign $1 unstable InRelease
57 404 Not Found
58 Hit $1 unstable Release
59 Reading package lists..." aptget update
60 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
61
62 # drop an architecture, which means the file should be gone now
63 configarchitecture 'i386'
64 sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
65 testsuccessequal "Ign $1 unstable InRelease
66 404 Not Found
67 Hit $1 unstable Release
68 Reading package lists..." aptget update
69 testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
70
71 # readd arch so its downloaded again
72 configarchitecture 'amd64' 'i386'
73 testsuccessequal "Ign $1 unstable InRelease
74 404 Not Found
75 Hit $1 unstable Release
76 Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
77 Reading package lists..." aptget update
78 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
79
80 webserverconfig 'aptwebserver::support::modified-since' 'false'
81 webserverconfig 'aptwebserver::support::last-modified' 'false'
82 testsuccessequal "Ign $1 unstable InRelease
83 404 Not Found
84 Get:1 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B]
85 Reading package lists..." aptget update
86 webserverconfig 'aptwebserver::support::modified-since' 'true'
87 webserverconfig 'aptwebserver::support::last-modified' 'true'
88
89 rm -rf aptarchive/dists
90 cp -a aptarchive/dists.good aptarchive/dists
91 }
92
93 changetowebserver
94 methodtest 'http://localhost:8080'
95
96 changetohttpswebserver
97 methodtest 'https://localhost:4433'