vtest "Test that hash_always_miss also implies hash_ignore_busy. Ticket #1073."

barrier b1 cond 2
barrier b2 cond 2

server s1 {
	rxreq
	barrier b1 sync
	barrier b2 sync
	delay 1
	txresp -hdr "Server: 1"
} -start

server s2 {
	rxreq
	barrier b2 sync
	txresp -hdr "Server: 2"
} -start

vinyl v1 -vcl+backend {
	sub vcl_recv {
		if (req.http.x-hash-always-miss == "1") {
			set req.hash_always_miss = true;
		}
	}
	sub vcl_backend_fetch {
		if (bereq.http.x-client == "1") {
			set bereq.backend = s1;
		}
		if (bereq.http.x-client == "2") {
			set bereq.backend = s2;
		}
	}
} -start

client c1 {
	txreq -url "/" -hdr "x-client: 1"
	rxresp
	expect resp.status == 200
	expect resp.http.Server == "1"
} -start

client c2 {
	barrier b1 sync
	txreq -url "/" -hdr "x-client: 2" -hdr "x-hash-always-miss: 1"
	txreq -url "/" -hdr "x-client: 2"
	rxresp
	expect resp.status == 200
	expect resp.http.Server == "2"
} -start

client c1 -wait
client c2 -wait
