trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] 05/08: Remove use of netstat in tests
Date Mon, 12 Mar 2018 17:55:07 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit bebe771302b4c33f0ff8163016efb52d88d5011a
Author: Jason Kenny <dragon512@live.com>
AuthorDate: Thu Jan 4 17:18:18 2018 -0600

    Remove use of netstat in tests
    
    update autest to 1.4.2 as this has fix for portopen to be like netstat, but portable
    Add to traffic_layout the reporting of brotli as a feature
    update tests to test for brotli
    change test to use dynamic ports
    
    (cherry picked from commit 87a873cbd820634a75c4a6ccece1753d35660bde)
---
 tests/gold_tests/logging/ccid_ctid.test.py          | 13 ++-----------
 tests/gold_tests/pluginTest/url_sig/url_sig.test.py | 13 ++++---------
 2 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/tests/gold_tests/logging/ccid_ctid.test.py b/tests/gold_tests/logging/ccid_ctid.test.py
index 5236313..b990891 100644
--- a/tests/gold_tests/logging/ccid_ctid.test.py
+++ b/tests/gold_tests/logging/ccid_ctid.test.py
@@ -28,8 +28,7 @@ Test.SkipUnless(
         "curl", "Curl need to be installed on system for this test to work"),
     # Condition.IsPlatform("linux"), Don't see the need for this.
     Condition.HasATSFeature('TS_USE_TLS_ALPN'),
-    Condition.HasCurlFeature('http2'),
-    Condition.HasProgram("netstat", "netstat need to be installed on system for this test
to work")
+    Condition.HasCurlFeature('http2')
 )
 
 # Define default ATS.  "select_ports=False" needed because SSL port used.
@@ -70,17 +69,9 @@ log.ascii {
 }'''.split("\n")
 )
 
-# Ask the OS if the port is ready for connect()
-#
-
-
-def CheckPort(Port):
-    return lambda: 0 == subprocess.call('netstat --listen --tcp -n | grep -q :{}'.format(Port),
shell=True)
-
-
 tr = Test.AddTestRun()
 # Delay on readiness of ssl port
-tr.Processes.Default.StartBefore(Test.Processes.ts, ready=CheckPort(ts.Variables.ssl_port))
+tr.Processes.Default.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.ssl_port))
 #
 tr.Processes.Default.Command = 'curl "http://127.0.0.1:{0}" --verbose'.format(
     ts.Variables.port)
diff --git a/tests/gold_tests/pluginTest/url_sig/url_sig.test.py b/tests/gold_tests/pluginTest/url_sig/url_sig.test.py
index 78b0228..26d92d3 100644
--- a/tests/gold_tests/pluginTest/url_sig/url_sig.test.py
+++ b/tests/gold_tests/pluginTest/url_sig/url_sig.test.py
@@ -56,8 +56,8 @@ ts.Variables.ssl_port = 4443
 ts.Disk.records_config.update({
     # 'proxy.config.diags.debug.enabled': 1,
     # 'proxy.config.diags.debug.tags': 'http|url_sig',
-    'proxy.config.http.cache.http': 0, # Make sure each request is forwarded to the origin
server.
-    'proxy.config.proxy_name': 'Poxy_Proxy', # This will be the server name.
+    'proxy.config.http.cache.http': 0,  # Make sure each request is forwarded to the origin
server.
+    'proxy.config.proxy_name': 'Poxy_Proxy',  # This will be the server name.
     'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
     'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
     'proxy.config.http.server_ports': (
@@ -97,11 +97,6 @@ ts.Disk.remap_config.AddLine(
     ' @plugin=url_sig.so @pparam={}/url_sig.config @pparam=PristineUrl'.format(Test.TestDirectory)
 )
 
-# Ask the OS if the port is ready for connect()
-#
-def CheckPort(Port):
-    return lambda: 0 == subprocess.call('netstat --listen --tcp -n | grep -q :{}'.format(Port),
shell=True)
-
 # Validation failure tests.
 
 LogTee = " 2>&1 | tee -a {}/url_sig_long.log".format(Test.RunDirectory)
@@ -109,8 +104,8 @@ LogTee = " 2>&1 | tee -a {}/url_sig_long.log".format(Test.RunDirectory)
 # Bad client / MD5 / P=101 / URL pristine / URL altered.
 #
 tr = Test.AddTestRun()
-tr.Processes.Default.StartBefore(ts, ready=CheckPort(ts.Variables.ssl_port))
-tr.Processes.Default.StartBefore(server, ready=CheckPort(server.Variables.Port))
+tr.Processes.Default.StartBefore(ts, ready=When.PortOpen(ts.Variables.ssl_port))
+tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Command = (
     "curl --verbose --proxy http://127.0.0.1:{} 'http://seven.eight.nine/".format(ts.Variables.port)
+

-- 
To stop receiving notification emails like this one, please contact
zwoop@apache.org.

Mime
View raw message