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