]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-transactions
cleanup pdiff support detection decision
[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
DK
31testrun() {
32 # produce an unsigned repository
33 find aptarchive \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
34 testfailure aptget update --no-allow-insecure-repositories
846bc058 35 testfileequal "$1" "$(listcurrentlistsdirectory)"
de81b2e2
DK
36
37 # signed but broken
38 signreleasefiles
47aca3cf 39
de81b2e2
DK
40 breakfile aptarchive/dists/unstable/main/binary-i386/Packages
41 testfailure aptget update
846bc058 42 testfileequal "$1" "$(listcurrentlistsdirectory)"
de81b2e2
DK
43 restorefile aptarchive/dists/unstable/main/binary-i386/Packages
44
45 breakfile aptarchive/dists/unstable/main/source/Sources
46 testfailure aptget update
846bc058 47 testfileequal "$1" "$(listcurrentlistsdirectory)"
de81b2e2
DK
48 restorefile aptarchive/dists/unstable/main/source/Sources
49}
50
51testsetup() {
52 msgmsg 'Test with no initial data over' "$1"
8eafc759 53 redatereleasefiles 'now'
de81b2e2 54 rm -rf rootdir/var/lib/apt/lists
8fe964f1 55 mkdir -p rootdir/var/lib/apt/lists/partial
846bc058 56 listcurrentlistsdirectory > listsdir.lst
de81b2e2
DK
57 testrun 'listsdir.lst'
58
59 msgmsg 'Test with initial data over' "$1"
58702f85
DK
60 rm -rf rootdir/var/lib/apt/lists
61 testsuccess aptget update -o Debug::pkgAcquire::Worker=1
846bc058 62 listcurrentlistsdirectory > listsdir.lst
8eafc759 63 redatereleasefiles '+1hour'
de81b2e2
DK
64 testrun 'listsdir.lst'
65}
66
67testsetup 'file'
ba6b79bd 68
de81b2e2 69changetowebserver
ba6b79bd
DK
70webserverconfig 'aptwebserver::support::modified-since' 'false' "$1"
71webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also
dcbb364f 72webserverconfig 'aptwebserver::support::range' 'false' "$1"
ba6b79bd 73
de81b2e2 74testsetup 'http'
2737f28a 75
ba6b79bd
DK
76changetohttpswebserver
77
78testsetup 'https'