]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-transactions
tests: check apt-get source release name switching with -t
[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'
58702f85 11configcompression '.' 'gz'
47aca3cf
MV
12
13insertpackage 'unstable' 'foo' 'all' '1.0'
de81b2e2 14insertsource 'unstable' 'foo' 'all' '1.0'
47aca3cf
MV
15
16setupaptarchive --no-update
47aca3cf 17
de81b2e2 18breakfile() {
58702f85
DK
19 mv "${1}" "${1}.bak"
20 mv "${1}.gz" "${1}.gz.bak"
de81b2e2 21 cat > "$1" <<EOF
47aca3cf
MV
22Package: bar
23EOF
de81b2e2
DK
24 compressfile "$1"
25}
26restorefile() {
27 mv "${1}.bak" "$1"
58702f85 28 mv "${1}.gz.bak" "${1}.gz"
de81b2e2
DK
29}
30
de81b2e2 31testrun() {
8d041b4f
DK
32 rm -rf aptarchive/dists.good
33 cp -a aptarchive/dists aptarchive/dists.good
34 insertpackage 'unstable' 'bar' 'all' '1.0'
35 insertsource 'unstable' 'bar' 'all' '1.0'
36 buildaptarchivefromfiles '+1 hour'
37
de81b2e2
DK
38 # produce an unsigned repository
39 find aptarchive \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
40 testfailure aptget update --no-allow-insecure-repositories
846bc058 41 testfileequal "$1" "$(listcurrentlistsdirectory)"
de81b2e2
DK
42
43 # signed but broken
44 signreleasefiles
47aca3cf 45
8d041b4f
DK
46 onehashbroken() {
47 testfailure aptget update
48 # each file generates two messages with this string
49 testequal '2' grep --count 'Hash Sum mismatch' rootdir/tmp/testfailure.output
50 testfileequal "$1" "$(listcurrentlistsdirectory)"
51 }
52
de81b2e2 53 breakfile aptarchive/dists/unstable/main/binary-i386/Packages
8d041b4f 54 onehashbroken "$1"
de81b2e2
DK
55 restorefile aptarchive/dists/unstable/main/binary-i386/Packages
56
57 breakfile aptarchive/dists/unstable/main/source/Sources
8d041b4f 58 onehashbroken "$1"
de81b2e2 59 restorefile aptarchive/dists/unstable/main/source/Sources
8d041b4f
DK
60
61 rm -rf aptarchive/dists
62 cp -a aptarchive/dists.good aptarchive/dists
de81b2e2
DK
63}
64
65testsetup() {
66 msgmsg 'Test with no initial data over' "$1"
67 rm -rf rootdir/var/lib/apt/lists
8fe964f1 68 mkdir -p rootdir/var/lib/apt/lists/partial
846bc058 69 listcurrentlistsdirectory > listsdir.lst
de81b2e2
DK
70 testrun 'listsdir.lst'
71
72 msgmsg 'Test with initial data over' "$1"
58702f85
DK
73 rm -rf rootdir/var/lib/apt/lists
74 testsuccess aptget update -o Debug::pkgAcquire::Worker=1
846bc058 75 listcurrentlistsdirectory > listsdir.lst
de81b2e2
DK
76 testrun 'listsdir.lst'
77}
78
79testsetup 'file'
ba6b79bd 80
de81b2e2 81changetowebserver
ba6b79bd
DK
82webserverconfig 'aptwebserver::support::modified-since' 'false' "$1"
83webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also
dcbb364f 84webserverconfig 'aptwebserver::support::range' 'false' "$1"
ba6b79bd 85
de81b2e2 86testsetup 'http'
2737f28a 87
ba6b79bd
DK
88changetohttpswebserver
89
90testsetup 'https'