This is an automated email from the ASF dual-hosted git repository. rob pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git
commit 3ef7b8f9ac261e5d3a69bffc5732a57cb9fb6c91 Author: Jan van Doorn <j...@knutsel.com> AuthorDate: Mon May 28 14:45:10 2018 -0600 Add ModHdr test start, some cleanup --- grove/integration_test/setup-and-run.sh | 38 ++++++ .../tests/plugins/modify_headers/remap.json | 152 +++++++++++++++++++++ .../tests/plugins/modify_headers/test.sh | 41 ++++++ .../tests/plugins/range_req_handler/test.sh | 4 +- 4 files changed, 233 insertions(+), 2 deletions(-) diff --git a/grove/integration_test/setup-and-run.sh b/grove/integration_test/setup-and-run.sh index 4e642df..3194947 100644 --- a/grove/integration_test/setup-and-run.sh +++ b/grove/integration_test/setup-and-run.sh @@ -55,6 +55,44 @@ curl -H'Host: mem-test.cdn.kabletown.net' -Lsv -r 50000-50009 http://localhost: #cd $GOPATH/src/github.com/apache/incubator-trafficcontrol/grove/integration_test go build compare_gets.go +#function run_test () { +# command=${1} +# output=${2:-/dev/null} +# echo -n "Test ${testno} (${command}): " +# ${command} > ${output} 2>&1 +# thisresult=$? +# +# result=$(($result+thisresult)) +# if [ $thisresult -eq 0 ] +# then +# echo "PASS" +# else +# echo "FAIL" +# fi +# +# testno=$(($testno+1)) +#} + + +function run_test () { + "$@" + thisresult=$? + + result=$(($result+thisresult)) + if [ $thisresult -eq 0 ] + then + echo "PASS" + else + echo "FAIL" + fi + + testno=$(($testno+1)) +} +export -f run_test + + +$GOPATH/src/github.com/apache/incubator-trafficcontrol/grove/integration_test/tests/plugins/modify_headers/test.sh +$GOPATH/src/github.com/apache/incubator-trafficcontrol/grove/integration_test/tests/plugins/range_req_handler/test.sh diff --git a/grove/integration_test/tests/plugins/modify_headers/remap.json b/grove/integration_test/tests/plugins/modify_headers/remap.json new file mode 100644 index 0000000..80739e4 --- /dev/null +++ b/grove/integration_test/tests/plugins/modify_headers/remap.json @@ -0,0 +1,152 @@ +{ + "parent_selection": "consistent-hash", + "plugins": { + "modify_response_headers_global": { + "set": [ + { + "name": "Server", + "value": "Grove/0.39999999" + } + ] + } + }, + "retry_codes": null, + "retry_num": null, + "rules": [ + { + "allow": null, + "certificate-file": "", + "certificate-key-file": "", + "concurrent_rule_requests": 0, + "connection-close": false, + "deny": null, + "from": "http://disk-test.cdn.kabletown.net", + "name": "test", + "parent_selection": "consistent-hash", + "cache_name": "disk", + "plugins": { + "modify_parent_request_headers": { + "set": [ + { + "name": "X-From-CDN", + "value": "Traffic-Control" + } + ] + }, + "modify_headers": { + "set": [ + { + "name": "X-CDN-name", + "value": "GroverCDN" + } + ] + }, + "range_req_handler": { + "mode": "get_full_serve_range" + } + }, + "query-string": { + "cache": true, + "remap": true + }, + "retry_codes": [], + "retry_num": 5, + "timeout_ms": 5000000, + "to": [ + { + "retry_codes": [], + "retry_num": 0, + "timeout_ms": 5000000, + "url": "http://localhost", + "weight": 1 + } + ] + }, + { + "allow": null, + "certificate-file": "", + "certificate-key-file": "", + "concurrent_rule_requests": 0, + "connection-close": false, + "deny": null, + "from": "http://disk1-test.cdn.kabletown.net", + "name": "test1", + "parent_selection": "consistent-hash", + "cache_name": "disk", + "plugins": { + "modify_parent_request_headers": { + "set": [ + { + "name": "X-From-CDN", + "value": "Traffic-Control" + } + ] + }, + "modify_headers": { + "set": [ + { + "name": "X-CDN-name", + "value": "GroverCDN" + } + ] + } + }, + "query-string": { + "cache": true, + "remap": true + }, + "retry_codes": [], + "retry_num": 5, + "timeout_ms": 5000000, + "to": [ + { + "retry_codes": [], + "retry_num": 0, + "timeout_ms": 5000000, + "url": "http://localhost", + "weight": 1 + } + ] + }, + { + "allow": null, + "certificate-file": "", + "certificate-key-file": "", + "concurrent_rule_requests": 0, + "connection-close": false, + "deny": null, + "from": "http://mem-test.cdn.kabletown.net", + "name": "test2", + "parent_selection": "consistent-hash", + "query-string": { + "cache": true, + "remap": true + }, + "retry_codes": [], + "retry_num": 5, + "timeout_ms": 5000, + "plugins": { + "range_req_handler": { + "mode": "store_ranges" + } + }, + "to": [ + { + "retry_codes": [], + "retry_num": 0, + "timeout_ms": 5000000, + "url": "http://localhost", + "weight": 1 + } + ] + } + ], + "stats": { + "allow": [ + "127.0.0.1/32", + "::1/128" + ], + "deny": null + }, + "timeout_ms": 5000 +} diff --git a/grove/integration_test/tests/plugins/modify_headers/test.sh b/grove/integration_test/tests/plugins/modify_headers/test.sh new file mode 100644 index 0000000..9e9615d --- /dev/null +++ b/grove/integration_test/tests/plugins/modify_headers/test.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash -x + +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +originurl="http://localhost/" +host="mem-test.cdn.kabletown.net" +cacheurl="http://localhost:8080/" +file="10Mb.txt" + +result=0 +testno=0 + + +# test global header set +run_test curl -Lkvs -HHost:mem-test.cdn.kabletown.net -o /tmp/10k.bin http://localhost:8080/10k.bin +cp /tmp/run_test.out /tmp/hdrs.out +run_test diff /tmp/10k.bin /var/www/html/10k.bin +run_test grep "< Server: Grove/0.39999999" /tmp/hdrs.out + +# test per remap header set up and down +run_test curl -XTRACE -H'Host: disk-test.cdn.kabletown.net' http://localhost:8080/10Mb.txt -Lkvs -o /tmp/out +cp /tmp/run_test.out /tmp/hdrs.out +run_test grep "X-From-Cdn: Traffic-Control" /tmp/out +run_test grep "< X-Cdn-Name: GroverCDN" /tmp/out + +echo "plugin/modify_headers: $testno tests done, $result failed." + +exit $result diff --git a/grove/integration_test/tests/plugins/range_req_handler/test.sh b/grove/integration_test/tests/plugins/range_req_handler/test.sh index b013400..0926ded 100644 --- a/grove/integration_test/tests/plugins/range_req_handler/test.sh +++ b/grove/integration_test/tests/plugins/range_req_handler/test.sh @@ -41,7 +41,7 @@ done # multipart for host in "mem-test.cdn.kabletown.net" "disk-test.cdn.kabletown.net" do - for r in "0-0" "0-100" "5000-" "-100" "0-0,10-15" "0-100,200-210" "33-99,101-188" "8-10,9-15,100-200" "0-300,200-250" "-33,66-99,50-150" "500-,300-304" + for r in "0-0" "0-100" "5000-" "-100" "0-0,10-15" "0-100,200-210" "33-99,101-188" "8-10,9-15,100-200" "0-300,200-250" "-33,66-99,50-150" "300-304,500-,600-700" do test="${CMP_TOOL} --chdrs \"Host:$host Range:bytes=${r}\" --ohdrs \"Range:bytes=${r}\" --path \"10Mb.txt\" --ignorehdrs \"Server,Date\" --ignorempb" testno=$(($testno+1)) @@ -53,6 +53,6 @@ do done done -echo "$testno tests done, $result failed." +echo "plugin/range_req_handler: $testno tests done, $result failed." exit $result -- To stop receiving notification emails like this one, please contact r...@apache.org.