varnishtest "Test Basic persistence"

feature persistent_storage

process p1 -dump {
	varnishd -spersistent -b localhost -n ${tmpdir} -a :0 -d 2>&1
} -start -expect-exit 1

process p1 -expect-text 0 0 {to launch}
process p1 -write "start\n"
process p1 -expect-text 0 0 {-spersistent has been deprecated}
process p1 -write "quit\n"
process p1 -expect-exit 0x20 -wait

server s1 {
	rxreq
	txresp -body FOO
	accept
	rxreq
	txresp -status 700
} -start

shell "rm -f ${tmpdir}/_.per"

varnish v1 \
	-arg "-pfeature=+wait_silo" \
	-arg "-sdeprecated_persistent,${tmpdir}/_.per,5m" \
	-vcl+backend { } -start

varnish v1 -stop

varnish v1 -start

client c1 {
	txreq -url "/"
	rxresp
	expect resp.status == 200
	expect resp.http.X-Varnish == "1001"
} -run

varnish v1 -vsl_catchup

varnish v1 -cliok "storage.list"
varnish v1 -cliok "debug.persistent s0 dump"
varnish v1 -cliok "debug.persistent s0 sync"
varnish v1 -stop

varnish v1 -start
varnish v1 -cliok "debug.xid 2000"

client c1 {
	txreq -url "/"
	rxresp
	expect resp.status == 200
	expect resp.http.X-Varnish == "2001 1002"
} -run

# shell "rm -f /tmp/__v1/_.per"
