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