[master] 31cf5f5ff Execute more vcl coverage code at vcl load time

Nils Goroll nils.goroll at uplex.de
Fri Aug 16 10:42:06 UTC 2024


commit 31cf5f5ff889dec494866378a9edf67be714ef19
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Aug 16 12:36:20 2024 +0200

    Execute more vcl coverage code at vcl load time
    
    by moving test VCL from vcl_recv {} to vcl_init {}
    
    As suggested by walid here: https://github.com/varnishcache/varnish-cache/pull/4148#discussion_r1716777047

diff --git a/bin/varnishtest/tests/v00019.vtc b/bin/varnishtest/tests/v00019.vtc
index 1e0216a20..944405999 100644
--- a/bin/varnishtest/tests/v00019.vtc
+++ b/bin/varnishtest/tests/v00019.vtc
@@ -72,9 +72,9 @@ varnish v1 -errvcl {Comparison of different types: STRING '==' INT} {
 varnish v1 -vcl {
 	import debug;
 	backend be none;
-	sub vcl_recv {
-		if ("string" == "string") {
-			return (fail("should compile"));
+	sub vcl_init {
+		if ("string" != "string") {
+			return (fail("should load"));
 		}
 	}
 } -start
@@ -82,9 +82,9 @@ varnish v1 -vcl {
 varnish v1 -vcl {
 	import debug;
 	backend be none;
-	sub vcl_recv {
-		if ("string" == debug.return_strands("string")) {
-			return (fail("should compile"));
+	sub vcl_init {
+		if ("string" != debug.return_strands("string")) {
+			return (fail("should load"));
 		}
 	}
 }
@@ -92,9 +92,9 @@ varnish v1 -vcl {
 varnish v1 -vcl {
 	import debug;
 	backend be none;
-	sub vcl_recv {
-		if (debug.return_strands("string") == "string") {
-			return (fail("should compile"));
+	sub vcl_init {
+		if (debug.return_strands("string") != "string") {
+			return (fail("should load"));
 		}
 	}
 }
@@ -102,9 +102,9 @@ varnish v1 -vcl {
 varnish v1 -vcl {
 	import debug;
 	backend be none;
-	sub vcl_recv {
-		if (debug.return_strands("string") == debug.return_strands("string")) {
-			return (fail("should compile"));
+	sub vcl_init {
+		if (debug.return_strands("string") != debug.return_strands("string")) {
+			return (fail("should load"));
 		}
 	}
 }


More information about the varnish-commit mailing list