Commit 53e6f5e1 authored by Geoff Simmons's avatar Geoff Simmons

Verify that calling .add() outside vcl_init invokes VCL failure.

parent 512c6512
......@@ -787,3 +787,31 @@ varnish v1 -errvcl {vmod selector failure: t.add(): "foo" added more than once}
t.add("foo");
}
}
varnish v1 -vcl {
import ${vmod_selector};
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new t = selector.set();
t.add("foo");
}
sub vcl_recv {
t.add("bar");
return (synth(200));
}
}
client c1 {
txreq
rxresp
expect resp.status == 503
expect resp.reason == "VCL failed"
} -run
logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect 0 * Begin req
expect * = VCL_Error {^vmod selector failure: t\.add\(\) may only be called in vcl_init$}
expect * = End
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment