Commit 8ead94e1 authored by Geoff Simmons's avatar Geoff Simmons

Add a test for calling label.add() outside of vcl_init.

parent 1d3ad7af
Pipeline #356 skipped
...@@ -96,6 +96,9 @@ varnish v1 -vcl { ...@@ -96,6 +96,9 @@ varnish v1 -vcl {
elsif (req.url == "/outofrange") { elsif (req.url == "/outofrange") {
l.go(3); l.go(3);
} }
elsif (req.url == "/add") {
l.add(1, "VCL1");
}
} }
sub vcl_backend_fetch { sub vcl_backend_fetch {
...@@ -127,6 +130,14 @@ client c1 { ...@@ -127,6 +130,14 @@ client c1 {
expect resp.http.VCL == <undef> expect resp.http.VCL == <undef>
} -run } -run
client c1 {
txreq -url "/add"
rxresp
expect resp.status == 503
expect resp.reason == "VCL failed"
expect resp.http.VCL == <undef>
} -run
client c1 { client c1 {
txreq txreq
rxresp rxresp
...@@ -139,6 +150,7 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" { ...@@ -139,6 +150,7 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect * * VCL_Error "^vmod dispatch error: l.go.-1.: n must be >= 0$" expect * * VCL_Error "^vmod dispatch error: l.go.-1.: n must be >= 0$"
expect * * VCL_Error "^vmod dispatch error: l.go.1.: label 1 was not added$" expect * * VCL_Error "^vmod dispatch error: l.go.1.: label 1 was not added$"
expect * * VCL_Error "^vmod dispatch error: l.go.3.: highest label number is 2" expect * * VCL_Error "^vmod dispatch error: l.go.3.: highest label number is 2"
expect * * VCL_Error "^vmod dispatch error: l.add.1, VCL1. may only be called in vcl_init$"
expect * * VCL_Error "^vmod dispatch error: l.go.0.: may only be called in client context, not in any vcl_backend_. subroutine$" expect * * VCL_Error "^vmod dispatch error: l.go.0.: may only be called in client context, not in any vcl_backend_. subroutine$"
} -start } -start
......
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