4 ensure_n_canary_strings_in_dir
() {
9 msgtest
"Testing for $EXPECTED_N canary strings '$CANARY_STRING' in in $DIR"
12 N
=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l )
13 if [ "$N" = "$EXPECTED_N" ]; then
17 msgfail
"Expected $EXPECTED_N canaries, got $N"
22 TESTDIR
=$(readlink -f $(dirname $0))
26 configarchitecture
'amd64'
28 buildsimplenativepackage
'apt' 'all' '1.0' 'stable'
31 changetowebserver
--simulate-paywall
33 rm -rf rootdir
/var
/lib
/apt
/lists
34 if aptget update
-qq 2>/dev
/null
; then
35 msgfail
"excpected apt-get update failure"
37 ensure_n_canary_strings_in_dir rootdir
/var
/lib
/apt
/lists
/ "ni ni ni" 0
38 testequal
'partial' ls rootdir
/var
/lib
/apt
/lists
/
40 # again, this time with pre-existing files valid data
41 for f
in Release Release.gpg main_binary
-amd64_Packages stable_main_source_Sources
; do
42 echo "canary" > rootdir
/var
/lib
/apt
/lists
/localhost
:8080_dists_stable_
${f}
44 # this will fail, the important part is that the canaries remain
45 aptget update
-qq 2>/dev
/null
|| true
46 ensure_n_canary_strings_in_dir rootdir
/var
/lib
/apt
/lists
/ "canary" 4