You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2017/11/18 04:42:41 UTC

[trafficserver] branch master updated: add autest for post redirection

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

bcall 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 4b5218f  add autest for post redirection
4b5218f is described below

commit 4b5218f24f9246ead771bdaed6d52434c36a55f1
Author: scw00 <sc...@apache.org>
AuthorDate: Sun Nov 12 16:26:29 2017 +0800

    add autest for post redirection
---
 tests/gold_tests/redirect/redirect_post.test.py | 72 +++++++++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/tests/gold_tests/redirect/redirect_post.test.py b/tests/gold_tests/redirect/redirect_post.test.py
new file mode 100644
index 0000000..e631afd
--- /dev/null
+++ b/tests/gold_tests/redirect/redirect_post.test.py
@@ -0,0 +1,72 @@
+'''
+'''
+#  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 post 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_serv1 = Test.MakeOriginServer("re_server1")
+redirect_serv2 = Test.MakeOriginServer("re_server2")
+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.post_copy_size' : 919430601,
+    'proxy.config.http.cache.http': 0  # ,
+    # 'proxy.config.diags.debug.enabled': 1
+})
+
+redirect_request_header = {"headers": "POST /redirect1 HTTP/1.1\r\nHost: *\r\nContent-Length: 52428800\r\n\r\n", "timestamp": "5678", "body": ""}
+redirect_response_header = {"headers": "HTTP/1.1 302 Found\r\nLocation: http://127.0.0.1:{0}/redirect2\r\n\r\n".format(
+    redirect_serv2.Variables.Port), "timestamp": "5678", "body": ""}
+
+redirect_request_header2 = {"headers": "POST /redirect2 HTTP/1.1\r\nHost: *\r\nContent-Length: 52428800\r\n\r\n", "timestamp": "5678", "body": ""}
+redirect_response_header2 = {"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": "POST /redirectDest HTTP/1.1\r\nHost: *\r\nContent-Length: 52428800\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_serv1.addResponse("sessionfile.log", redirect_request_header, redirect_response_header)
+redirect_serv2.addResponse("sessionfile.log", redirect_request_header2, redirect_response_header2)
+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_serv1.Variables.Port)
+)
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'touch largefile.txt && truncate largefile.txt -s 50M && curl -i http://127.0.0.1:{0}/redirect1 -F "filename=@./largefile.txt" && rm -f largefile.txt'.format(ts.Variables.port)
+tr.Processes.Default.StartBefore(ts)
+tr.Processes.Default.StartBefore(redirect_serv1)
+tr.Processes.Default.StartBefore(redirect_serv2)
+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" <co...@trafficserver.apache.org>'].