REGTESTS: cache: Simplify vary.vtc file

This test used chunked responses but it is not needed. All the chunked
responses are replaced by more simple 'bodylen' directives.
This commit is contained in:
Remi Tricot-Le Breton 2020-12-23 18:13:50 +01:00 committed by Willy Tarreau
parent ce9e7b2521
commit b054b6dec6

View File

@ -8,113 +8,95 @@ server s1 {
# Response varying on "accept-encoding" # Response varying on "accept-encoding"
rxreq rxreq
expect req.url == "/accept-encoding" expect req.url == "/accept-encoding"
txresp -nolen -hdr "Transfer-Encoding: chunked" \ txresp -hdr "Content-Encoding: gzip" \
-hdr "Content-Type: gzip" \
-hdr "Vary: accept-encoding" \ -hdr "Vary: accept-encoding" \
-hdr "Cache-Control: max-age=5" -hdr "Cache-Control: max-age=5" \
chunkedlen 15 -bodylen 45
chunkedlen 15
chunkedlen 15
chunkedlen 0
# Response varying on "accept-encoding" # Response varying on "accept-encoding"
rxreq rxreq
expect req.url == "/accept-encoding" expect req.url == "/accept-encoding"
txresp -nolen -hdr "Transfer-Encoding: chunked" \ txresp -hdr "Content-Type: text/plain" \
-hdr "Content-Type: text/plain" \
-hdr "Vary: accept-encoding" \ -hdr "Vary: accept-encoding" \
-hdr "Cache-Control: max-age=5" -hdr "Cache-Control: max-age=5" \
chunkedlen 16 -bodylen 48
chunkedlen 16
chunkedlen 16
chunkedlen 0
# Response varying on "accept-encoding" but having two different encodings # Response varying on "accept-encoding" but having two different encodings
rxreq rxreq
expect req.url == "/accept-encoding-multiple" expect req.url == "/accept-encoding-multiple"
txresp -nolen -hdr "Transfer-Encoding: chunked" \ txresp -hdr "Vary: accept-encoding" \
-hdr "Vary: accept-encoding" \ -hdr "Cache-Control: max-age=5" \
-hdr "Cache-Control: max-age=5" -bodylen 51
chunkedlen 17
chunkedlen 17
chunkedlen 17
chunkedlen 0
# Unmanaged vary # Unmanaged vary
rxreq rxreq
expect req.url == "/unmanaged" expect req.url == "/unmanaged"
txresp -nolen -hdr "Transfer-Encoding: chunked" \ txresp -hdr "Vary: accept-encoding,unmanaged" \
-hdr "Vary: accept-encoding,unmanaged" \ -hdr "Cache-Control: max-age=5" \
-hdr "Cache-Control: max-age=5" -bodylen 51
chunkedlen 17
chunkedlen 17
chunkedlen 17
chunkedlen 0
rxreq rxreq
expect req.url == "/unmanaged" expect req.url == "/unmanaged"
txresp -nolen -hdr "Transfer-Encoding: chunked" \ txresp -hdr "Vary: accept-encoding,unmanaged" \
-hdr "Vary: accept-encoding,unmanaged" \ -hdr "Cache-Control: max-age=5" \
-hdr "Cache-Control: max-age=5" -bodylen 51
chunkedlen 17
chunkedlen 17
chunkedlen 17
chunkedlen 0
# Mixed Vary (Accept-Encoding + Referer) # Mixed Vary (Accept-Encoding + Referer)
rxreq rxreq
expect req.url == "/referer-accept-encoding" expect req.url == "/referer-accept-encoding"
txresp -nolen -hdr "Transfer-Encoding: chunked" \ txresp -hdr "Vary: accept-encoding,referer" \
-hdr "Vary: accept-encoding,referer" \ -hdr "Cache-Control: max-age=5" \
-hdr "Cache-Control: max-age=5" -hdr "Content-Encoding: gzip" \
chunkedlen 17 -bodylen 51
chunkedlen 17
chunkedlen 17
chunkedlen 0
rxreq rxreq
expect req.url == "/referer-accept-encoding" expect req.url == "/referer-accept-encoding"
txresp -nolen -hdr "Transfer-Encoding: chunked" \ txresp -hdr "Vary: referer,accept-encoding" \
-hdr "Vary: referer,accept-encoding" \ -hdr "Cache-Control: max-age=5" \
-hdr "Cache-Control: max-age=5" -hdr "Content-Encoding: gzip" \
chunkedlen 18 -bodylen 54
chunkedlen 18
chunkedlen 18
chunkedlen 0
rxreq rxreq
expect req.url == "/referer-accept-encoding" expect req.url == "/referer-accept-encoding"
txresp -nolen -hdr "Transfer-Encoding: chunked" \ txresp -hdr "Vary: referer,accept-encoding" \
-hdr "Vary: referer,accept-encoding" \ -hdr "Cache-Control: max-age=5" \
-hdr "Cache-Control: max-age=5" -hdr "Content-Encoding: gzip" \
chunkedlen 19 -bodylen 57
chunkedlen 19
chunkedlen 19
chunkedlen 0
# Multiple Accept-Encoding headers # Multiple Accept-Encoding headers
rxreq rxreq
expect req.url == "/multiple_headers" expect req.url == "/multiple_headers"
txresp -hdr "Vary: accept-encoding" \ txresp -hdr "Vary: accept-encoding" \
-hdr "Cache-Control: max-age=5" -bodylen 155 -hdr "Cache-Control: max-age=5" \
-hdr "Content-Encoding: gzip" \
-bodylen 155
rxreq rxreq
expect req.url == "/multiple_headers" expect req.url == "/multiple_headers"
txresp -hdr "Vary: accept-encoding" \ txresp -hdr "Vary: accept-encoding" \
-hdr "Cache-Control: max-age=5" -bodylen 166 -hdr "Cache-Control: max-age=5" \
-hdr "Content-Encoding: gzip" \
-bodylen 166
# Too many Accept-Encoding values (we will not cache responses with more than 16 encodings) # Too many Accept-Encoding values (we will not cache responses with more than 16 encodings)
rxreq rxreq
expect req.url == "/too_many_encodings" expect req.url == "/too_many_encodings"
txresp -hdr "Vary: accept-encoding" \ txresp -hdr "Vary: accept-encoding" \
-hdr "Cache-Control: max-age=5" -bodylen 177 -hdr "Cache-Control: max-age=5" \
-hdr "Content-Encoding: gzip" \
-bodylen 177
rxreq rxreq
expect req.url == "/too_many_encodings" expect req.url == "/too_many_encodings"
txresp -hdr "Vary: accept-encoding" \ txresp -hdr "Vary: accept-encoding" \
-hdr "Cache-Control: max-age=5" -bodylen 188 -hdr "Cache-Control: max-age=5" \
-hdr "Content-Encoding: gzip" \
-bodylen 188
} -start } -start
@ -123,23 +105,15 @@ server s2 {
# Responses that should not be cached # Responses that should not be cached
rxreq rxreq
expect req.url == "/no_vary_support" expect req.url == "/no_vary_support"
txresp -nolen -hdr "Transfer-Encoding: chunked" \ txresp -hdr "Vary: accept-encoding" \
-hdr "Vary: accept-encoding" \ -hdr "Cache-Control: max-age=5" \
-hdr "Cache-Control: max-age=5" -bodylen 57
chunkedlen 19
chunkedlen 19
chunkedlen 19
chunkedlen 0
rxreq rxreq
expect req.url == "/no_vary_support" expect req.url == "/no_vary_support"
txresp -nolen -hdr "Transfer-Encoding: chunked" \ txresp -hdr "Vary: accept-encoding" \
-hdr "Vary: accept-encoding" \ -hdr "Cache-Control: max-age=5" \
-hdr "Cache-Control: max-age=5" -bodylen 57
chunkedlen 19
chunkedlen 19
chunkedlen 19
chunkedlen 0
} -start } -start
haproxy h1 -conf { haproxy h1 -conf {
@ -186,7 +160,7 @@ client c1 -connect ${h1_fe_sock} {
txreq -url "/accept-encoding" -hdr "Accept-Encoding: first_value" txreq -url "/accept-encoding" -hdr "Accept-Encoding: first_value"
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
expect resp.http.content-type == "gzip" expect resp.http.content-encoding == "gzip"
expect resp.bodylen == 45 expect resp.bodylen == 45
txreq -url "/accept-encoding" -hdr "Accept-Encoding: second_value" txreq -url "/accept-encoding" -hdr "Accept-Encoding: second_value"
@ -200,7 +174,7 @@ client c1 -connect ${h1_fe_sock} {
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
expect resp.bodylen == 45 expect resp.bodylen == 45
expect resp.http.content-type == "gzip" expect resp.http.content-encoding == "gzip"
expect resp.http.X-Cache-Hit == 1 expect resp.http.X-Cache-Hit == 1
txreq -url "/accept-encoding" -hdr "Accept-Encoding: second_value" txreq -url "/accept-encoding" -hdr "Accept-Encoding: second_value"