vtest "label a cold vcl"

server s1 { } -start

vinyl v1 -cliok "param.set vcl_cooldown 1"
vinyl v1 -vcl+backend {
	import debug; # can fail a VCL warmup
} -start

# a dummy vcl2 to freely use vcl1
vinyl v1 -vcl+backend { }

# cool vcl1 down
delay 4
vinyl v1 -cliok ping

shell -match "auto +cold +0 +vcl1" { vinyladm -n ${v1_name} vcl.list }

# first we try to label a cold VCL in auto state

# the magic parameter that fails a VCL warmup in vmod-debug
vinyl v1 -cliok "param.set max_esi_depth 42"

vinyl v1 -cliexpect "max_esi_depth is not the answer" "vcl.label label1 vcl1"

shell -err { vinyladm -n ${v1_name} vcl.list | grep label1 }

# second we try to label VCL in cold state
vinyl v1 -cliok "vcl.state vcl1 cold"

shell -match "cold +cold +0 +vcl1" { vinyladm -n ${v1_name} vcl.list }

vinyl v1 -cliexpect "set to auto or warm first" "vcl.label label1 vcl1"

shell -err { vinyladm -n ${v1_name} vcl.list | grep label1 }
