]>
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 | ||
28 | listscheck() { | |
29 | testequal "$(cat $1)" ls rootdir/var/lib/apt/lists | |
de81b2e2 DK |
30 | } |
31 | ||
32 | testrun() { | |
33 | # produce an unsigned repository | |
34 | find aptarchive \( -name 'Release.gpg' -o -name 'InRelease' \) -delete | |
35 | testfailure aptget update --no-allow-insecure-repositories | |
36 | listscheck "$1" | |
37 | ||
38 | # signed but broken | |
39 | signreleasefiles | |
47aca3cf | 40 | |
de81b2e2 DK |
41 | breakfile aptarchive/dists/unstable/main/binary-i386/Packages |
42 | testfailure aptget update | |
43 | listscheck "$1" | |
44 | restorefile aptarchive/dists/unstable/main/binary-i386/Packages | |
45 | ||
46 | breakfile aptarchive/dists/unstable/main/source/Sources | |
47 | testfailure aptget update | |
48 | listscheck "$1" | |
49 | restorefile aptarchive/dists/unstable/main/source/Sources | |
50 | } | |
51 | ||
52 | testsetup() { | |
53 | msgmsg 'Test with no initial data over' "$1" | |
54 | rm -rf rootdir/var/lib/apt/lists | |
55 | mkdir -p rootdir/var/lib/apt/lists/partial | |
56 | ls rootdir/var/lib/apt/lists > listsdir.lst | |
57 | testrun 'listsdir.lst' | |
58 | ||
59 | msgmsg 'Test with initial data over' "$1" | |
60 | testsuccess aptget update | |
61 | ls rootdir/var/lib/apt/lists > listsdir.lst | |
62 | testrun 'listsdir.lst' | |
63 | } | |
64 | ||
65 | testsetup 'file' | |
66 | changetowebserver | |
67 | testsetup 'http' | |
2737f28a | 68 |