vtest "Director cleanup fails on vcl.discard"

server s1 {
	rxreq
	txresp
} -start

vinyl v1 -vcl+backend {
	import directors;

	backend b2 {
		.host = "${s1_addr}"; .port = "${s1_port}";
	}

	backend b3 {
		.host = "${s1_addr}"; .port = "${s1_port}";
	}

	sub vcl_init {
		new foo = directors.random();
		foo.add_backend(s1, 1);
		foo.add_backend(b2, 1);
		foo.add_backend(b3, 1);
	}
	sub vcl_backend_fetch {
		set bereq.backend = foo.backend();
	}
} -start

vinyl v1 -cliok "vcl.list"
vinyl v1 -cliok "backend.list"

vinyl v1 -vcl+backend { }
vinyl v1 -cliok "vcl.list"
vinyl v1 -cliok "backend.list"

vinyl v1 -cliok "vcl.list"
vinyl v1 -cliok "vcl.discard vcl1"

client c1 {
	txreq
	rxresp
} -run
