You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2020/06/23 20:04:10 UTC

[trafficserver] 02/03: Make compress Au test less flakey. (#6915)

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

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

commit acb03919ffffb697afb81a73fe9319bfa79da175
Author: Walt Karas <wk...@verizonmedia.com>
AuthorDate: Mon Jun 22 17:51:23 2020 -0500

    Make compress Au test less flakey. (#6915)
    
    (cherry picked from commit 74366b963fd18e97d80e9c91681fe232678d6faf)
---
 tests/gold_tests/pluginTest/compress/compress.gold | 42 +++++++++++-----------
 .../pluginTest/compress/compress.test.py           | 11 ++++--
 tests/gold_tests/pluginTest/compress/greplog.sh    |  2 +-
 3 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/tests/gold_tests/pluginTest/compress/compress.gold b/tests/gold_tests/pluginTest/compress/compress.gold
index ff02ed6..05c8eb5 100644
--- a/tests/gold_tests/pluginTest/compress/compress.gold
+++ b/tests/gold_tests/pluginTest/compress/compress.gold
@@ -6,7 +6,7 @@
 < Content-Encoding: br
 < Vary: Accept-Encoding
 < Content-Length: 46
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip
 > Accept-Encoding: gzip
@@ -15,7 +15,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/br
 > Accept-Encoding: br
@@ -24,14 +24,14 @@
 < Content-Encoding: br
 < Vary: Accept-Encoding
 < Content-Length: 46
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/deflate
 > Accept-Encoding: deflate
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
-
+===
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: 1/gzip, deflate, sdch, br
 > Accept-Encoding: gzip, deflate, sdch, br
@@ -40,7 +40,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: 1/gzip
 > Accept-Encoding: gzip
@@ -49,21 +49,21 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: 1/br
 > Accept-Encoding: br
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
-
+===
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: 1/deflate
 > Accept-Encoding: deflate
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
-
+===
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: 2/gzip, deflate, sdch, br
 > Accept-Encoding: gzip, deflate, sdch, br
@@ -72,7 +72,7 @@
 < Content-Encoding: br
 < Vary: Accept-Encoding
 < Content-Length: 46
-
+===
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: 2/gzip
 > Accept-Encoding: gzip
@@ -81,7 +81,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: 2/br
 > Accept-Encoding: br
@@ -90,14 +90,14 @@
 < Content-Encoding: br
 < Vary: Accept-Encoding
 < Content-Length: 46
-
+===
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: 2/deflate
 > Accept-Encoding: deflate
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip;q=0.666
 > Accept-Encoding: gzip;q=0.666
@@ -106,7 +106,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip;q=0.666x
 > Accept-Encoding: gzip;q=0.666x
@@ -115,7 +115,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip;q=#0.666
 > Accept-Encoding: gzip;q=#0.666
@@ -124,7 +124,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip; Q = 0.666
 > Accept-Encoding: gzip; Q = 0.666
@@ -133,14 +133,14 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip;q=0.0
 > Accept-Encoding: gzip;q=0.0
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip;q=-0.1
 > Accept-Encoding: gzip;q=-0.1
@@ -149,7 +149,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/aaa, gzip;q=0.666, bbb
 > Accept-Encoding: aaa, gzip;q=0.666, bbb
@@ -158,7 +158,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/ br ; q=0.666, bbb
 > Accept-Encoding:  br ; q=0.666, bbb
@@ -167,7 +167,7 @@
 < Content-Encoding: br
 < Vary: Accept-Encoding
 < Content-Length: 46
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/aaa, gzip;q=0.666 , 
 > Accept-Encoding: aaa, gzip;q=0.666 , 
@@ -176,4 +176,4 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
diff --git a/tests/gold_tests/pluginTest/compress/compress.test.py b/tests/gold_tests/pluginTest/compress/compress.test.py
index f93ce3d..30f62e8 100644
--- a/tests/gold_tests/pluginTest/compress/compress.test.py
+++ b/tests/gold_tests/pluginTest/compress/compress.test.py
@@ -66,7 +66,7 @@ def curl(ts, idx, encodingList):
         "curl --verbose --proxy http://127.0.0.1:{}".format(ts.Variables.port) +
         " --header 'X-Ats-Compress-Test: {}/{}'".format(idx, encodingList) +
         " --header 'Accept-Encoding: {0}' 'http://ae-{1}/obj{1}'".format(encodingList, idx) +
-        " >> {0}/compress_long.log 2>&1 ; printf '\n\n' >> {0}/compress_long.log".format(Test.RunDirectory)
+        " 2>> compress_long.log ; printf '\n===\n' >> compress_long.log"
     )
 
 waitForServer = True
@@ -159,11 +159,16 @@ tr = Test.AddTestRun()
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Command = curl(ts, 0, "aaa, gzip;q=0.666 , ")
 
+# compress_long.log contains all the output from the curl commands.  The tr removes the carriage returns for easier
+# readability.  Curl seems to have a bug, where it will neglect to output an end of line before outputing an HTTP
+# message header line.  The sed command is a work-around for this problem.  greplog.sh uses the grep command to
+# select HTTP request/response line that should be consitent every time the test runs.
+#
 tr = Test.AddTestRun()
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Command = (
-    r"tr -d '\r' < {1}/compress_long.log | sed 's/\(..*\)\([<>]\)/\1\n\2/' | {0}/greplog.sh > {1}/compress_short.log"
-).format(Test.TestDirectory, Test.RunDirectory)
+    r"tr -d '\r' < compress_long.log | sed 's/\(..*\)\([<>]\)/\1\n\2/' | {0}/greplog.sh > compress_short.log"
+).format(Test.TestDirectory)
 f = tr.Disk.File("compress_short.log")
 f.Content = "compress.gold"
 
diff --git a/tests/gold_tests/pluginTest/compress/greplog.sh b/tests/gold_tests/pluginTest/compress/greplog.sh
index b16fa48..5148beb 100755
--- a/tests/gold_tests/pluginTest/compress/greplog.sh
+++ b/tests/gold_tests/pluginTest/compress/greplog.sh
@@ -20,4 +20,4 @@ grep --text \
  -e '^> Accept-Encoding:' \
  -e '^< Content-' \
  -e '^< Vary:' \
- -e '^$'
+ -e '^===$'