diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2012-09-04 14:16:27 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2012-09-04 14:16:27 +0200 |
commit | ac5b5e826ab405935dc257c0a0984ae39b02bc23 (patch) | |
tree | 83f02ebf3aed0e7b6725af8aa14114808d1a0eba /test/integration | |
parent | 2c76d72d412c1d7a2e615cd036f0730faa81dff7 (diff) | |
parent | 056c36565706cad136df288db777c01555f4ecd9 (diff) |
merged from lp:~donkult/apt/experimental
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/framework | 18 | ||||
-rwxr-xr-x | test/integration/skip-bug-602412-dequote-redirect | 38 | ||||
-rwxr-xr-x | test/integration/test-bug-602412-dequote-redirect | 29 | ||||
-rwxr-xr-x | test/integration/test-ubuntu-bug-346386-apt-get-update-paywall (renamed from test/integration/test-ubuntu-bug346386) | 24 |
4 files changed, 50 insertions, 59 deletions
diff --git a/test/integration/framework b/test/integration/framework index f7576668a..c656157f2 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -688,30 +688,30 @@ signreleasefiles() { } changetowebserver() { + if [ -n "$1" ] && ! test -x ${BUILDDIRECTORY}/aptwebserver; then + msgdie 'Need the aptwebserver when passing arguments' + fi - if [ -n "$1" ] && ! test -x ${BUILDDIRECTORY}/aptwebserver; then - msgdie 'Need the aptwebserver when passing arguments' - fi - + local LOG='/dev/null' if test -x ${BUILDDIRECTORY}/aptwebserver; then cd aptarchive - LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver $@ 2> /dev/null > /dev/null & + LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver $@ 2> $LOG > $LOG & addtrap "kill $!;" cd - > /dev/null elif which weborf > /dev/null; then - weborf -xb aptarchive/ 2>&1 > /dev/null & + weborf -xb aptarchive/ 2> $LOG > $LOG & addtrap "kill $!;" elif which gatling > /dev/null; then cd aptarchive - gatling -p 8080 -F -S 2>&1 > /dev/null & + gatling -p 8080 -F -S 2> $LOG > $LOG & addtrap "kill $!;" cd - > /dev/null elif which lighttpd > /dev/null; then echo "server.document-root = \"$(readlink -f ./aptarchive)\" server.port = 8080 server.stat-cache-engine = \"disable\"" > lighttpd.conf - lighttpd -t -f lighttpd.conf >/dev/null || msgdie 'Can not change to webserver: our lighttpd config is invalid' - lighttpd -D -f lighttpd.conf 2>/dev/null >/dev/null & + lighttpd -t -f lighttpd.conf 2> $LOG > $LOG || msgdie 'Can not change to webserver: our lighttpd config is invalid' + lighttpd -D -f lighttpd.conf 2> $LOG > $LOG & addtrap "kill $!;" else msgdie 'You have to install weborf or lighttpd first' diff --git a/test/integration/skip-bug-602412-dequote-redirect b/test/integration/skip-bug-602412-dequote-redirect deleted file mode 100755 index 689b671ce..000000000 --- a/test/integration/skip-bug-602412-dequote-redirect +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -set -e - -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework -setupenvironment -configarchitecture 'i386' - -if ! which lighttpd > /dev/null; then - msgdie 'You need lighttpd for this testcase, sorry…' - exit 1 -fi - -buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' - -setupaptarchive - -echo "server.modules = ( \"mod_redirect\" ) -server.document-root = \"$(readlink -f ./aptarchive)\" -server.port = 8080 -server.stat-cache-engine = \"disable\" -url.redirect = ( \"^/pool/(.*)$\" => \"/newpool/\$1\", - \"^/dists/(.*)$\" => \"/newdists/\$1\" )" > lighttpd.conf - -mv aptarchive/pool aptarchive/newpool -mv aptarchive/dists aptarchive/newdists - -lighttpd -t -f lighttpd.conf >/dev/null || msgdie 'Can not change to webserver: our lighttpd config is invalid' -lighttpd -D -f lighttpd.conf 2>/dev/null >/dev/null & -addtrap "kill $!;" - -APTARCHIVE="file://$(readlink -f ./aptarchive)" -for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do - sed -i $LIST -e "s#$APTARCHIVE#http://localhost:8080/#" -done - -aptget update || msgdie 'apt-get update failed' -aptget install unrelated --download-only || msgdie 'downloading package failed' diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect new file mode 100755 index 000000000..f1e67c6d8 --- /dev/null +++ b/test/integration/test-bug-602412-dequote-redirect @@ -0,0 +1,29 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' + +setupaptarchive +changetowebserver -o aptwebserver::redirect::replace::/pool/=/newpool/ \ + -o aptwebserver::redirect::replace::/dists/=/newdists/ + +mv aptarchive/pool aptarchive/newpool +mv aptarchive/dists aptarchive/newdists + +msgtest 'Test redirection works in' 'apt-get update' +aptget update -qq && msgpass || msgfail + +# check that I-M-S header is kept in redirections +testequal 'Hit http://localhost unstable InRelease +Hit http://localhost unstable/main Sources +Hit http://localhost unstable/main amd64 Packages +Hit http://localhost unstable/main Translation-en +Reading package lists...' aptget update + +msgtest 'Test redirection works in' 'package download' +aptget install unrelated --download-only -qq && msgpass || msgfail diff --git a/test/integration/test-ubuntu-bug346386 b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall index 1fbfb5ca4..25cccf067 100755 --- a/test/integration/test-ubuntu-bug346386 +++ b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall @@ -6,8 +6,7 @@ ensure_n_canary_strings_in_dir() { CANARY_STRING=$2 EXPECTED_N=$3 - msgtest "Testing for $EXPECTED_N canary strings '$CANARY_STRING' in in $DIR" - + msgtest "Testing for $EXPECTED_N canary strings '$CANARY_STRING' in in" "$DIR" N=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l ) if [ "$N" = "$EXPECTED_N" ]; then @@ -23,25 +22,26 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture 'amd64' +configarchitecture 'native' -buildsimplenativepackage 'apt' 'all' '1.0' 'stable' +insertpackage 'unstable' 'unrelated' 'all' '1.0' 'stable' setupaptarchive changetowebserver --simulate-paywall rm -rf rootdir/var/lib/apt/lists -if aptget update -qq 2>/dev/null; then - msgfail "excpected apt-get update failure" -fi -ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ "ni ni ni" 0 +msgtest 'excpected failure of' 'apt-get update' +aptget update -qq 2>/dev/null && msgfail || msgpass + +ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ 'ni ni ni' 0 testequal 'partial' ls rootdir/var/lib/apt/lists/ # again, this time with pre-existing files valid data -for f in Release Release.gpg main_binary-amd64_Packages stable_main_source_Sources; do +for f in Release Release.gpg main_binary-amd64_Packages stable_main_source_Sources; do echo "canary" > rootdir/var/lib/apt/lists/localhost:8080_dists_stable_${f} done -# this will fail, the important part is that the canaries remain -aptget update -qq 2>/dev/null || true -ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ "canary" 4 +# this will fail, the important part is that the canaries remain +msgtest 'excpected failure of' 'apt-get update' +aptget update -qq 2>/dev/null && msgfail || msgpass +ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ 'canary' 4 |