Commit 2ac66119 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

vtc: Add varnishadm pass/script/interactive coverage

To avoid trailing blanks in diffs I decided to use underscores.

In curses test cases, pack process writes with the following
expectations.

Refs #3691
parent edd7b69f
varnishtest "trivial run of varnishadm in script mode"
feature cmd "python3 -c 'import json'"
varnish v1 -vcl {backend be none;} -start
shell {
cat >expected.txt <<-EOF
Child_in_state_running
EOF
varnishadm -n ${v1_name} status | tr ' ' _ >actual.txt
diff -u expected.txt actual.txt
}
# same command via stdin
shell {
echo status | varnishadm -n ${v1_name} | tr ' ' _ >actual.txt
diff -u expected.txt actual.txt
}
shell {
cat >expected.txt <<-EOF
200_22______
Child_in_state_running
EOF
{
varnishadm -n ${v1_name} -p status
printf '\n' # easier to add here than remove in expected.txt
} | tr ' ' _ >actual.txt
diff -u expected.txt actual.txt
}
# same command via stdin
shell {
echo status | varnishadm -n ${v1_name} -p | tr ' ' _ >actual.txt
printf '\n' >>actual.txt
diff -u expected.txt actual.txt
}
shell {
varnishadm -n ${v1_name} status -j |
python3 -c 'import sys, json; print(json.load(sys.stdin))'
}
# same command via stdin
shell {
echo 'status -j' |
varnishadm -n ${v1_name} |
python3 -c 'import sys, json; print(json.load(sys.stdin))'
}
shell -err {
varnishadm -n ${v1_name} -p status -j |
python3 -c 'import sys, json; print(json.load(sys.stdin))'
}
# same command via stdin
shell -err {
echo 'status -j' |
varnishadm -n ${v1_name} -p |
python3 -c 'import sys, json; print(json.load(sys.stdin))'
}
......@@ -18,16 +18,15 @@ process p1 -log {varnishadm -n ${v1_name}} -start
process p1 -expect-text 0 1 "Type 'quit' to close CLI session."
# expect a status in interactive mode (after a banner)
process p1 -write "pin\t\r"
process p1 -expect-text 0 1 "PONG"
process p1 -expect-text 12 1 "200 "
process p1 -expect-text 13 1 PONG
process p1 -write "vcl.li\t\r"
process p1 -expect-text 0 1 "active auto warm"
process p1 -write "vcl.s\t\th\t vcl1\r"
process p1 -expect-text 0 1 "backend s1"
process p1 -screen_dump -write "quit\r" -wait
......@@ -16,18 +16,15 @@ varnish v1 -vsl_catchup
process p1 -log {varnishadm -p -n ${v1_name}} -start
# expect a full status line in pass mode (no banner)
process p1 -write "ping\r"
process p1 -expect-text 0 1 "200 19"
process p1 -expect-text 0 1 "PONG"
process p1 -expect-text 2 1 "200 19 "
process p1 -expect-text 3 1 PONG
process p1 -write "vcl.list\r"
process p1 -expect-text 0 0 "auto warm"
process p1 -write "vcl.show vcl1\r"
process p1 -expect-text 0 0 "backend s1"
process p1 -screen_dump -write "\x04" -wait
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