]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-update-transactions
Merge branch 'debian/sid' into debian/experimental
[apt.git] / test / integration / test-apt-update-transactions
1 #!/bin/sh
2 set -e
3
4 # ensure that an update will only succeed entirely or not at all
5
6 TESTDIR=$(readlink -f $(dirname $0))
7 . $TESTDIR/framework
8
9 setupenvironment
10 configarchitecture 'i386'
11
12 insertpackage 'unstable' 'foo' 'all' '1.0'
13 insertsource 'unstable' 'foo' 'all' '1.0'
14
15 setupaptarchive --no-update
16
17 breakfile() {
18 mv "$1" "${1}.bak"
19 cat > "$1" <<EOF
20 Package: bar
21 EOF
22 compressfile "$1"
23 }
24 restorefile() {
25 mv "${1}.bak" "$1"
26 }
27
28 testrun() {
29 # produce an unsigned repository
30 find aptarchive \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
31 testfailure aptget update --no-allow-insecure-repositories
32 testfileequal "$1" "$(listcurrentlistsdirectory)"
33
34 # signed but broken
35 signreleasefiles
36
37 breakfile aptarchive/dists/unstable/main/binary-i386/Packages
38 testfailure aptget update
39 testfileequal "$1" "$(listcurrentlistsdirectory)"
40 restorefile aptarchive/dists/unstable/main/binary-i386/Packages
41
42 breakfile aptarchive/dists/unstable/main/source/Sources
43 testfailure aptget update
44 testfileequal "$1" "$(listcurrentlistsdirectory)"
45 restorefile aptarchive/dists/unstable/main/source/Sources
46 }
47
48 testsetup() {
49 msgmsg 'Test with no initial data over' "$1"
50 redatereleasefiles 'now'
51 rm -rf rootdir/var/lib/apt/lists
52 mkdir -p rootdir/var/lib/apt/lists/partial
53 listcurrentlistsdirectory > listsdir.lst
54 testrun 'listsdir.lst'
55
56 msgmsg 'Test with initial data over' "$1"
57 testsuccess aptget update
58 listcurrentlistsdirectory > listsdir.lst
59 redatereleasefiles '+1hour'
60 testrun 'listsdir.lst'
61 }
62
63 testsetup 'file'
64
65 changetowebserver
66 webserverconfig 'aptwebserver::support::modified-since' 'false' "$1"
67 webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also
68 webserverconfig 'aptwebserver::support::range' 'false' "$1"
69
70 testsetup 'http'
71
72 changetohttpswebserver
73
74 testsetup 'https'