vtest "leak backend"

server s1 {
	rxreq
	txresp -hdr "Leak: no"
} -start

server s2 {
	rxreq
	txresp -hdr "Leak: yes"
} -start

vinyl v1 -vcl {
	backend s1 { .host="${s1_addr}"; .port="${s1_port}"; }

	sub vcl_deliver {
		set resp.http.Label = "yes";
	}
}

vinyl v1 -cli "vcl.label lbl vcl1"

vinyl v1 -vcl {
	backend s2 { .host="${s2_addr}"; .port="${s2_port}"; }

	sub vcl_recv {
		set req.backend_hint = s2;
		return (vcl(lbl));
	}

	sub vcl_deliver {
		set resp.http.Label = "no";
	}
} -start

client c1 {
	txreq
	rxresp
	expect resp.http.Label == yes
	expect resp.http.Leak  == no
} -run
