Commit 2dfb0dee authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

vtc: Fail unattended logs with logexpect

parent 9091a9ac
...@@ -8,9 +8,10 @@ server s1 { ...@@ -8,9 +8,10 @@ server s1 {
varnish v1 -vcl+backend { } -start varnish v1 -vcl+backend { } -start
logexpect l1 -v v1 -g raw { logexpect l1 -v v1 -g raw {
expect * 0 VCL_Log "Should happen first" fail add * VCL_Log "Should not happen"
expect 0 0 VCL_Log "Should happen second" expect * 0 VCL_Log "Should happen first"
expect 0 0 VCL_Log "Should happen second"
fail clear
} -start } -start
varnish v1 -errvcl "Forced failure" { varnish v1 -errvcl "Forced failure" {
...@@ -27,6 +28,7 @@ varnish v1 -errvcl "Forced failure" { ...@@ -27,6 +28,7 @@ varnish v1 -errvcl "Forced failure" {
debug.fail(); debug.fail();
std.log("Should not happen"); std.log("Should not happen");
} }
sub vcl_fini { sub vcl_fini {
std.log("Should happen second"); std.log("Should happen second");
} }
...@@ -34,8 +36,6 @@ varnish v1 -errvcl "Forced failure" { ...@@ -34,8 +36,6 @@ varnish v1 -errvcl "Forced failure" {
logexpect l1 -wait logexpect l1 -wait
shell -match "^$" {varnishlog -n ${v1_name} -d -g raw -I "Should not happen"}
varnish v1 -cliok "param.set nuke_limit 42" varnish v1 -cliok "param.set nuke_limit 42"
varnish v1 -errvcl "nuke_limit is not the answer." { varnish v1 -errvcl "nuke_limit is not the answer." {
......
...@@ -4,6 +4,13 @@ server s1 { } -start ...@@ -4,6 +4,13 @@ server s1 { } -start
varnish v1 -vcl+backend { } -start varnish v1 -vcl+backend { } -start
logexpect l1 -v v1 -g raw {
fail add * VCL_Log "Should not happen"
expect * 0 VCL_Log "Should happen first"
expect 0 0 VCL_Log "Should happen second"
fail clear
} -start
varnish v1 -errvcl "Missing dynamic backend address or port" { varnish v1 -errvcl "Missing dynamic backend address or port" {
import debug; import debug;
import std; import std;
...@@ -13,9 +20,14 @@ varnish v1 -errvcl "Missing dynamic backend address or port" { ...@@ -13,9 +20,14 @@ varnish v1 -errvcl "Missing dynamic backend address or port" {
} }
sub vcl_init { sub vcl_init {
std.log("Should happen first");
new objx = debug.dyn("", ""); new objx = debug.dyn("", "");
std.log("Should not happen"); std.log("Should not happen");
} }
sub vcl_fini {
std.log("Should happen second");
}
} }
shell -match "^$" {varnishlog -n ${v1_name} -d -g raw -I "Should not happen"} logexpect l1 -wait
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