]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-unauth
test: Get rid of debhelper rules.tiny example dep
[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
3abb6a6a
DK
8TESTDIR="$(readlink -f "$(dirname "$0")")"
9. "$TESTDIR/framework"
ca7fd76c 10
e1bd768b
MV
11umask 022
12
ca7fd76c
MV
13setupenvironment
14configarchitecture "i386"
0179cfa8 15configcompression '.' 'xz'
ca7fd76c 16
1dd20368
DK
17insertpackage 'unstable' 'foo' 'i386' '1.0'
18insertsource 'unstable' 'foo' 'any' '1.0'
ca7fd76c 19
846bc058 20setupaptarchive --no-update
ca7fd76c
MV
21changetowebserver
22
c8aa88aa
MV
23# FIXME:
24# - also check the unauth -> auth success case, i.e. that all files are
25# reverified
ca7fd76c
MV
26runtest() {
27 # start unauthenticated
846bc058
DK
28 rm -rf rootdir/var/lib/apt/lists/
29 find aptarchive/ -name '*Release*' -delete
0b844e23 30
4fa34122 31 testwarning aptget update --allow-insecure-repositories
0b844e23 32
ca7fd76c
MV
33 # become authenticated
34 generatereleasefiles
35 signreleasefiles
36
0b844e23
MV
37 # move uncompressed away
38 mv aptarchive/dists/unstable/main/binary-i386/Packages \
39 aptarchive/dists/unstable/main/binary-i386/Packages.uncompressed
40
c8aa88aa 41 # and ensure we re-check the downloaded data
c8aa88aa
MV
42
43 # change the local packages file
44 PKGS=$(ls rootdir/var/lib/apt/lists/*Packages*)
45 echo "meep" > $PKGS
846bc058 46 listcurrentlistsdirectory > lists.before
c8aa88aa
MV
47
48 # update and ensure all is reverted on the hashsum failure
0179cfa8 49 testfailure aptget update -o Debug::Acquire::Transaction=1 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 -o Debug::acquire::http=0
c8aa88aa
MV
50
51 # ensure we have before what we have after
5684f71f 52 msgtest 'Check rollback on going from' 'unauth -> auth'
846bc058 53 listcurrentlistsdirectory > lists.after
5684f71f 54 if cmp lists.before lists.after; then
ca7fd76c 55 msgpass
c8aa88aa 56 else
0179cfa8 57 echo >&2
5684f71f 58 echo >&2 '### Output of previous apt-get update ###'
0179cfa8 59 cat >&2 rootdir/tmp/testfailure.output || true
5684f71f 60 echo >&2 '### Changes in the lists-directory: ###'
0179cfa8
DK
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
5684f71f 64 msgfail
ca7fd76c 65 fi
c8aa88aa 66
5684f71f 67 # move uncompressed back for release file
0b844e23
MV
68 mv aptarchive/dists/unstable/main/binary-i386/Packages.uncompressed \
69 aptarchive/dists/unstable/main/binary-i386/Packages
ca7fd76c
MV
70}
71
72for 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
5684f71f 79 runtest
ca7fd76c 80done