]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-unauth
Do not allow going from authenticated to unauthenticated repo
[apt.git] / test / integration / test-apt-update-unauth
CommitLineData
ca7fd76c
MV
1#!/bin/sh
2#
3# Ensure that when going from unauthenticated to authenticated all
4# files are checked again
5#
6set -e
7
8TESTDIR=$(readlink -f $(dirname $0))
9. $TESTDIR/framework
10
11setupenvironment
12configarchitecture "i386"
13
14insertpackage 'unstable' 'foo' 'all' '1.0'
15insertsource 'unstable' 'foo' 'all' '1.0'
16
17setupaptarchive
18changetowebserver
19
c8aa88aa
MV
20# FIXME:
21# - also check the unauth -> auth success case, i.e. that all files are
22# reverified
ca7fd76c
MV
23runtest() {
24 # start unauthenticated
25 find rootdir/var/lib/apt/lists/ -type f | xargs rm -f
26 rm -f aptarchive/dists/unstable/*Release*
c8aa88aa
MV
27 # remove uncompressed version
28 find aptarchive/ -name Packages | xargs rm -f
ca7fd76c
MV
29 aptget update -qq
30
31 # become authenticated
32 generatereleasefiles
33 signreleasefiles
34
c8aa88aa
MV
35 # and ensure we re-check the downloaded data
36 msgtest "Check rollback on going from unauth -> auth"
37
38 # change the local packages file
39 PKGS=$(ls rootdir/var/lib/apt/lists/*Packages*)
40 echo "meep" > $PKGS
41 ls -l rootdir/var/lib/apt/lists > lists.before
42
43 # update and ensure all is reverted on the hashsum failure
44 aptget update -o Debug::Acquire::Transaction=1 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 > output.log 2>&1 || true
45
46 # ensure we have before what we have after
47 ls -l rootdir/var/lib/apt/lists > lists.after
48 if diff -u lists.before lists.after; then
ca7fd76c 49 msgpass
c8aa88aa
MV
50 else
51 #cat output.log
52 msgfail
ca7fd76c 53 fi
c8aa88aa 54
ca7fd76c
MV
55}
56
57for COMPRESSEDINDEXES in 'false' 'true'; do
58 echo "Acquire::GzipIndexes \"$COMPRESSEDINDEXES\";" > rootdir/etc/apt/apt.conf.d/compressindexes
59 if $COMPRESSEDINDEXES; then
60 msgmsg 'Run tests with GzipIndexes enabled'
61 else
62 msgmsg 'Run tests with GzipIndexes disabled'
63 fi
64
65 runtest
66done