varnishtest "cache backend synth object"

varnish v1 -vcl {

	backend b { .host = "${bad_backend}"; }

	sub vcl_backend_error {
		set beresp.ttl = 1s;
		set beresp.grace = 3s;
		set beresp.http.foobar = "BLA" + bereq.xid;
		set beresp.body = beresp.http.foobar;
		return (deliver);
	}
} -start

varnish v1 -cliok "param.set connect_timeout 1.0"

client c1 {
	txreq
	rxresp
	expect resp.http.foobar == "BLA1002"

	delay 2
	txreq
	rxresp
	expect resp.http.foobar == "BLA1002"
	expect resp.body == "BLA1002"

	delay 3
	txreq
	rxresp
	expect resp.http.foobar == "BLA1004"
	expect resp.body == "BLA1004"
} -run

delay 4

varnish v1 -expect n_objectcore == 0
