varnishtest "Change UDS backend: change path, drop poll"

server s1 -listen "${tmpdir}/s1.sock" {
	non_fatal
	timeout 3
	loop 40 {
		rxreq
		txresp
		accept
	}
} -start

server s2 -listen "${tmpdir}/s2.sock" {
	non_fatal
	timeout 3
	loop 40 {
		rxreq
		txresp
		accept
	}
} -start

varnish v1 -vcl {
	probe default {
		.window = 8;
		.initial = 7;
		.threshold = 8;
		.interval = 0.1s;
	}
	backend s1 {
		.path = "${s2_sock}";
	}
} -start

delay 1

varnish v1 -vcl {
	probe default {
		.window = 8;
		.initial = 7;
		.threshold = 8;
		.interval = 0.1s;
	}
	backend s1 {
		.path = "${s1_sock}";
	}
} -cliok "vcl.use vcl2" -cliok "vcl.discard vcl1"

delay 1

varnish v1 -vcl {
	backend s1 {
		.path = "${s1_sock}";
	}
} -cliok "vcl.use vcl3" -cliok "vcl.discard vcl2"

delay 1

varnish v1 -cliok "vcl.list"
varnish v1 -cliok "backend.list -p"

server s1 -break {
	rxreq
	expect req.url == /foo
	txresp -bodylen 4
} -start

delay 1

client c1 {
	txreq -url /foo
	rxresp
	txreq -url /foo
	rxresp
	expect resp.status == 200
	expect resp.bodylen == 4
} -run
