]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-unauth
replace run-parts with find|sort to avoid debianutils usage
[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
1dd20368
DK
16insertpackage 'unstable' 'foo' 'i386' '1.0'
17insertsource 'unstable' 'foo' 'any' '1.0'
ca7fd76c 18
846bc058 19setupaptarchive --no-update
ca7fd76c
MV
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
846bc058
DK
27 rm -rf rootdir/var/lib/apt/lists/
28 find aptarchive/ -name '*Release*' -delete
0b844e23 29
4fa34122 30 testwarning aptget update --allow-insecure-repositories
0b844e23 31
ca7fd76c
MV
32 # become authenticated
33 generatereleasefiles
34 signreleasefiles
35
0b844e23
MV
36 # move uncompressed away
37 mv aptarchive/dists/unstable/main/binary-i386/Packages \
38 aptarchive/dists/unstable/main/binary-i386/Packages.uncompressed
39
c8aa88aa 40 # and ensure we re-check the downloaded data
c8aa88aa
MV
41
42 # change the local packages file
43 PKGS=$(ls rootdir/var/lib/apt/lists/*Packages*)
44 echo "meep" > $PKGS
846bc058 45 listcurrentlistsdirectory > lists.before
c8aa88aa
MV
46
47 # update and ensure all is reverted on the hashsum failure
5684f71f 48 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
49
50 # ensure we have before what we have after
5684f71f 51 msgtest 'Check rollback on going from' 'unauth -> auth'
846bc058 52 listcurrentlistsdirectory > lists.after
5684f71f 53 if cmp lists.before lists.after; then
ca7fd76c 54 msgpass
c8aa88aa 55 else
5684f71f
DK
56 echo >&2 '### Output of previous apt-get update ###'
57 cat >&2 rootdir/tmp/testfailure.output
58 echo >&2 '### Changes in the lists-directory: ###'
59 diff -u >&2 lists.before lists.after
60 msgfail
ca7fd76c 61 fi
c8aa88aa 62
5684f71f 63 # move uncompressed back for release file
0b844e23
MV
64 mv aptarchive/dists/unstable/main/binary-i386/Packages.uncompressed \
65 aptarchive/dists/unstable/main/binary-i386/Packages
ca7fd76c
MV
66}
67
68for 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
5684f71f 75 runtest
ca7fd76c 76done