]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-update-unauth
cleanup around pkgAcqMetaSig and improved tests
[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
16 insertpackage 'unstable' 'foo' 'all' '1.0'
17 insertsource 'unstable' 'foo' 'all' '1.0'
18
19 setupaptarchive
20 changetowebserver
21
22 # FIXME:
23 # - also check the unauth -> auth success case, i.e. that all files are
24 # reverified
25 runtest() {
26 # start unauthenticated
27 find rootdir/var/lib/apt/lists/ -type f | xargs rm -f
28 rm -f aptarchive/dists/unstable/*Release*
29
30 aptget update -qq --allow-insecure-repositories
31
32 # FIXME: this really shouldn't be needed
33 rm -f rootdir/var/lib/apt/lists/partial/*
34
35 # become authenticated
36 generatereleasefiles
37 signreleasefiles
38
39 # move uncompressed away
40 mv aptarchive/dists/unstable/main/binary-i386/Packages \
41 aptarchive/dists/unstable/main/binary-i386/Packages.uncompressed
42
43 # and ensure we re-check the downloaded data
44 msgtest "Check rollback on going from unauth -> auth"
45
46 # change the local packages file
47 PKGS=$(ls rootdir/var/lib/apt/lists/*Packages*)
48 echo "meep" > $PKGS
49 ls rootdir/var/lib/apt/lists/ > lists.before
50
51 # update and ensure all is reverted on the hashsum failure
52 aptget update -o Debug::Acquire::Transaction=0 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 -o Debug::acquire::http=0 > output.log 2>&1 || true
53
54 # ensure we have before what we have after
55 ls rootdir/var/lib/apt/lists/ > lists.after
56 if diff -u lists.before lists.after; then
57 msgpass
58 else
59 cat output.log
60 msgfail
61 fi
62
63 # move uncompressed back for release file
64 mv aptarchive/dists/unstable/main/binary-i386/Packages.uncompressed \
65 aptarchive/dists/unstable/main/binary-i386/Packages
66 }
67
68 for COMPRESSEDINDEXES in 'false' 'true'; do
69 echo "Acquire::GzipIndexes \"$COMPRESSEDINDEXES\";" > rootdir/etc/apt/apt.conf.d/compressindexes
70 if $COMPRESSEDINDEXES; then
71 msgmsg 'Run tests with GzipIndexes enabled'
72 else
73 msgmsg 'Run tests with GzipIndexes disabled'
74 fi
75
76 runtest
77 done