]> git.saurik.com Git - apt.git/blame - test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
Merge branch 'debian/sid' into debian/experimental
[apt.git] / test / integration / test-ubuntu-bug-346386-apt-get-update-paywall
CommitLineData
ae99ce2e
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture 'native'
9
10insertpackage 'unstable' 'unrelated' 'all' '1.0' 'stable'
11insertsource 'unstable' 'unrelated' 'all' '1.0' 'stable'
12
13echo 'ni ni ni' > aptarchive/knights
14
15setupaptarchive
16changetowebserver -o 'aptwebserver::overwrite::.*::filename=/knights'
17
18msgtest 'Acquire test file from the webserver to check' 'overwrite'
19echo '601 Configuration
20Config-Item: Acquire::http::DependOnSTDIN=0
21
22600 Acquire URI
23URI: http://localhost:8080/holygrail
24Filename: knights-talking
b3501edb 25' | runapt ${METHODSDIR}/http >/dev/null 2>&1 && msgpass || msgfail
ae99ce2e
DK
26testfileequal knights-talking 'ni ni ni'
27
28ensure_n_canary_strings_in_dir() {
29 local DIR="$1"
30 local CANARY_STRING="$2"
31 local EXPECTED_N="$3"
32
33 msgtest "Testing in $DIR for $EXPECTED_N canary" "$CANARY_STRING"
34 local N=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l )
35 test "$N" = "$EXPECTED_N" && msgpass || msgfail "Expected $EXPECTED_N canaries, got $N"
36}
37
38LISTS='rootdir/var/lib/apt/lists'
39rm -rf rootdir/var/lib/apt/lists
40msgtest 'Got expected NODATA failure in' 'apt-get update'
41aptget update -qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass || msgfail
42
43ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0
44testequal 'partial' ls $LISTS
45
46# and again with pre-existing files with "valid data" which should remain
47for f in Release Release.gpg main_binary-amd64_Packages main_source_Sources; do
48 echo 'peng neee-wom' > $LISTS/localhost:8080_dists_stable_${f}
49done
50
51msgtest 'Got expected NODATA failure in' 'apt-get update'
52aptget update -qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass || msgfail
53
54ensure_n_canary_strings_in_dir $LISTS 'peng neee-wom' 4
55ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0
56
57# and now with a pre-existing InRelease file
58echo 'peng neee-wom' > $LISTS/localhost:8080_dists_stable_InRelease
59rm -f $LISTS/localhost:8080_dists_stable_Release $LISTS/localhost:8080_dists_stable_Release.gpg
60msgtest 'excpected failure of' 'apt-get update'
61aptget update -qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass || msgfail
62
63ensure_n_canary_strings_in_dir $LISTS 'peng neee-wom' 3
64ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0