]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-transactions
eipp: add Allow-Temporary-Remove-of-Essentials
[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
3abb6a6a
DK
6TESTDIR="$(readlink -f "$(dirname "$0")")"
7. "$TESTDIR/framework"
47aca3cf
MV
8
9setupenvironment
de81b2e2 10configarchitecture 'i386'
58702f85 11configcompression '.' 'gz'
47aca3cf 12
1dd20368
DK
13insertpackage 'unstable' 'foo' 'i386' '1.0'
14insertsource 'unstable' 'foo' 'i386' '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
1dd20368
DK
34 insertpackage 'unstable' 'bar' 'i386' '1.0'
35 insertsource 'unstable' 'bar' 'i386' '1.0'
8d041b4f
DK
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 46 onehashbroken() {
742f67ea
DK
47 rm -rf rootdir/var/lib/apt/lists/partial
48 testfailure aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1
8d041b4f
DK
49 # each file generates two messages with this string
50 testequal '2' grep --count 'Hash Sum mismatch' rootdir/tmp/testfailure.output
51 testfileequal "$1" "$(listcurrentlistsdirectory)"
52 }
53
de81b2e2 54 breakfile aptarchive/dists/unstable/main/binary-i386/Packages
8d041b4f 55 onehashbroken "$1"
de81b2e2
DK
56 restorefile aptarchive/dists/unstable/main/binary-i386/Packages
57
58 breakfile aptarchive/dists/unstable/main/source/Sources
8d041b4f 59 onehashbroken "$1"
de81b2e2 60 restorefile aptarchive/dists/unstable/main/source/Sources
8d041b4f
DK
61
62 rm -rf aptarchive/dists
63 cp -a aptarchive/dists.good aptarchive/dists
de81b2e2
DK
64}
65
66testsetup() {
67 msgmsg 'Test with no initial data over' "$1"
68 rm -rf rootdir/var/lib/apt/lists
8fe964f1 69 mkdir -p rootdir/var/lib/apt/lists/partial
846bc058 70 listcurrentlistsdirectory > listsdir.lst
de81b2e2
DK
71 testrun 'listsdir.lst'
72
73 msgmsg 'Test with initial data over' "$1"
58702f85
DK
74 rm -rf rootdir/var/lib/apt/lists
75 testsuccess aptget update -o Debug::pkgAcquire::Worker=1
846bc058 76 listcurrentlistsdirectory > listsdir.lst
de81b2e2
DK
77 testrun 'listsdir.lst'
78}
79
80testsetup 'file'
ba6b79bd 81
de81b2e2 82changetowebserver
ba6b79bd
DK
83webserverconfig 'aptwebserver::support::modified-since' 'false' "$1"
84webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also
dcbb364f 85webserverconfig 'aptwebserver::support::range' 'false' "$1"
ba6b79bd 86
de81b2e2 87testsetup 'http'
2737f28a 88
ba6b79bd
DK
89changetohttpswebserver
90
91testsetup 'https'