This is an automated email from the ASF dual-hosted git repository.

paziz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new b4dd48b  Redirect test for ATS
b4dd48b is described below

commit b4dd48b7464a1da0d93ed7303f68df98eb21b461
Author: Jesse Zhang <macisasandw...@gmail.com>
AuthorDate: Thu Aug 17 13:07:36 2017 -0500

    Redirect test for ATS
    
    
    Updated header and fixed ATS version check
    
    Fixed age field to match all
    Added more `` to HTTP header fields in the gold file
    Rewrote the test to use internal uServer
    Redirect test for ATS
    Updated header and fixed ATS version check
    Fixed age field to match all
    Added more `` to HTTP header fields in the gold file
    Rewrote the test to use internal uServer
---
 tests/gold_tests/redirect/gold/redirect.gold |  5 +++
 tests/gold_tests/redirect/redirect.test.py   | 63 ++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)

diff --git a/tests/gold_tests/redirect/gold/redirect.gold 
b/tests/gold_tests/redirect/gold/redirect.gold
new file mode 100644
index 0000000..3738278
--- /dev/null
+++ b/tests/gold_tests/redirect/gold/redirect.gold
@@ -0,0 +1,5 @@
+HTTP/1.1 204 No Content
+Date: ``
+Age: ``
+Connection: keep-alive
+Server: ATS/``
diff --git a/tests/gold_tests/redirect/redirect.test.py 
b/tests/gold_tests/redirect/redirect.test.py
new file mode 100644
index 0000000..db21599
--- /dev/null
+++ b/tests/gold_tests/redirect/redirect.test.py
@@ -0,0 +1,63 @@
+'''
+'''
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you 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.
+
+import os 
+Test.Summary = '''
+Test basic redirection
+'''
+
+# TODO figure out how to use this
+MAX_REDIRECT = 99
+
+Test.SkipUnless(
+       Condition.HasProgram("curl", "Curl need to be installed on system for 
this test to work")
+)
+
+Test.ContinueOnFail = True
+
+ts = Test.MakeATSProcess("ts")
+redirect_serv = Test.MakeOriginServer("re_server")
+dest_serv = Test.MakeOriginServer("dest_server")
+
+ts.Disk.records_config.update({
+       'proxy.config.http.redirection_enabled': 1,
+       'proxy.config.http.number_of_redirections': MAX_REDIRECT,
+       'proxy.config.http.cache.http': 0#,
+       # 'proxy.config.diags.debug.enabled': 1
+})
+
+redirect_request_header={"headers": "GET /redirect HTTP/1.1\r\nHost: 
*\r\n\r\n", "timestamp": "5678", "body": ""}
+redirect_response_header={"headers": "HTTP/1.1 302 Found\r\nLocation: 
http://127.0.0.1:{0}/redirectDest\r\n\r\n".format(dest_serv.Variables.Port), 
"timestamp": "5678", "body": ""}
+dest_request_header={"headers": "GET /redirectDest HTTP/1.1\r\nHost: 
*\r\n\r\n", "timestamp": "11", "body": ""}
+dest_response_header={"headers": "HTTP/1.1 204 No Content\r\n\r\n", 
"timestamp": "22", "body": ""}
+
+redirect_serv.addResponse("sessionfile.log", redirect_request_header, 
redirect_response_header)
+dest_serv.addResponse("sessionfile.log", dest_request_header, 
dest_response_header)
+
+ts.Disk.remap_config.AddLine(
+       'map http://127.0.0.1:{0} 
http://127.0.0.1:{1}'.format(ts.Variables.port, redirect_serv.Variables.Port)
+)
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl -i 
http://127.0.0.1:{0}/redirect'.format(ts.Variables.port)
+tr.Processes.Default.StartBefore(ts)
+tr.Processes.Default.StartBefore(redirect_serv)
+tr.Processes.Default.StartBefore(dest_serv)
+tr.Processes.Default.Streams.stdout = "gold/redirect.gold"
+tr.Processes.Default.ReturnCode = 0
+

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Reply via email to