]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-update-transactions
testcases: do not allow warnings in testsuccess
[apt.git] / test / integration / test-apt-update-transactions
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4# ensure that an update will only succeed entirely or not at all
5
6TESTDIR=$(readlink -f $(dirname $0))
7. $TESTDIR/framework
8
9setupenvironment
10configarchitecture 'i386'
11
12insertpackage 'unstable' 'foo' 'all' '1.0'
13insertsource 'unstable' 'foo' 'all' '1.0'
14
15setupaptarchive --no-update
16
17breakfile() {
18 mv "$1" "${1}.bak"
19 cat > "$1" <<EOF
20Package: bar
21EOF
22 compressfile "$1"
23}
24restorefile() {
25 mv "${1}.bak" "$1"
26}
27
28testrun() {
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
48testsetup() {
49 msgmsg 'Test with no initial data over' "$1"
50 rm -rf rootdir/var/lib/apt/lists
51 mkdir -m 700 -p rootdir/var/lib/apt/lists/partial
52 if [ "$(id -u)" = '0' ]; then
53 chown _apt:root rootdir/var/lib/apt/lists/partial
54 fi
55 listcurrentlistsdirectory > listsdir.lst
56 testrun 'listsdir.lst'
57
58 msgmsg 'Test with initial data over' "$1"
59 testsuccess aptget update
60 listcurrentlistsdirectory > listsdir.lst
61 testrun 'listsdir.lst'
62}
63
64testsetup 'file'
65changetowebserver
66testsetup 'http'
67