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

bcall pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new f3f7ce7  Add extension ip.test.ext to Au Test, with Test method to 
allocate extra TCP ports.
f3f7ce7 is described below

commit f3f7ce72c9b16e57608aeefe6ce8e3901e02d0db
Author: Walter Karas <wka...@verizonmedia.com>
AuthorDate: Mon Dec 23 18:58:57 2019 -0600

    Add extension ip.test.ext to Au Test, with Test method to allocate extra 
TCP ports.
    
    And change the chunked_encoding_h2 Au test to use this capability.
    
    (cherry picked from commit f8a8b2f770bdc92f095f1a8a74cd591e9d37a4d0)
---
 .../case1.sh => autest-site/ip.test.ext}           | 24 +++++++++++++++++++---
 tests/gold_tests/chunked_encoding/case1.sh         |  2 +-
 tests/gold_tests/chunked_encoding/case2.sh         |  2 +-
 tests/gold_tests/chunked_encoding/case3.sh         |  2 +-
 .../chunked_encoding/chunked_encoding_h2.test.py   | 12 ++++++-----
 5 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/tests/gold_tests/chunked_encoding/case1.sh 
b/tests/gold_tests/autest-site/ip.test.ext
old mode 100644
new mode 100755
similarity index 51%
copy from tests/gold_tests/chunked_encoding/case1.sh
copy to tests/gold_tests/autest-site/ip.test.ext
index fff931f..cc951cf
--- a/tests/gold_tests/chunked_encoding/case1.sh
+++ b/tests/gold_tests/autest-site/ip.test.ext
@@ -1,3 +1,6 @@
+'''
+Extend Autest with IP-related utilities.
+'''
 #  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
@@ -14,6 +17,21 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-nc -l 8888 -o outserver1 -c "sh ./delay-server.sh" &
-sleep 1
-nghttp -vv https://127.0.0.1:${1}/delay-chunked-response
+
+from ports import get_port
+
+# this forms is for the global process define
+
+# New member function for Test object, that reserves TCP port(s) from the list 
of available TCP ports, for
+# use in the test.  Each argument is a string, containing the name of a 
variable to add to Test.Variables .
+# For each argument, a port will be reserved, and its number will be assigned 
to the new variable for the
+# argument.
+#
+def get_tcp_port(obj, *newVariables):
+    for v in newVariables:
+        if not isinstance(v, str):
+            raise TypeError("all function arguments must be strings")
+        get_port(obj, v)
+
+#AddTestEntityMember(get_tcp_port, name="GetTcpPort")
+ExtendTest(get_tcp_port, name="GetTcpPort")
diff --git a/tests/gold_tests/chunked_encoding/case1.sh 
b/tests/gold_tests/chunked_encoding/case1.sh
index fff931f..4262283 100644
--- a/tests/gold_tests/chunked_encoding/case1.sh
+++ b/tests/gold_tests/chunked_encoding/case1.sh
@@ -14,6 +14,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-nc -l 8888 -o outserver1 -c "sh ./delay-server.sh" &
+nc -l ${2} -o outserver1 -c "sh ./delay-server.sh" &
 sleep 1
 nghttp -vv https://127.0.0.1:${1}/delay-chunked-response
diff --git a/tests/gold_tests/chunked_encoding/case2.sh 
b/tests/gold_tests/chunked_encoding/case2.sh
index 55a9c11..be4d76f 100644
--- a/tests/gold_tests/chunked_encoding/case2.sh
+++ b/tests/gold_tests/chunked_encoding/case2.sh
@@ -14,6 +14,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-nc -l 8888 -o outserver2 -c "sh ./server2.sh" &
+nc -l ${2} -o outserver2 -c "sh ./server2.sh" &
 sleep 1
 curl --http2 -k https://127.0.0.1:${1}/post --verbose -H "Transfer-encoding: 
chunked" -d "Knock knock"
diff --git a/tests/gold_tests/chunked_encoding/case3.sh 
b/tests/gold_tests/chunked_encoding/case3.sh
index 6ed3b3c..4af2d92 100644
--- a/tests/gold_tests/chunked_encoding/case3.sh
+++ b/tests/gold_tests/chunked_encoding/case3.sh
@@ -14,6 +14,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-nc -l 8888 -o outserver3 -c "sh ./server3.sh" &
+nc -l ${2} -o outserver3 -c "sh ./server3.sh" &
 sleep 1
 curl --http2 -k https://127.0.0.1:${1}/post-chunked --verbose -H 
"Transfer-encoding: chunked" -d "Knock knock"
diff --git a/tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py 
b/tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py
index 75d8a79..d5022c0 100644
--- a/tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py
+++ b/tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py
@@ -27,6 +27,8 @@ Test.SkipUnless(
 )
 Test.ContinueOnFail = True
 
+Test.GetTcpPort("upstream_port")
+
 # Define default ATS
 ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
 
@@ -44,10 +46,10 @@ ts.Disk.records_config.update({
 })
 
 ts.Disk.remap_config.AddLine(
-    'map /delay-chunked-response http://127.0.0.1:8888'
+    'map /delay-chunked-response 
http://127.0.0.1:{0}'.format(Test.Variables.upstream_port)
 )
 ts.Disk.remap_config.AddLine(
-    'map / http://127.0.0.1:8888'
+    'map / http://127.0.0.1:{0}'.format(Test.Variables.upstream_port)
 )
 
 ts.Disk.ssl_multicert_config.AddLine(
@@ -65,7 +67,7 @@ server1_out = Test.Disk.File("outserver1")
 tr = Test.AddTestRun()
 tr.Setup.Copy('delay-server.sh')
 tr.Setup.Copy('case1.sh')
-tr.Processes.Default.Command = 'sh ./case1.sh 
{0}'.format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = 'sh ./case1.sh {0} 
{1}'.format(ts.Variables.ssl_port, Test.Variables.upstream_port)
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.StartBefore(Test.Processes.ts)
 tr.Processes.Default.Streams.All = Testers.ExcludesExpression("RST_STREAM", 
"Delayed chunk close should not cause reset")
@@ -80,7 +82,7 @@ server2_out = Test.Disk.File("outserver2")
 tr = Test.AddTestRun()
 tr.Setup.Copy('server2.sh')
 tr.Setup.Copy('case2.sh')
-tr.Processes.Default.Command = 'sh ./case2.sh 
{0}'.format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = 'sh ./case2.sh {0} 
{1}'.format(ts.Variables.ssl_port, Test.Variables.upstream_port)
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/2 200", 
"Request should succeed")
 tr.Processes.Default.Streams.All += 
Testers.ContainsExpression("content-length:", "Response should include content 
length")
@@ -94,7 +96,7 @@ server3_out = Test.Disk.File("outserver3")
 tr = Test.AddTestRun()
 tr.Setup.Copy('server3.sh')
 tr.Setup.Copy('case3.sh')
-tr.Processes.Default.Command = 'sh ./case3.sh 
{0}'.format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = 'sh ./case3.sh {0} 
{1}'.format(ts.Variables.ssl_port, Test.Variables.upstream_port)
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/2 200", 
"Request should succeed")
 tr.Processes.Default.Streams.All += 
Testers.ExcludesExpression("content-length:", "Response should not include 
content length")

Reply via email to