summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2013-10-23 16:32:48 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2013-11-30 12:38:26 +0100
commitf2c0ec8bdb00b44de240190dae39fa255b6c85de (patch)
tree591dfd0e481786b9a23eca954d75e768011824a0 /test
parent8523b22fbcc6ca2ad004a9133559212908b768ed (diff)
tests: add a webserverconfig method to abstract config
The URI to use to set a config option is a bit arcane to write/remember and checking if the setting was successful doubly so. Git-Dch: Ignore
Diffstat (limited to 'test')
-rw-r--r--test/integration/framework16
-rwxr-xr-xtest/integration/test-partial-file-support6
-rwxr-xr-xtest/integration/test-releasefile-verification2
-rw-r--r--test/interactive-helper/aptwebserver.cc2
4 files changed, 20 insertions, 6 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 6a2a78c83..89b5bb0e4 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -792,6 +792,22 @@ signreleasefiles() {
msgdone "info"
}
+webserverconfig() {
+ msgtest "Set webserver config option '${1}' to" "$2"
+ downloadfile "http://localhost:8080/_config/set/${1}/${2}" '/dev/null' >/dev/null
+ local DOWNLOG='download-testfile.log'
+ rm -f "$DOWNLOG"
+ local STATUS="$(mktemp)"
+ addtrap "rm $STATUS;"
+ downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG"
+ if [ "$(cat "$STATUS")" = '200' ]; then
+ msgpass
+ else
+ cat >&2 "$DOWNLOG"
+ msgfail "Statuscode was $(cat "$STATUS")"
+ fi
+}
+
rewritesourceslist() {
local APTARCHIVE="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")"
for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support
index b176cc15e..382789e68 100755
--- a/test/integration/test-partial-file-support
+++ b/test/integration/test-partial-file-support
@@ -66,8 +66,7 @@ TESTFILE='aptarchive/testfile'
cp -a ${TESTDIR}/framework $TESTFILE
testrun() {
- downloadfile "$1/_config/set/aptwebserver::support::range/true" '/dev/null' >/dev/null
- testwebserverlaststatuscode '200'
+ webserverconfig 'aptwebserver::support::range' 'true'
copysource $TESTFILE 0 ./testfile
testdownloadfile 'no data' "${1}/testfile" './testfile' '='
@@ -94,8 +93,7 @@ testrun() {
testdownloadfile 'old data' "${1}/testfile" './testfile' '='
testwebserverlaststatuscode '200'
- downloadfile "$1/_config/set/aptwebserver::support::range/false" '/dev/null' >/dev/null
- testwebserverlaststatuscode '200'
+ webserverconfig 'aptwebserver::support::range' 'false'
copysource $TESTFILE 20 ./testfile
testdownloadfile 'no server support' "${1}/testfile" './testfile' '='
diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification
index 9d34a521a..e558b83e8 100755
--- a/test/integration/test-releasefile-verification
+++ b/test/integration/test-releasefile-verification
@@ -11,7 +11,7 @@ buildaptarchive
setupflataptarchive
changetowebserver
-downloadfile "http://localhost:8080/_config/set/aptwebserver::support::range/false" '/dev/null' >/dev/null
+webserverconfig 'aptwebserver::support::range' 'false'
prepare() {
local DATE="${2:-now}"
diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc
index 7d3589c9d..b7663a76a 100644
--- a/test/interactive-helper/aptwebserver.cc
+++ b/test/interactive-helper/aptwebserver.cc
@@ -546,7 +546,7 @@ void * handleClient(void * voidclient) /*{{{*/
{
FileFd data(filename, FileFd::ReadOnly);
std::string condition = LookupTag(*m, "If-Modified-Since", "");
- if (condition.empty() == false)
+ if (_config->FindB("aptwebserver::support::modified-since", true) == true && condition.empty() == false)
{
time_t cache;
if (RFC1123StrToTime(condition.c_str(), cache) == true &&