]> git.saurik.com Git - apt.git/commitdiff
tests: enhance https support in the testcases
authorDavid Kalnischkies <kalnischkies@gmail.com>
Sun, 13 Oct 2013 17:23:30 +0000 (19:23 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Sat, 30 Nov 2013 11:38:26 +0000 (12:38 +0100)
Git-Dch: Ignore

test/integration/framework
test/integration/test-partial-file-support

index 20f3487cc242dd08436d261d579acf673413d9e5..6a2a78c83174a6f850ad6a94da4c774c8fe2d732 100644 (file)
@@ -192,6 +192,7 @@ setupenvironment() {
        fi
        echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
        echo 'quiet::NoUpdate "true";' >> aptconfig.conf
+       echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https
        export LC_ALL=C
        export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
        configcompression '.' 'gz' #'bz2' 'lzma' 'xz'
@@ -799,6 +800,11 @@ rewritesourceslist() {
 }
 
 changetowebserver() {
+       if [ "$1" != '--no-rewrite' ]; then
+               rewritesourceslist 'http://localhost:8080/'
+       else
+               shift
+       fi
        local LOG='/dev/null'
        if test -x ${BUILDDIRECTORY}/aptwebserver; then
                cd aptarchive
@@ -812,9 +818,6 @@ changetowebserver() {
        else
                msgdie 'You have to build aptwerbserver or install a webserver'
        fi
-       if [ "$1" != '--no-rewrite' ]; then
-               rewritesourceslist 'http://localhost:8080/'
-       fi
 }
 
 changetohttpswebserver() {
@@ -826,6 +829,7 @@ changetohttpswebserver() {
        fi
        echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
 cert = ${TESTDIRECTORY}/apt.pem
+output = /dev/null
 
 [https]
 accept = 4433
index 8d1c51ae0bbd0292f00609a74f21ff4eaef495e3..b176cc15e566ca793084f8ec9501a2bbbbcd3b12 100755 (executable)
@@ -18,7 +18,7 @@ testdownloadfile() {
        rm -f "$DOWNLOG"
        msgtest "Testing download of file $2 with" "$1"
        if ! downloadfile "$2" "$3" > "$DOWNLOG"; then
-               cat "$DOWNLOG"
+               cat >&2 "$DOWNLOG"
                msgfail
        else
                msgpass
@@ -40,21 +40,23 @@ testdownloadfile() {
                if [ "$EXPECTED" "$4" "$hash" ]; then
                        msgpass
                else
-                       cat "$DOWNLOG"
+                       cat >&2 "$DOWNLOG"
                        msgfail "expected: $EXPECTED ; got: $hash"
                fi
        done
 }
 
 testwebserverlaststatuscode() {
-       STATUS="$(mktemp)"
+       local DOWNLOG='download-testfile.log'
+       rm -f "$DOWNLOG"
+       local STATUS="$(mktemp)"
        addtrap "rm $STATUS;"
        msgtest 'Test last status code from the webserver was' "$1"
-       downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" >/dev/null
+       downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG"
        if [ "$(cat "$STATUS")" = "$1" ]; then
                msgpass
        else
-               cat download-testfile.log
+               cat >&2 "$DOWNLOG"
                msgfail "Status was $(cat "$STATUS")"
        fi
 }