[master] e412dbe36 varnishtest logexpect: test the tester

Nils Goroll nils.goroll at uplex.de
Thu Jan 14 12:55:09 UTC 2021


commit e412dbe366558885f56d79d97a14354e60ecec69
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Jan 14 13:21:46 2021 +0100

    varnishtest logexpect: test the tester
    
    Ref #3249

diff --git a/bin/varnishtest/tests/b00074.vtc b/bin/varnishtest/tests/b00074.vtc
new file mode 100644
index 000000000..ebacf9260
--- /dev/null
+++ b/bin/varnishtest/tests/b00074.vtc
@@ -0,0 +1,67 @@
+varnishtest "Test logexpect fail command"
+
+# NOTE: this is a test of varnishtest itself, so it would fall under
+# the "a" category, but has been filed under the "b" category because
+# it needs varnishd
+
+varnish v1 -vcl {
+	import std;
+
+	backend proforma None;
+
+	sub vcl_init {
+		std.log("i0");
+		std.log("i1");
+		std.log("i2");
+		std.log("i3");
+	}
+
+	sub vcl_recv {
+		std.log("r0");
+		std.log("r1");
+		std.log("r2");
+		std.log("r3");
+	}
+} -start
+
+logexpect l1 -v v1 -g vxid -q "vxid == 1001" {
+	fail add *	Error		"out of workspace"
+	fail add *	VCL_Error	"Workspace overflow"
+} -start
+
+logexpect l2 -v v1 -err -g vxid -q "vxid == 1001" {
+	fail add *	VCL_Log	^r2
+} -start
+
+logexpect l3 -v v1 -g vxid -q "vxid == 1001" {
+	fail add *	VCL_Log	^r2
+	expect * 1001	VCL_Log	^r0
+	expect 0 =	VCL_Log	^r1
+	fail clear
+	expect 1 =	VCL_Log	^r3
+} -start
+
+client c1 {
+	txreq
+	rxresp
+} -run
+
+# -g raw needs an explicit expect and "fail clear" at the end
+# because the raw transaction never ends
+logexpect l4 -v v1 -d 1 -g raw {
+	fail add *	VCL_Log	^i2
+	expect * 0	VCL_Log	^i0
+	expect 0 =	VCL_Log	^i1
+	fail clear
+	expect 1 =	VCL_Log	^i3
+	fail add *	Error		"out of workspace"
+	fail add *	VCL_Error	"Workspace overflow"
+	expect * 1000	End
+	fail clear
+} -start
+
+
+logexpect l1 -wait
+logexpect l2 -wait
+logexpect l3 -wait
+logexpect l4 -wait


More information about the varnish-commit mailing list