summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-update-not-modified
blob: 2dc56e76cc6f4d788de46d0115bc498840ca5900 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
set -e

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework

setupenvironment
configarchitecture 'amd64' 'i386'

insertpackage 'unstable' 'apt' 'all' '1.0'

setupaptarchive --no-update

methodtest() {
	msgmsg 'Test with' "$1"
	rm -rf rootdir/var/lib/apt/lists
	# get our cache populated
	testsuccess aptget update
	listcurrentlistsdirectory > listsdir.lst

	# hit again with a good cache
	testsuccessequal "Hit $1 unstable InRelease
Reading package lists..." aptget update
	testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"

	# drop an architecture, which means the file should be gone now
	configarchitecture 'i386'
	sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
	testsuccessequal "Hit $1 unstable InRelease
Reading package lists..." aptget update
	testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"

	# readd arch so its downloaded again
	configarchitecture 'amd64' 'i386'
	testsuccessequal "Hit $1 unstable InRelease
Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
Reading package lists..." aptget update
	testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
}

changetowebserver
methodtest 'http://localhost:8080'

changetohttpswebserver
methodtest 'https://localhost:4433'