Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions tests/gold_tests/pluginTest/compress/compress.gold
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 ,
Expand All @@ -176,4 +176,4 @@
< Content-Encoding: gzip
< Vary: Accept-Encoding
< Content-Length: 71

===
11 changes: 8 additions & 3 deletions tests/gold_tests/pluginTest/compress/compress.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -159,11 +159,16 @@ def curl(ts, idx, encodingList):
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"

Expand Down
2 changes: 1 addition & 1 deletion tests/gold_tests/pluginTest/compress/greplog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ grep --text \
-e '^> Accept-Encoding:' \
-e '^< Content-' \
-e '^< Vary:' \
-e '^$'
-e '^===$'