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