Explorar el Código

tests: enhance https support in the testcases

Git-Dch: Ignore
David Kalnischkies hace 12 años
padre
commit
23af9f40ec
Se han modificado 2 ficheros con 14 adiciones y 8 borrados
  1. 7 3
      test/integration/framework
  2. 7 5
      test/integration/test-partial-file-support

+ 7 - 3
test/integration/framework

@@ -192,6 +192,7 @@ setupenvironment() {
 	fi
 	fi
 	echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
 	echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
 	echo 'quiet::NoUpdate "true";' >> 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 LC_ALL=C
 	export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
 	export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
 	configcompression '.' 'gz' #'bz2' 'lzma' 'xz'
 	configcompression '.' 'gz' #'bz2' 'lzma' 'xz'
@@ -799,6 +800,11 @@ rewritesourceslist() {
 }
 }
 
 
 changetowebserver() {
 changetowebserver() {
+	if [ "$1" != '--no-rewrite' ]; then
+		rewritesourceslist 'http://localhost:8080/'
+	else
+		shift
+	fi
 	local LOG='/dev/null'
 	local LOG='/dev/null'
 	if test -x ${BUILDDIRECTORY}/aptwebserver; then
 	if test -x ${BUILDDIRECTORY}/aptwebserver; then
 		cd aptarchive
 		cd aptarchive
@@ -812,9 +818,6 @@ changetowebserver() {
 	else
 	else
 		msgdie 'You have to build aptwerbserver or install a webserver'
 		msgdie 'You have to build aptwerbserver or install a webserver'
 	fi
 	fi
-	if [ "$1" != '--no-rewrite' ]; then
-		rewritesourceslist 'http://localhost:8080/'
-	fi
 }
 }
 
 
 changetohttpswebserver() {
 changetohttpswebserver() {
@@ -826,6 +829,7 @@ changetohttpswebserver() {
 	fi
 	fi
 	echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
 	echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
 cert = ${TESTDIRECTORY}/apt.pem
 cert = ${TESTDIRECTORY}/apt.pem
+output = /dev/null
 
 
 [https]
 [https]
 accept = 4433
 accept = 4433

+ 7 - 5
test/integration/test-partial-file-support

@@ -18,7 +18,7 @@ testdownloadfile() {
 	rm -f "$DOWNLOG"
 	rm -f "$DOWNLOG"
 	msgtest "Testing download of file $2 with" "$1"
 	msgtest "Testing download of file $2 with" "$1"
 	if ! downloadfile "$2" "$3" > "$DOWNLOG"; then
 	if ! downloadfile "$2" "$3" > "$DOWNLOG"; then
-		cat "$DOWNLOG"
+		cat >&2 "$DOWNLOG"
 		msgfail
 		msgfail
 	else
 	else
 		msgpass
 		msgpass
@@ -40,21 +40,23 @@ testdownloadfile() {
 		if [ "$EXPECTED" "$4" "$hash" ]; then
 		if [ "$EXPECTED" "$4" "$hash" ]; then
 			msgpass
 			msgpass
 		else
 		else
-			cat "$DOWNLOG"
+			cat >&2 "$DOWNLOG"
 			msgfail "expected: $EXPECTED ; got: $hash"
 			msgfail "expected: $EXPECTED ; got: $hash"
 		fi
 		fi
 	done
 	done
 }
 }
 
 
 testwebserverlaststatuscode() {
 testwebserverlaststatuscode() {
-	STATUS="$(mktemp)"
+	local DOWNLOG='download-testfile.log'
+	rm -f "$DOWNLOG"
+	local STATUS="$(mktemp)"
 	addtrap "rm $STATUS;"
 	addtrap "rm $STATUS;"
 	msgtest 'Test last status code from the webserver was' "$1"
 	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
 	if [ "$(cat "$STATUS")" = "$1" ]; then
 		msgpass
 		msgpass
 	else
 	else
-		cat download-testfile.log
+		cat >&2 "$DOWNLOG"
 		msgfail "Status was $(cat "$STATUS")"
 		msgfail "Status was $(cat "$STATUS")"
 	fi
 	fi
 }
 }