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/02 22:22:08 UTC

[trafficserver] branch 9.0.x updated: cache_range_request: Overhaul and clean up the core autest.

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new d753abd  cache_range_request: Overhaul and clean up the core autest.
d753abd is described below

commit d753abddeebdffcf2c5ef55f69827267ea7ae173
Author: Brian Olsen <br...@comcast.com>
AuthorDate: Tue Apr 21 20:29:24 2020 +0000

    cache_range_request: Overhaul and clean up the core autest.
    
    (cherry picked from commit fe8d935e1974ee436be152aa96ee9d04aa8be4f0)
---
 .../cache_range_requests.test.py                   | 26 ++++++++++------------
 .../cache_range_requests/gold/404.stdout.gold      |  8 -------
 .../cache_range_requests/gold/frange.stderr.gold   |  1 -
 .../cache_range_requests/gold/frange.stdout.gold   | 10 ---------
 .../cache_range_requests/gold/full.stderr.gold     |  2 +-
 .../cache_range_requests/gold/full.stdout.gold     |  8 -------
 .../cache_range_requests/gold/inner.stderr.gold    |  2 +-
 .../cache_range_requests/gold/inner.stdout.gold    | 10 ---------
 .../cache_range_requests/gold/last.stderr.gold     |  2 +-
 .../cache_range_requests/gold/last.stdout.gold     | 10 ---------
 .../cache_range_requests/gold/pselect.stdout.gold  | 10 ---------
 .../gold/pselect_none.stdout.gold                  |  9 --------
 12 files changed, 15 insertions(+), 83 deletions(-)

diff --git a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py
index 5806f14..f1e34a6 100644
--- a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py
+++ b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py
@@ -242,7 +242,6 @@ ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
 ps.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.port))
 ps.Command = curl_and_args + ' http://www.example.com/path -H "uuid: full"'
 ps.ReturnCode = 0
-ps.Streams.stdout = "gold/full.stdout.gold"
 ps.Streams.stderr = "gold/full.stderr.gold"
 tr.StillRunningAfter = ts
 
@@ -252,9 +251,9 @@ tr = Test.AddTestRun("inner range cache miss")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/path -r {} -H "uuid: inner"'.format(inner_str)
 ps.ReturnCode = 0
-#ps.Streams.stdout = "gold/inner.stdout.gold"
 ps.Streams.stderr = "gold/inner.stderr.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss")
+ps.Streams.stdout.Content += Testers.ContainsExpression("Content-Range: bytes 7-15/18", "expected content-range header")
 tr.StillRunningAfter = ts
 
 # 2 Test - Fetch from cache
@@ -262,9 +261,9 @@ tr = Test.AddTestRun("inner range cache hit")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/path -r {}'.format(inner_str)
 ps.ReturnCode = 0
-#ps.Streams.stdout = "gold/inner.stdout.gold"
 ps.Streams.stderr = "gold/inner.stderr.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit", "expected cache hit")
+ps.Streams.stdout.Content += Testers.ContainsExpression("Content-Range: bytes 7-15/18", "expected content-range header")
 tr.StillRunningAfter = ts
 
 # full range
@@ -274,9 +273,9 @@ tr = Test.AddTestRun("0- request miss")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/path -r {} -H "uuid: frange"'.format(frange_str)
 ps.ReturnCode = 0
-#ps.Streams.stdout = "gold/frange.stdout.gold"
-ps.Streams.stderr = "gold/frange.stderr.gold"
+ps.Streams.stderr = "gold/full.stderr.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss")
+ps.Streams.stdout.Content += Testers.ContainsExpression("Content-Range: bytes 0-18/18", "expected content-range header")
 tr.StillRunningAfter = ts
 
 # 4 Test - 0- request
@@ -284,9 +283,9 @@ tr = Test.AddTestRun("0- request hit")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/path -r {}'.format(frange_str)
 ps.ReturnCode = 0
-#ps.Streams.stdout = "gold/frange.stdout.gold"
-ps.Streams.stderr = "gold/frange.stderr.gold"
+ps.Streams.stderr = "gold/full.stderr.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit", "expected cache hit")
+ps.Streams.stdout.Content += Testers.ContainsExpression("Content-Range: bytes 0-18/18", "expected content-range header")
 tr.StillRunningAfter = ts
 
 # end range
@@ -296,9 +295,9 @@ tr = Test.AddTestRun("-5 request miss")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/path -r {} -H "uuid: last"'.format(last_str)
 ps.ReturnCode = 0
-#ps.Streams.stdout = "gold/last.stdout.gold"
 ps.Streams.stderr = "gold/last.stderr.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss")
+ps.Streams.stdout.Content += Testers.ContainsExpression("Content-Range: bytes 13-18/18", "expected content-range header")
 tr.StillRunningAfter = ts
 
 # 6 Test - -5 request hit
@@ -306,9 +305,9 @@ tr = Test.AddTestRun("-5 request hit")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/path -r {}'.format(last_str)
 ps.ReturnCode = 0
-#ps.Streams.stdout = "gold/last.stdout.gold"
 ps.Streams.stderr = "gold/last.stderr.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit", "expected cache hit")
+ps.Streams.stdout.Content += Testers.ContainsExpression("Content-Range: bytes 13-18/18", "expected content-range header")
 tr.StillRunningAfter = ts
 
 # Ensure 404's aren't getting cached
@@ -325,8 +324,9 @@ tr.StillRunningAfter = ts
 tr = Test.AddTestRun("404 request 2nd")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/404 -r 0-'
-ps.Streams.stdout = "gold/404.stdout.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", "expected cache miss")
+ps.Streams.stdout.Content += Testers.ContainsExpression("404 Not Found", "expected 404 response")
+
 tr.StillRunningAfter = ts
 
 curl_and_args = 'curl -s -D /dev/stdout -o /dev/stderr -x localhost:{} -H "x-debug: x-parentselection-key"'.format(ts.Variables.port)
@@ -336,7 +336,6 @@ tr = Test.AddTestRun("cache_key_url request")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://parentselect/path -r {} -H "uuid: pselect"'.format(pselect_str)
 ps.ReturnCode = 0
-ps.Streams.stdout = "gold/pselect.stdout.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression(
   "X-ParentSelection-Key: .*-bytes=",
   "expected bytes in parent selection key",
@@ -344,12 +343,12 @@ ps.Streams.stdout.Content = Testers.ContainsExpression(
 tr.StillRunningAfter = ts
 tr.StillRunningAfter = server
 
-# 10 Test - non cache_key_url request ... no X-ParentSelectionKey
+# 10 Test - non cache_key_url request ... no X-ParentSelection-Key
 tr = Test.AddTestRun("non cache_key_url request")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/path -r {} -H "uuid: inner"'.format(inner_str)
 ps.ReturnCode = 0
-ps.Streams.stdout = "gold/pselect_none.stdout.gold"
+ps.Streams.stdout.Content = Testers.ExcludesExpression("X-ParentSelection-Key",  "parent select key shouldn't show up")
 tr.StillRunningAfter = ts
 tr.StillRunningAfter = server
 
@@ -358,7 +357,6 @@ tr = Test.AddTestRun("cache_key_url request - dprecated")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://psd/path -r {} -H "uuid: pselect"'.format(pselect_str)
 ps.ReturnCode = 0
-ps.Streams.stdout = "gold/pselect.stdout.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression(
   "X-ParentSelection-Key: .*-bytes=",
   "expected bytes in parent selection key",
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/gold/404.stdout.gold b/tests/gold_tests/pluginTest/cache_range_requests/gold/404.stdout.gold
deleted file mode 100644
index f188050..0000000
--- a/tests/gold_tests/pluginTest/cache_range_requests/gold/404.stdout.gold
+++ /dev/null
@@ -1,8 +0,0 @@
-HTTP/1.1 404 Not Found
-Server: ``
-Date: ``
-Age: 0
-Transfer-Encoding: chunked
-Proxy-Connection: ``
-X-Cache: miss
-``
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/gold/frange.stderr.gold b/tests/gold_tests/pluginTest/cache_range_requests/gold/frange.stderr.gold
deleted file mode 100644
index 24ad29c..0000000
--- a/tests/gold_tests/pluginTest/cache_range_requests/gold/frange.stderr.gold
+++ /dev/null
@@ -1 +0,0 @@
-lets go surfin now``
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/gold/frange.stdout.gold b/tests/gold_tests/pluginTest/cache_range_requests/gold/frange.stdout.gold
deleted file mode 100644
index 39a960b..0000000
--- a/tests/gold_tests/pluginTest/cache_range_requests/gold/frange.stdout.gold
+++ /dev/null
@@ -1,10 +0,0 @@
-HTTP/1.1 206 Partial Content
-Accept-Ranges: bytes
-Cache-Control: max-age=500
-Content-Range: bytes 0-18/18
-Etag: "path"
-Content-Length: 18
-Date: ``
-Server: ``
-X-Cache: ``
-``
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/gold/full.stderr.gold b/tests/gold_tests/pluginTest/cache_range_requests/gold/full.stderr.gold
index 24ad29c..c247522 100644
--- a/tests/gold_tests/pluginTest/cache_range_requests/gold/full.stderr.gold
+++ b/tests/gold_tests/pluginTest/cache_range_requests/gold/full.stderr.gold
@@ -1 +1 @@
-lets go surfin now``
+lets go surfin now
\ No newline at end of file
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/gold/full.stdout.gold b/tests/gold_tests/pluginTest/cache_range_requests/gold/full.stdout.gold
deleted file mode 100644
index f4f8fe5..0000000
--- a/tests/gold_tests/pluginTest/cache_range_requests/gold/full.stdout.gold
+++ /dev/null
@@ -1,8 +0,0 @@
-HTTP/1.1 200 OK
-Cache-Control: max-age=500
-Etag: "path"
-Content-Length: 18
-Date: ``
-Server: ``
-X-Cache: miss
-``
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/gold/inner.stderr.gold b/tests/gold_tests/pluginTest/cache_range_requests/gold/inner.stderr.gold
index 1b0ef57..90be4bf 100644
--- a/tests/gold_tests/pluginTest/cache_range_requests/gold/inner.stderr.gold
+++ b/tests/gold_tests/pluginTest/cache_range_requests/gold/inner.stderr.gold
@@ -1 +1 @@
- surfin``
+ surfin 
\ No newline at end of file
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/gold/inner.stdout.gold b/tests/gold_tests/pluginTest/cache_range_requests/gold/inner.stdout.gold
deleted file mode 100644
index dbf15ce..0000000
--- a/tests/gold_tests/pluginTest/cache_range_requests/gold/inner.stdout.gold
+++ /dev/null
@@ -1,10 +0,0 @@
-HTTP/1.1 206 Partial Content
-Accept-Ranges: bytes
-Cache-Control: max-age=500
-Content-Range: bytes 7-15/18
-Etag: "path"
-Content-Length: 7
-Date: ``
-Server: ``
-X-Cache: ``
-``
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/gold/last.stderr.gold b/tests/gold_tests/pluginTest/cache_range_requests/gold/last.stderr.gold
index 9e4c8c4..836a80c 100644
--- a/tests/gold_tests/pluginTest/cache_range_requests/gold/last.stderr.gold
+++ b/tests/gold_tests/pluginTest/cache_range_requests/gold/last.stderr.gold
@@ -1 +1 @@
-n now``
+n now
\ No newline at end of file
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/gold/last.stdout.gold b/tests/gold_tests/pluginTest/cache_range_requests/gold/last.stdout.gold
deleted file mode 100644
index b71a2c9..0000000
--- a/tests/gold_tests/pluginTest/cache_range_requests/gold/last.stdout.gold
+++ /dev/null
@@ -1,10 +0,0 @@
-HTTP/1.1 206 Partial Content
-Accept-Ranges: bytes
-Cache-Control: max-age=500
-Content-Range: bytes 12-18/18
-Etag: "path"
-Content-Length: 5
-Date: ``
-Server: ``
-X-Cache: ``
-``
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/gold/pselect.stdout.gold b/tests/gold_tests/pluginTest/cache_range_requests/gold/pselect.stdout.gold
deleted file mode 100644
index 6b2ecc5..0000000
--- a/tests/gold_tests/pluginTest/cache_range_requests/gold/pselect.stdout.gold
+++ /dev/null
@@ -1,10 +0,0 @@
-HTTP/1.1 206 Partial Content
-Accept-Ranges: bytes
-Cache-Control: max-age=500
-Content-Range: bytes 1-10/18
-Etag: "path"
-Content-Length: 9
-Date: ``
-Server: ``
-X-ParentSelection: ``
-``
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/gold/pselect_none.stdout.gold b/tests/gold_tests/pluginTest/cache_range_requests/gold/pselect_none.stdout.gold
deleted file mode 100644
index 510cf02..0000000
--- a/tests/gold_tests/pluginTest/cache_range_requests/gold/pselect_none.stdout.gold
+++ /dev/null
@@ -1,9 +0,0 @@
-HTTP/1.1 206 Partial Content
-Accept-Ranges: bytes
-Cache-Control: ``
-Content-Range: ``
-Etag: ``
-Content-Length: ``
-Date: ``
-Server: ``
-``