]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-update-unauth
don't purge directly, but remove and do purge at the end
[apt.git] / test / integration / test-apt-update-unauth
1 #!/bin/sh
2 #
3 # Ensure that when going from unauthenticated to authenticated all
4 # files are checked again
5 #
6 set -e
7
8 TESTDIR="$(readlink -f "$(dirname "$0")")"
9 . "$TESTDIR/framework"
10
11 umask 022
12
13 setupenvironment
14 configarchitecture "i386"
15 configcompression '.' 'xz'
16
17 insertpackage 'unstable' 'foo' 'i386' '1.0'
18 insertsource 'unstable' 'foo' 'any' '1.0'
19
20 setupaptarchive --no-update
21 changetowebserver
22
23 # FIXME:
24 # - also check the unauth -> auth success case, i.e. that all files are
25 # reverified
26 runtest() {
27 # start unauthenticated
28 rm -rf rootdir/var/lib/apt/lists/
29 find aptarchive/ -name '*Release*' -delete
30
31 testwarning aptget update --allow-insecure-repositories
32
33 # become authenticated
34 generatereleasefiles
35 signreleasefiles
36
37 # move uncompressed away
38 mv aptarchive/dists/unstable/main/binary-i386/Packages \
39 aptarchive/dists/unstable/main/binary-i386/Packages.uncompressed
40
41 # and ensure we re-check the downloaded data
42
43 # change the local packages file
44 PKGS=$(ls rootdir/var/lib/apt/lists/*Packages*)
45 echo "meep" > $PKGS
46 listcurrentlistsdirectory > lists.before
47
48 # update and ensure all is reverted on the hashsum failure
49 testfailure aptget update -o Debug::Acquire::Transaction=1 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 -o Debug::acquire::http=0
50
51 # ensure we have before what we have after
52 msgtest 'Check rollback on going from' 'unauth -> auth'
53 listcurrentlistsdirectory > lists.after
54 if cmp lists.before lists.after; then
55 msgpass
56 else
57 echo >&2
58 echo >&2 '### Output of previous apt-get update ###'
59 cat >&2 rootdir/tmp/testfailure.output || true
60 echo >&2 '### Changes in the lists-directory: ###'
61 diff -u >&2 lists.before lists.after || true
62 echo >&2 '### Contents of the lists-directory: ###'
63 ls -l rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists/partial || true
64 msgfail
65 fi
66
67 # move uncompressed back for release file
68 mv aptarchive/dists/unstable/main/binary-i386/Packages.uncompressed \
69 aptarchive/dists/unstable/main/binary-i386/Packages
70 }
71
72 for COMPRESSEDINDEXES in 'false' 'true'; do
73 echo "Acquire::GzipIndexes \"$COMPRESSEDINDEXES\";" > rootdir/etc/apt/apt.conf.d/compressindexes
74 if $COMPRESSEDINDEXES; then
75 msgmsg 'Run tests with GzipIndexes enabled'
76 else
77 msgmsg 'Run tests with GzipIndexes disabled'
78 fi
79 runtest
80 done