]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
allow redirection for items without a space in the desc again
[apt.git] / test / integration / test-ubuntu-bug-346386-apt-get-update-paywall
... / ...
CommitLineData
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'
19if downloadfile http://localhost:${APTHTTPPORT}/holygrail ./knights-talking >/dev/null; then
20 msgpass
21else
22 msgfail
23fi
24
25testfileequal knights-talking 'ni ni ni'
26
27ensure_n_canary_strings_in_dir() {
28 local DIR="$1"
29 local CANARY_STRING="$2"
30 local EXPECTED_N="$3"
31
32 msgtest "Testing in $DIR for $EXPECTED_N canary" "$CANARY_STRING"
33 local N=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l )
34 test "$N" = "$EXPECTED_N" && msgpass || msgfail "Expected $EXPECTED_N canaries, got $N"
35}
36
37LISTS='rootdir/var/lib/apt/lists'
38rm -rf rootdir/var/lib/apt/lists
39testfailure aptget update
40testsuccess grep '^E:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output
41
42ensure_n_canary_strings_in_dir "$LISTS" 'ni ni ni' 0
43testequal 'lock
44partial' 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:${APTHTTPPORT}_dists_stable_${f}"
49 chmod 644 "$LISTS/localhost:${APTHTTPPORT}_dists_stable_${f}"
50done
51
52testfailure aptget update
53testsuccess grep '^E:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output
54
55ensure_n_canary_strings_in_dir "$LISTS" 'peng neee-wom' 4
56ensure_n_canary_strings_in_dir "$LISTS" 'ni ni ni' 0
57
58# and now with a pre-existing InRelease file
59echo 'peng neee-wom' > "$LISTS/localhost:${APTHTTPPORT}_dists_stable_InRelease"
60chmod 644 "$LISTS/localhost:${APTHTTPPORT}_dists_stable_InRelease"
61rm -f "$LISTS/localhost:${APTHTTPPORT}_dists_stable_Release" "$LISTS/localhost:${APTHTTPPORT}_dists_stable_Release.gpg"
62msgtest 'excpected failure of' 'apt-get update'
63testfailure aptget update
64testsuccess grep '^E:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output
65
66ensure_n_canary_strings_in_dir "$LISTS" 'peng neee-wom' 3
67ensure_n_canary_strings_in_dir "$LISTS" 'ni ni ni' 0