4 ensure_n_canary_strings_in_dir
() {
9 msgtest
"Testing for $EXPECTED_N canary strings '$CANARY_STRING' in in" "$DIR"
11 N
=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l )
12 if [ "$N" = "$EXPECTED_N" ]; then
16 msgfail
"Expected $EXPECTED_N canaries, got $N"
21 TESTDIR
=$(readlink -f $(dirname $0))
25 configarchitecture
'native'
27 insertpackage
'unstable' 'unrelated' 'all' '1.0' 'stable'
30 changetowebserver
--simulate-paywall
32 rm -rf rootdir
/var
/lib
/apt
/lists
33 msgtest
'excpected failure of' 'apt-get update'
34 aptget update
-qq 2>/dev
/null
&& msgfail
|| msgpass
36 ensure_n_canary_strings_in_dir rootdir
/var
/lib
/apt
/lists
/ 'ni ni ni' 0
37 testequal
'partial' ls rootdir
/var
/lib
/apt
/lists
/
39 # again, this time with pre-existing files valid data
40 for f
in Release Release.gpg main_binary
-amd64_Packages stable_main_source_Sources
; do
41 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 msgtest
'excpected failure of' 'apt-get update'
46 aptget update
-qq 2>/dev
/null
&& msgfail
|| msgpass
47 ensure_n_canary_strings_in_dir rootdir
/var
/lib
/apt
/lists
/ 'canary' 4