]>
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' |
47aca3cf MV |
11 | |
12 | insertpackage 'unstable' 'foo' 'all' '1.0' | |
de81b2e2 | 13 | insertsource 'unstable' 'foo' 'all' '1.0' |
47aca3cf MV |
14 | |
15 | setupaptarchive --no-update | |
47aca3cf | 16 | |
de81b2e2 DK |
17 | breakfile() { |
18 | mv "$1" "${1}.bak" | |
19 | cat > "$1" <<EOF | |
47aca3cf MV |
20 | Package: bar |
21 | EOF | |
de81b2e2 DK |
22 | compressfile "$1" |
23 | } | |
24 | restorefile() { | |
25 | mv "${1}.bak" "$1" | |
26 | } | |
27 | ||
de81b2e2 DK |
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 | |
846bc058 | 32 | testfileequal "$1" "$(listcurrentlistsdirectory)" |
de81b2e2 DK |
33 | |
34 | # signed but broken | |
35 | signreleasefiles | |
47aca3cf | 36 | |
de81b2e2 DK |
37 | breakfile aptarchive/dists/unstable/main/binary-i386/Packages |
38 | testfailure aptget update | |
846bc058 | 39 | testfileequal "$1" "$(listcurrentlistsdirectory)" |
de81b2e2 DK |
40 | restorefile aptarchive/dists/unstable/main/binary-i386/Packages |
41 | ||
42 | breakfile aptarchive/dists/unstable/main/source/Sources | |
43 | testfailure aptget update | |
846bc058 | 44 | testfileequal "$1" "$(listcurrentlistsdirectory)" |
de81b2e2 DK |
45 | restorefile aptarchive/dists/unstable/main/source/Sources |
46 | } | |
47 | ||
48 | testsetup() { | |
49 | msgmsg 'Test with no initial data over' "$1" | |
50 | rm -rf rootdir/var/lib/apt/lists | |
8fe964f1 | 51 | mkdir -p rootdir/var/lib/apt/lists/partial |
846bc058 | 52 | listcurrentlistsdirectory > listsdir.lst |
de81b2e2 DK |
53 | testrun 'listsdir.lst' |
54 | ||
55 | msgmsg 'Test with initial data over' "$1" | |
56 | testsuccess aptget update | |
846bc058 | 57 | listcurrentlistsdirectory > listsdir.lst |
de81b2e2 DK |
58 | testrun 'listsdir.lst' |
59 | } | |
60 | ||
61 | testsetup 'file' | |
ba6b79bd | 62 | |
de81b2e2 | 63 | changetowebserver |
ba6b79bd DK |
64 | webserverconfig 'aptwebserver::support::modified-since' 'false' "$1" |
65 | webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also | |
66 | ||
de81b2e2 | 67 | testsetup 'http' |
2737f28a | 68 | |
ba6b79bd DK |
69 | changetohttpswebserver |
70 | ||
71 | testsetup 'https' |