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

dagit 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 8530210  Uses known port, not rfc6890 loopback ip
8530210 is described below

commit 8530210942f4b519e0597b34fb85d009bd800b5f
Author: Derek Dagit <der...@oath.com>
AuthorDate: Mon May 14 20:39:09 2018 +0000

    Uses known port, not rfc6890 loopback ip
    
    Some operating systems, like those derived from FreeBSD, will block for
    an unreasonable amount of time while attempting to connect to an IP
    address in the RFC6890 that is not the IPv4 loopback address 127.0.0.1.
    
    Instead of using another IP address in the 127./8 block, create a
    microserver instance, which will "reserve" a port from the ephemeral
    range. We can then have more certainty that nothing should accept a
    connection to this port if we use the standard loopback address.
---
 .../gold_tests/headers/general-connection-failure-502.gold | 14 +++++++-------
 .../headers/general-connection-failure-502.test.py         |  7 ++++---
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/tests/gold_tests/headers/general-connection-failure-502.gold 
b/tests/gold_tests/headers/general-connection-failure-502.gold
index a5e2732..4749e20 100644
--- a/tests/gold_tests/headers/general-connection-failure-502.gold
+++ b/tests/gold_tests/headers/general-connection-failure-502.gold
@@ -1,10 +1,10 @@
-HTTP/1.1 502 connect failed
-Connection: keep-alive
-Cache-Control: no-store
-Content-Type: text/html
-Content-Language: en
-Content-Length: 247
-
+HTTP/1.1 502 connect failed
+Connection: keep-alive
+Cache-Control: no-store
+Content-Type: text/html
+Content-Language: en
+Content-Length: 247
+
 <HTML>
 <HEAD>
 <TITLE>Could Not Connect</TITLE>
diff --git a/tests/gold_tests/headers/general-connection-failure-502.test.py 
b/tests/gold_tests/headers/general-connection-failure-502.test.py
index 4d785a8..7054ce9 100644
--- a/tests/gold_tests/headers/general-connection-failure-502.test.py
+++ b/tests/gold_tests/headers/general-connection-failure-502.test.py
@@ -25,10 +25,10 @@ Test response when connection to origin fails
 ts = Test.MakeATSProcess("ts")
 
 HOST = 'www.connectfail502.test'
-ARBITRARY_LOOPBACK_IP='127.220.59.101' # This should fail to connect.
+server = Test.MakeOriginServer("server", ssl=False) # Reserves a port across 
autest.
 
 ts.Disk.remap_config.AddLine(
-    'map http://{host} http://{ip}'.format(host=HOST, ip=ARBITRARY_LOOPBACK_IP)
+        'map http://{host} http://{ip}:{uport}'.format(host=HOST, 
ip='127.0.0.1', uport=server.Variables.Port)
 )
 
 Test.Setup.Copy(os.path.join(Test.Variables.AtsTestToolsDir, 'tcp_client.py'))
@@ -38,7 +38,8 @@ data_file.WriteOn("GET / HTTP/1.1\r\nHost: 
{host}\r\n\r\n".format(host=HOST))
 
 tr = Test.AddTestRun()
 tr.Processes.Default.StartBefore(Test.Processes.ts)
-tr.Processes.Default.Command = "python tcp_client.py 127.0.0.1 {0} {1} | egrep 
-v '^(Date: |Server: ATS/)'"\
+# Do not start the origin server: We wish to simulate connection refused while 
hopefully no one else uses this port.
+tr.Processes.Default.Command = "python tcp_client.py 127.0.0.1 {0} {1} | sed 
-e '/^Date: /d' -e '/^Server: ATS\//d'"\
         .format(ts.Variables.port, "www.connectfail502.test-get.txt")
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Streams.stdout = 'general-connection-failure-502.gold'

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

Reply via email to