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 echo '601 Configuration 
  20 Config-Item: Acquire::http::DependOnSTDIN=0 
  23 URI: http://localhost:8080/holygrail 
  24 Filename: knights-talking 
  25 ' | ${METHODSDIR}/http 
>/dev
/null 
2>&1 && msgpass 
|| msgfail
 
  26 testfileequal knights
-talking 'ni ni ni' 
  28 ensure_n_canary_strings_in_dir
() { 
  30         local CANARY_STRING
="$2" 
  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" 
  38 LISTS
='rootdir/var/lib/apt/lists' 
  39 rm -rf rootdir
/var
/lib
/apt
/lists
 
  40 msgtest 
'Got expected NODATA failure in' 'apt-get update' 
  41 aptget update 
-qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass 
|| msgfail
 
  43 ensure_n_canary_strings_in_dir 
$LISTS 'ni ni ni' 0 
  44 testequal 
'partial' ls $LISTS 
  46 # and again with pre-existing files with "valid data" which should remain 
  47 for f 
in Release Release.gpg main_binary
-amd64_Packages main_source_Sources
; do 
  48     echo 'peng neee-wom' > $LISTS/localhost
:8080_dists_stable_
${f} 
  51 msgtest 
'Got expected NODATA failure in' 'apt-get update' 
  52 aptget update 
-qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass 
|| msgfail
 
  54 ensure_n_canary_strings_in_dir 
$LISTS 'peng neee-wom' 4 
  55 ensure_n_canary_strings_in_dir 
$LISTS 'ni ni ni' 0 
  57 # and now with a pre-existing InRelease file 
  58 echo 'peng neee-wom' > $LISTS/localhost
:8080_dists_stable_InRelease
 
  59 rm -f $LISTS/localhost
:8080_dists_stable_Release 
$LISTS/localhost
:8080_dists_stable_Release.gpg
 
  60 msgtest 
'excpected failure of' 'apt-get update' 
  61 aptget update 
-qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass 
|| msgfail
 
  63 ensure_n_canary_strings_in_dir 
$LISTS 'peng neee-wom' 3 
  64 ensure_n_canary_strings_in_dir 
$LISTS 'ni ni ni' 0