Commit bc8537ed authored by AlveElde's avatar AlveElde Committed by Nils Goroll

Test case for handling initially cold VCLs

parent 49d31c8d
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"
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