Created
April 9, 2021 10:33
-
-
Save aondio/63bdb3989499659af50dee979d6af4e2 to your computer and use it in GitHub Desktop.
Test backends timeouts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishtest " test backends timeouts" | |
server s1 { | |
# connect to the backend before connect_timeout | |
rxreq | |
delay 1 | |
# send first byte before first_byte_timeout | |
send "HTTP/1.1 200 OK\r\n" | |
delay 1 | |
# send other bytes before between_bytes_timeout | |
send "Transfer-encoding: chunked\r\n" | |
send "\r\n" | |
send "00000004\r\n1234\r\n" | |
delay 1 | |
send "00000000\r\n" | |
# send full response before last_byte_timeout | |
delay 1 | |
send "\r\n" | |
} -start | |
varnish v1 -vcl { | |
backend b1 { | |
.host = "${s1_addr}"; | |
.port = "${s1_port}"; | |
.connect_timeout = 1s; | |
.first_byte_timeout = 1.5s; | |
.between_bytes_timeout = 1.5s; | |
} | |
sub vcl_backend_fetch { | |
set bereq.last_byte_timeout = 5s; | |
} | |
} -start | |
client c1 { | |
txreq | |
rxresp | |
expect resp.status == 200 | |
} -run | |
# in varnishlog we expect a response time between 4 and 5 seconds | |
logexpect l1 -v v1 -g request { | |
expect * = Timestamp {Resp: \S+ [4-5\.\d+ [4-5]\.\d+} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment