[master] bc8537eda Test case for handling initially cold VCLs

Nils Goroll nils.goroll at uplex.de
Tue Nov 16 11:41:08 UTC 2021


commit bc8537eda7206120373e3e701d9c72b3e4ff5db0
Author: AlveElde <alve_elde at hotmail.com>
Date:   Wed Aug 25 17:38:47 2021 +0200

    Test case for handling initially cold VCLs

diff --git a/bin/varnishtest/tests/v00067.vtc b/bin/varnishtest/tests/v00067.vtc
new file mode 100644
index 000000000..46c72c18a
--- /dev/null
+++ b/bin/varnishtest/tests/v00067.vtc
@@ -0,0 +1,41 @@
+varnishtest "The active VCL must always be warm"
+
+shell {
+	cat >${tmpdir}/f1 <<-EOF
+	vcl 4.1;
+	backend default none;
+	EOF
+}
+
+# Load a cold VCL. This should not become the active VCL.
+varnish v1 -cliok "vcl.load vcl_cold ${tmpdir}/f1 cold"
+varnish v1 -cliexpect "available *cold *cold *- *vcl_cold" "vcl.list"
+
+# The cache should not start without a warm VCL.
+varnish v1 -clierr 300 "start"
+
+# Load a warm VCL and make it the active VCL.
+varnish v1 -cliok "vcl.load vcl_warm ${tmpdir}/f1 warm"
+varnish v1 -cliok "vcl.use vcl_warm"
+varnish v1 -cliexpect "active *warm *warm *- *vcl_warm" "vcl.list"
+
+# The cache now starts.
+varnish v1 -cliok "start"
+varnish v1 -cliexpect "available *cold *cold *0 *vcl_cold" "vcl.list"
+varnish v1 -cliexpect "active *warm *warm *0 *vcl_warm" "vcl.list"
+
+# Load an automatically warming VCL, and set it as the active VCL.
+varnish v1 -cliok "vcl.load vcl_auto ${tmpdir}/f1 warm"
+varnish v1 -cliok "vcl.use vcl_auto"
+varnish v1 -cliexpect "available *warm *warm *0 *vcl_warm" "vcl.list"
+varnish v1 -cliexpect "active *warm *warm *0 *vcl_auto" "vcl.list"
+
+# Cool the previous active VCL.
+varnish v1 -cliok "vcl.state vcl_warm cold"
+varnish v1 -cliexpect "available *cold *cold *0 *vcl_warm" "vcl.list"
+
+# Restart the cache.
+varnish v1 -cliok "stop" -cliok "start"
+varnish v1 -cliexpect "available *cold *cold *0 *vcl_cold" "vcl.list"
+varnish v1 -cliexpect "available *cold *cold *0 *vcl_warm" "vcl.list"
+varnish v1 -cliexpect "active *warm *warm *0 *vcl_auto" "vcl.list"


More information about the varnish-commit mailing list