[master] 2dfb0deeb vtc: Fail unattended logs with logexpect
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Fri Sep 10 12:45:07 UTC 2021
commit 2dfb0deebb4dbb1c8dc4eb8c54e2fac250b17830
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Fri Sep 10 14:37:30 2021 +0200
vtc: Fail unattended logs with logexpect
diff --git a/bin/varnishtest/tests/m00022.vtc b/bin/varnishtest/tests/m00022.vtc
index ce60baa00..97bfd3409 100644
--- a/bin/varnishtest/tests/m00022.vtc
+++ b/bin/varnishtest/tests/m00022.vtc
@@ -8,9 +8,10 @@ server s1 {
varnish v1 -vcl+backend { } -start
logexpect l1 -v v1 -g raw {
- expect * 0 VCL_Log "Should happen first"
- expect 0 0 VCL_Log "Should happen second"
-
+ 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 "Forced failure" {
@@ -27,6 +28,7 @@ varnish v1 -errvcl "Forced failure" {
debug.fail();
std.log("Should not happen");
}
+
sub vcl_fini {
std.log("Should happen second");
}
@@ -34,8 +36,6 @@ varnish v1 -errvcl "Forced failure" {
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 -errvcl "nuke_limit is not the answer." {
diff --git a/bin/varnishtest/tests/m00027.vtc b/bin/varnishtest/tests/m00027.vtc
index d4b8ff767..730cbffd2 100644
--- a/bin/varnishtest/tests/m00027.vtc
+++ b/bin/varnishtest/tests/m00027.vtc
@@ -4,6 +4,13 @@ server s1 { } -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" {
import debug;
import std;
@@ -13,9 +20,14 @@ varnish v1 -errvcl "Missing dynamic backend address or port" {
}
sub vcl_init {
+ std.log("Should happen first");
new objx = debug.dyn("", "");
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
More information about the varnish-commit
mailing list