vtest "Check object references"

feature persistent_storage

shell "rm -f ${tmpdir}/_.per"

server s1 {
	rxreq
	txresp -hdr "Foo: foo"
	rxreq
	txresp -hdr "Bar: bar"
} -start

vinyl v1 \
	-arg "-pfeature=+wait_silo" \
	-arg "-sdeprecated_persistent,${tmpdir}/_.per,5m" \
	-arg "-pban_lurker_sleep=0" \
	-vcl+backend { } -start

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

vinyl v1 -expect n_object == 1

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

vinyl v1 -expect n_object == 2

vinyl v1 -stop
vinyl v1 -start
vinyl v1 -cliok "debug.xid 2000"

vinyl v1 -expect n_vampireobject == 2
vinyl v1 -expect n_object == 0

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

vinyl v1 -expect n_vampireobject == 1
vinyl v1 -expect n_object == 1

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

vinyl v1 -expect n_object == 2
vinyl v1 -expect n_vampireobject == 0
