vtest "Check that a cache fetch + hit transaction works"

server s1 {
	rxreq
	txresp -hdr "Connection: close" -body "012345\n"
} -start

vinyl v1 -vcl+backend { } -start

client c1 {
	txreq -url "/"
	rxresp
	expect resp.status == 200
	expect resp.http.X-Vinyl == "1001"
} -run

client c2 {
	txreq -url "/"
	rxresp
	expect resp.status == 200
	expect resp.http.X-Vinyl == "1004 1002"
} -run

# Give vinyl a chance to update stats
delay .1

vinyl v1 -expect sess_conn == 2
vinyl v1 -expect cache_hit == 1
vinyl v1 -expect cache_miss == 1
vinyl v1 -expect client_req == 2
vinyl v1 -expect s_sess == 2
vinyl v1 -expect s_fetch == 1
