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

shinrich 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 523f3c8  Address intermittent failures of all_headers Au test (see 
Issue # 5437).
523f3c8 is described below

commit 523f3c8cc2ca66aa675f79e67c5e49b2db4b9842
Author: Walter Karas <wka...@verizonmedia.com>
AuthorDate: Tue May 7 17:26:38 2019 -0500

    Address intermittent failures of all_headers Au test (see Issue # 5437).
    
    This change sorts the fields for each header, so that pseudo-random 
ordering will not cause the test to fail.
---
 tests/gold_tests/logging/all_headers.test.py       |  7 ++-
 tests/gold_tests/logging/all_headers_sanitizer.py  | 18 +++----
 tests/gold_tests/logging/all_headers_sanitizer.sh  | 25 +++++++++
 .../gold_tests/logging/gold/test_all_headers.gold  | 59 +++++++++++++++++++++-
 4 files changed, 96 insertions(+), 13 deletions(-)

diff --git a/tests/gold_tests/logging/all_headers.test.py 
b/tests/gold_tests/logging/all_headers.test.py
index 63ed7b9..758c519 100644
--- a/tests/gold_tests/logging/all_headers.test.py
+++ b/tests/gold_tests/logging/all_headers.test.py
@@ -43,7 +43,9 @@ response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: 
close\r\nCache-con
 server.addResponse("sessionlog.json", request_header, response_header)
 
 ts.Disk.records_config.update({
+    # Do not accept connections from clients until cache subsystem is 
operational.
     'proxy.config.http.wait_for_cache': 1,
+
     'proxy.config.diags.debug.enabled': 0,
     'proxy.config.diags.debug.tags': 'http|dns',
 })
@@ -58,7 +60,7 @@ ts.Disk.logging_yaml.AddLines(
     '''
 formats:
   - name: custom
-    format: " %<cqah> %<pssc> %<psah> %<ssah> %<pqah> %<cssah> " 
+    format: "%<cqah> ___FS___ %<pssc> ___FS___ %<psah> ___FS___ %<ssah> 
___FS___ %<pqah> ___FS___ %<cssah> ___FS___ END_TXN"
 logs:
   - filename: test_all_headers
     format: custom
@@ -101,8 +103,9 @@ tr.Processes.Default.ReturnCode = 0
 #
 tr = Test.AddTestRun()
 tr.DelayStart = 10
-tr.Processes.Default.Command = 'python {0} {3} < {1} > {2}'.format(
+tr.Processes.Default.Command = 'python {0} {4} < {2} | . {1} > {3}'.format(
     os.path.join(Test.TestDirectory, 'all_headers_sanitizer.py'),
+    os.path.join(Test.TestDirectory, 'all_headers_sanitizer.sh'),
     os.path.join(ts.Variables.LOGDIR, 'test_all_headers.log'),
     os.path.join(ts.Variables.LOGDIR, 'test_all_headers.log.san'),
     server.Variables.Port)
diff --git a/tests/gold_tests/logging/all_headers_sanitizer.py 
b/tests/gold_tests/logging/all_headers_sanitizer.py
index 0e798df..2206b5e 100644
--- a/tests/gold_tests/logging/all_headers_sanitizer.py
+++ b/tests/gold_tests/logging/all_headers_sanitizer.py
@@ -21,19 +21,19 @@ import sys
 import re
 
 rexl = []
-rexl.append((re.compile(r"\{\{Date\}\:\{[^}]*\}\}"), "__DATE__"))
-rexl.append((re.compile(r"\{\{Expires\}\:\{[^}]*\}\}"), "__EXPIRES__"))
-rexl.append((re.compile(r"\{\{Last-Modified\}\:\{[^}]*\}\}"), 
"__LAST_MODIFIED__"))
-rexl.append((re.compile(r"\{\{Server\}\:\{ATS/[0-9.]*\}\}"), "__ATS_SERVER__"))
-rexl.append((re.compile(r"\{\{Server\}\:\{ECS [^}]*\}\}"), "__ECS_SERVER__"))
-rexl.append((re.compile(r"\{\{Via\}\:\{[^}]*\}\}"), "__VIA__"))
-rexl.append((re.compile(r"\{\{Server\}\:\{ApacheTrafficServer/[0-9.]*\}\}"), 
"__ATS2_SERVER__"))
-rexl.append((re.compile(r"\{\{Age\}\:\{[0-9]*\}\}"), "__AGE__"))
+rexl.append((re.compile(r"\{\{Date\}\:\{[^}]*\}\}"), "({__DATE__}}"))
+rexl.append((re.compile(r"\{\{Expires\}\:\{[^}]*\}\}"), "({__EXPIRES__}}"))
+rexl.append((re.compile(r"\{\{Last-Modified\}\:\{[^}]*\}\}"), 
"({__LAST_MODIFIED__}}"))
+rexl.append((re.compile(r"\{\{Server\}\:\{ATS/[0-9.]*\}\}"), 
"({__ATS_SERVER__}}"))
+rexl.append((re.compile(r"\{\{Server\}\:\{ECS [^}]*\}\}"), 
"({__ECS_SERVER__}}"))
+rexl.append((re.compile(r"\{\{Via\}\:\{[^}]*\}\}"), "({__VIA__}}"))
+rexl.append((re.compile(r"\{\{Server\}\:\{ApacheTrafficServer/[0-9.]*\}\}"), 
"({__ATS2_SERVER__}}"))
+rexl.append((re.compile(r"\{\{Age\}\:\{[0-9]*\}\}"), "({__AGE__}}"))
 rexl.append((re.compile(r"\:" + sys.argv[1]), "__TS_PORT__")) # 1st and only 
argument is TS client port
 
 # Handle inconsistencies which I think are caused by different revisions of 
the standard Python http.server.HTTPServer class.
 
-rexl.append((re.compile(r'\{"359670651[^"]*"\}'), '{"359670651__WEIRD__"}'))
+rexl.append((re.compile(r'\{"359670651[^"]*"\}'), '{"{359670651__WEIRD__}"}'))
 rexl.append((re.compile(r'\{\{Accept-Ranges\}:\{bytes\}\}'), ''))
 
 for line in sys.stdin:
diff --git a/tests/gold_tests/logging/all_headers_sanitizer.sh 
b/tests/gold_tests/logging/all_headers_sanitizer.sh
new file mode 100644
index 0000000..e81251e
--- /dev/null
+++ b/tests/gold_tests/logging/all_headers_sanitizer.sh
@@ -0,0 +1,25 @@
+#  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.
+
+sed 's/ ___FS___ /\
+/g' | sed 's/^{//' | sed 's/}$//' | while read LN
+do
+    # For lines that contain a full set of messaage headers, get
+    # individual headers on separate lines, then sort the lines.
+    #
+    echo $LN | sed 's/}}/}}\
+/g' | sort
+done
diff --git a/tests/gold_tests/logging/gold/test_all_headers.gold 
b/tests/gold_tests/logging/gold/test_all_headers.gold
index 3cb54e5..300df41 100644
--- a/tests/gold_tests/logging/gold/test_all_headers.gold
+++ b/tests/gold_tests/logging/gold/test_all_headers.gold
@@ -1,4 +1,59 @@
- 
{{{Host}:{127.0.0.1__TS_PORT__}}{{User-Agent}:{007}}{{Accept}:{*/*}}{{x-header0}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}{{x-header1}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}{{x-header2}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghi
 [...]
 
- 
{{{Host}:{127.0.0.1__TS_PORT__}}{{User-Agent}:{007}}{{Accept}:{*/*}}{{x-header0}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}{{x-header1}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}{{x-header2}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghi
 [...]
+{{Accept}:{*/*}}
+{{Host}:{127.0.0.1__TS_PORT__}}
+{{User-Agent}:{007}}
+{{x-header0}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}
+{{x-header1}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}
+{{x-header2}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}
+200
+
+({__AGE__}}
+({__ATS_SERVER__}}
+({__DATE__}}
+{{Cache-Control}:{max-age=85000}}
+{{Connection}:{keep-alive}}
+{{Content-Length}:{3}}
+
+({__DATE__}}
+{{Cache-Control}:{max-age=85000}}
+{{Connection}:{close}}
+{{Content-Length}:{3}}
+
+({__VIA__}}
+{{Accept}:{*/*}}
+{{Client-ip}:{127.0.0.1}}
+{{Host}:{127.0.0.1__TS_PORT__}}
+{{User-Agent}:{007}}
+{{X-Forwarded-For}:{127.0.0.1}}
+{{x-header0}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}
+{{x-header1}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}
+{{x-header2}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}
+
+END_TXN
+
+
+{{Accept}:{*/*}}
+{{Host}:{127.0.0.1__TS_PORT__}}
+{{User-Agent}:{007}}
+{{x-header0}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}
+{{x-header1}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}
+{{x-header2}:{abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop}}
+200
+
+({__AGE__}}
+({__ATS_SERVER__}}
+({__DATE__}}
+{{Cache-Control}:{max-age=85000}}
+{{Connection}:{keep-alive}}
+{{Content-Length}:{3}}
+
+
+
+({__AGE__}}
+({__ATS_SERVER__}}
+({__DATE__}}
+{{Cache-Control}:{max-age=85000}}
+{{Connection}:{keep-alive}}
+{{Content-Length}:{3}}
+END_TXN
 

Reply via email to