Commit 607c5923 authored by Geoff Simmons's avatar Geoff Simmons

add test l00005.vtc -- in addition to the tests from Varnish, this

verifies logging the backend name (BackendOpen, -Reuse and -Close)
parent 42015170
varnishtest "Test backend fetch byte counters and logging backend names"
server s1 {
rxreq
expect req.url == "/1"
txresp -bodylen 1000
rxreq
expect req.url == "/2"
send "HTTP/1.1\r\n\r\n"
} -start
varnish v1 -vcl {
import backend_dyn from "${vmod_topbuild}/src/.libs/libvmod_backend_dyn.so";
backend dummy { .host = "${bad_ip}"; }
sub vcl_init {
if (!backend_dyn.create(name="be", host="${s1_addr}",
port="${s1_port}")) {
return(fail);
}
}
sub vcl_backend_fetch {
set bereq.backend = backend_dyn.by_name("be");
unset bereq.http.x-forwarded-for;
unset bereq.http.x-varnish;
set bereq.http.Host = "foo.bar";
}
sub vcl_backend_response {
set beresp.do_stream = false;
}
} -start
# Request (1002):
# POST /1 HTTP/1.1\r\n 18 bytes
# Content-Length: 4\r\n 19 bytes
# Host: foo.bar\r\n 15 bytes
# \r\n 2 bytes
# Total: 54 bytes
# Response:
# HTTP/1.1 200 OK\r\n 17 bytes
# Content-Length: 1000\r\n 22 bytes
# \r\n 2 bytes
# Total: 41 bytes
# Request (1004):
# POST /2 HTTP/1.1\r\n 18 bytes
# Content-Length: 4\r\n 19 bytes
# Host: foo.bar\r\n 15 bytes
# \r\n 2 bytes
# Total: 54 bytes
# Reponse:
# HTTP/1.1\r\n 10 bytes
# \r\n 2 bytes
# Total: 12 bytes
logexpect l1 -v v1 -g session {
expect * 1001 Begin "^req .* rxreq"
expect * = End
expect 0 1003 Begin "^req .* rxreq"
expect * = End
expect 0 1002 Begin "^bereq "
expect * = BackendOpen "vcl1.be"
expect * = BackendReuse "vcl1.be"
expect * = BereqAcct "^54 4 58 41 1000 1041$"
expect 0 = End
expect 0 1004 Begin "^bereq"
expect * = BackendOpen "vcl1.be"
expect * = BackendClose "vcl1.be"
expect * = BereqAcct "^54 4 58 12 0 12$"
expect * = End
} -start
# Request 1001
client c1 {
txreq -req "POST" -url "/1" -body "asdf"
rxresp
expect resp.status == 200
txreq -req "POST" -url "/2" -body "asdf"
rxresp
expect resp.status == 503
} -run
logexpect l1 -wait
varnish v1 -expect VBE.vcl1.be.happy == 0
varnish v1 -expect MAIN.n_backend == 2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment