This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 74fd2db Add redirect test
74fd2db is described below
commit 74fd2db421c484d4f54a8f3a19336da0eebdcafb
Author: Sebb <[email protected]>
AuthorDate: Sun Jun 10 11:24:56 2018 +0100
Add redirect test
---
tools/mirror_check.rb | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tools/mirror_check.rb b/tools/mirror_check.rb
index c5391fb..b73d669 100755
--- a/tools/mirror_check.rb
+++ b/tools/mirror_check.rb
@@ -38,6 +38,7 @@ E: footer must match /This directory contains meta-data for
the ASF mirroring sy
E: mirror-tests/ must exist
W: its files must not have content-encoding:
1mb.img.7z 1mb.img.bz2 1mb.img.tar.gz 1mb.img.tgz 1mb.img.zip
+W: zzz/mirror-tests/redirect-test/ should redirect to http://www.apache.org/
(302)
TODO - any more checks?
@@ -96,6 +97,21 @@ def getHTTPHdrs(url)
http.request(request)
end
+def check_redirect(base, page, expectedLocation, severity=:W, expectedStatus =
"302", log=true)
+ path = base + page
+ response = getHTTPHdrs(path)
+ if response.code != expectedStatus
+ test severity, "HTTP status #{response.code} for '#{path}'" unless
severity == nil
+ return nil
+ end
+ if response['location'] != expectedLocation
+ test severity, "HTTP location #{response['location']} for '#{path}' -
expected '#{expectedLocation}'" unless severity == nil
+ return nil
+ end
+ I "Fetched #{path} - redirected OK to #{response['location']}" if log
+ response
+end
+
def check_CT(base, page, severity=:E, expectedStatus = 200)
path = base + page
response = getHTTPHdrs(path)
@@ -280,6 +296,7 @@ def checkHTTP(base)
MIRRORTEST_FILES.each do |file|
check_CT(base, MIRRORTEST + file)
end
+ check_redirect(base, 'zzz/mirror-tests/redirect-test/xyz',
'http://www.apache.org/')
end
def init
--
To stop receiving notification emails like this one, please contact
[email protected].