testcases runable as root
[ntk/apt.git] / test / integration / test-apt-get-changelog
CommitLineData
e5837128
MV
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture "i386"
9
13845042 10buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
e5837128 11
75b09312 12setupaptarchive --no-update
13845042 13changetowebserver
75b09312 14testsuccess aptget update
e5837128 15
43acd019
DK
16# simulate normal user with non-existent root-owned directories
17rm -rf rootdir/var/cache/apt/archives/
18mkdir rootdir/var/cache/apt/archives/
19addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;"
20chmod -R -w rootdir/var/cache/apt/archives
21
75b09312 22echo 'Apt::Changelogs::Server "http://localhost:8080/";' > rootdir/etc/apt/apt.conf.d/changelog.conf
e5837128 23
fcb144b9
DK
24testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt --print-uris
25
a98b6615
DH
26testequal "'http://localhost:8080//pool/apt_1.0/changelog'
27'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris
28
68ba0b7f
DK
29testsuccess aptget changelog apt -qq
30testfileequal 'rootdir/tmp/testsuccess.output' "$(cat aptarchive/pool/apt_1.0/changelog)"
72dd5bec 31
75b09312 32testsuccess aptget changelog apt -d
72dd5bec 33testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)"
68ba0b7f 34rm -f apt.changelog aptarchive/pool/apt_1.0/changelog
13845042 35
22da5c13
DK
36testequal "$(cat aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \
37 -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/'
72dd5bec 38
75b09312 39testsuccess aptget changelog apt -d
72dd5bec 40testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)"
68ba0b7f 41rm -f apt.changelog aptarchive/pool/apt_1.0.changelog
13845042
DK
42
43testequal 'E: changelog download failed' aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/'