varnishtest    "trivial run of varnishstat in curses mode"

server s1 -repeat 4 {
	rxreq
	txresp
} -start

varnish v1 -vcl+backend {
	probe default {
		.url = "/";
	}
} -start

process p1 {varnishstat -n ${v1_name}} -start
process p2 {varnishstat -n ${v1_name}} -start
process p3 {varnishstat -n ${v1_name}} -start

process p1 -expect-text 0 0 "VBE.vcl1.s1.happy"
process p1 -screen_dump

client c1 {
	txreq
	rxresp
} -run

process p1 -expect-text 0 0 "MAIN.s_sess"
process p1 -screen_dump

process p1 -write {+}
process p1 -screen_dump
process p1 -expect-text 0 0 "Refresh interval set to 1.1 seconds."

process p1 -write {-}
process p1 -screen_dump
process p1 -expect-text 0 0 "Refresh interval set to 1.0 seconds."

process p1 -write {vG}
process p1 -expect-text 0 0 "VBE.vcl1.s1.req"
process p1 -expect-text 0 0 "DIAG"
process p1 -screen_dump

process p1 -write {dek}
process p1 -expect-text 0 1 "Concurrent connections used:"
process p1 -screen_dump

process p1 -write {h}
process p1 -expect-text 0 0 "Navigate the counter list one line up."
process p1 -screen_dump

process p1 -write {G}
process p1 -expect-text 0 0 "Decrease refresh interval."
process p1 -screen_dump

# the counters screen is preserved
process p1 -write {h}
process p1 -expect-text 0 1 "Concurrent connections used:"
process p1 -screen_dump

# the help screen always appears from the top
process p1 -write {h}
process p1 -expect-text 0 0 "Navigate the counter list one line up."
process p1 -screen_dump

process p1 -write {h}
process p1 -winsz 25 132
process p1 -expect-text 4 124 "AVG_1000"
process p1 -expect-text 22 108 "UNSEEN  DIAG"

process p1 -key NPAGE
process p1 -expect-text 0 0 "VBE.vcl1.s1.helddown"
process p1 -screen_dump

process p1 -key PPAGE
process p1 -expect-text 0 0 "VBE.vcl1.s1.happy"
process p1 -screen_dump

process p1 -key END
process p1 -expect-text 22 1 "   "
process p1 -expect-text 4 1 "^^^"
process p1 -screen_dump

process p1 -key HOME
process p1 -expect-text 22 1 "vvv"
process p1 -expect-text 4 1 "   "
process p1 -screen_dump

process p1 -screen_dump -write {q} -wait
process p2 -screen_dump -kill TERM -wait
process p3 -screen_dump -kill HUP -wait
