4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
'native'
10 insertpackage
'unstable' 'unrelated' 'all' '1.0' 'stable'
11 insertsource
'unstable' 'unrelated' 'all' '1.0' 'stable'
13 echo 'ni ni ni' > aptarchive
/knights
16 changetowebserver
-o 'aptwebserver::overwrite::.*::filename=/knights'
18 msgtest
'Acquire test file from the webserver to check' 'overwrite'
19 if downloadfile http
://localhost
:8080/holygrail .
/knights
-talking >/dev
/null
; then
24 testfileequal knights
-talking 'ni ni ni'
26 ensure_n_canary_strings_in_dir
() {
28 local CANARY_STRING
="$2"
31 msgtest
"Testing in $DIR for $EXPECTED_N canary" "$CANARY_STRING"
32 local N
=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l )
33 test "$N" = "$EXPECTED_N" && msgpass
|| msgfail
"Expected $EXPECTED_N canaries, got $N"
36 LISTS
='rootdir/var/lib/apt/lists'
37 rm -rf rootdir
/var
/lib
/apt
/lists
38 msgtest
'Got expected NODATA failure in' 'apt-get update'
39 aptget update
-qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass
|| msgfail
41 ensure_n_canary_strings_in_dir
$LISTS 'ni ni ni' 0
42 testequal
'partial' ls $LISTS
44 # and again with pre-existing files with "valid data" which should remain
45 for f
in Release Release.gpg main_binary
-amd64_Packages main_source_Sources
; do
46 echo 'peng neee-wom' > $LISTS/localhost
:8080_dists_stable_
${f}
49 msgtest
'Got expected NODATA failure in' 'apt-get update'
50 aptget update
-qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass
|| msgfail
52 ensure_n_canary_strings_in_dir
$LISTS 'peng neee-wom' 4
53 ensure_n_canary_strings_in_dir
$LISTS 'ni ni ni' 0
55 # and now with a pre-existing InRelease file
56 echo 'peng neee-wom' > $LISTS/localhost
:8080_dists_stable_InRelease
57 rm -f $LISTS/localhost
:8080_dists_stable_Release
$LISTS/localhost
:8080_dists_stable_Release.gpg
58 msgtest
'excpected failure of' 'apt-get update'
59 aptget update
-qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass
|| msgfail
61 ensure_n_canary_strings_in_dir
$LISTS 'peng neee-wom' 3
62 ensure_n_canary_strings_in_dir
$LISTS 'ni ni ni' 0