Commit 81cc0105 authored by Geoff Simmons's avatar Geoff Simmons

Verify VCL failure when .create_stats() is called outside of vcl_init.

parent 399f7206
......@@ -197,3 +197,35 @@ varnish v1 -vsc SELECTOR.vc1.*
# The same for vcl2 after discard.
varnish v1 -cli "vcl.discard vcl2"
varnish v1 -vsc SELECTOR.vc2.*
varnish v1 -vcl {
import ${vmod_selector};
backend b { .host = "${bad_ip}"; }
sub vcl_init {
# No .create_stats() call.
new n = selector.set();
n.add("foo");
n.add("bar");
n.add("baz");
n.add("quux");
}
sub vcl_recv {
n.create_stats();
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: n\.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