Commit d22e7de2 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Test more of varnishadms error handling

parent 621c408a
...@@ -2,4 +2,94 @@ varnishtest "Test varnishadm and the Telnet CLI" ...@@ -2,4 +2,94 @@ varnishtest "Test varnishadm and the Telnet CLI"
varnish v1 -vcl {backend foo { .host = "127.0.0.1"; } } -start varnish v1 -vcl {backend foo { .host = "127.0.0.1"; } } -start
shell -err -expect {Usage: varnishadm} \
"varnishadm -7"
shell -err -expect {Could not get hold of varnishd, is it running?} \
"varnishadm -n ${v1_name}/nonexistent"
shell -err -expect {Connection failed} \
"varnishadm -t 4 -T ${bad_ip}:1 -S ${v1_name}/_.secret"
server s1 {
send "FOO\n"
} -start
shell -err -expect {Rejected 400} \
{varnishadm -T ${s1_addr}:${s1_port} -S /etc/group}
server s1 {
send "107 59 \n"
send "qbvnnftpkgubadqpzznkkazoxlyqbcbj\n\n"
send "Authentication required.\n"
send "\n"
} -start
shell -err -expect {Authentication required} \
{varnishadm -T ${s1_addr}:${s1_port}}
server s1 {
send "107 59 \n"
send "qbvnnftpkgubadqpzznkkazoxlyqbcbj\n\n"
send "Authentication required.\n"
send "\n"
} -start
shell -err -expect {Cannot open } \
{varnishadm -T ${s1_addr}:${s1_port} -S ${v1_name}/_.nonexistent}
server s1 {
send "107 59 \n"
send "qbvnnftpkgubadqpzznkkazoxlyqbcbj\n\n"
send "Authentication required.\n"
send "\n"
recv 70
send "599 0 \n"
send "\n"
} -start
shell -err -expect {Rejected 599} \
{varnishadm -T ${s1_addr}:${s1_port} -S ${v1_name}/_.secret}
server s1 {
send "107 59 \n"
send "qbvnnftpkgubadqpzznkkazoxlyqbcbj\n\n"
send "Authentication required.\n"
send "\n"
recv 70
send "200 0 \n"
send "\n"
recv 5
} -start
shell -err -expect {No pong received from server} \
{varnishadm -T ${s1_addr}:${s1_port} -S ${v1_name}/_.secret}
server s1 {
send "107 59 \n"
send "qbvnnftpkgubadqpzznkkazoxlyqbcbj\n\n"
send "Authentication required.\n"
send "\n"
recv 70
send "200 0 \n"
send "\n"
recv 5
send "200 8 \n"
send "PONG 12\n"
send "\n"
recv 5
send "200 7 \n"
send "Tested\n"
send "\n"
} -start
shell -expect {Tested} \
{varnishadm -T ${s1_addr}:${s1_port} -S ${v1_name}/_.secret test}
shell "varnishadm -n ${v1_name} help > /dev/null" shell "varnishadm -n ${v1_name} help > /dev/null"
...@@ -4,7 +4,11 @@ server s1 { ...@@ -4,7 +4,11 @@ server s1 {
rxreq rxreq
txresp -hdr "foo: 1" txresp -hdr "foo: 1"
rxreq rxreq
txresp -hdr "foo: 2" txresp -hdr "foo: 2a"
rxreq
txresp -hdr "foo: 2b"
rxreq
txresp -hdr "foo: 2c"
rxreq rxreq
txresp -hdr "foo: 3" txresp -hdr "foo: 3"
} -start } -start
...@@ -29,8 +33,31 @@ varnish v1 -vcl+backend { ...@@ -29,8 +33,31 @@ varnish v1 -vcl+backend {
} -start } -start
varnish v1 -cliok "param.set debug +refcnt"
logexpect l1 -v v1 -g vxid { logexpect l1 -v v1 -g vxid {
expect * 1003 HitPass "^1002 1" expect * 1001 Debug "^oh.*refcnt 1$"
expect 0 = VCL_call "^MISS"
} -start
logexpect l2 -v v1 -g vxid {
expect * 1003 Debug "^oh.*refcnt 2$"
expect 0 = HitPass "^1002 1"
} -start
logexpect l3 -v v1 -g vxid {
expect * 1005 Debug "^oh.*refcnt 2$"
expect 0 = HitPass "^1002 1"
} -start
logexpect l4 -v v1 -g vxid {
expect * 1007 Debug "^oh.*refcnt 2$"
expect 0 = HitPass "^1002 1"
} -start
logexpect l5 -v v1 -g vxid {
expect * 1009 Debug "^oh.*refcnt 1$"
expect 0 = VCL_call "^MISS"
} -start } -start
client c1 { client c1 {
...@@ -38,6 +65,12 @@ client c1 { ...@@ -38,6 +65,12 @@ client c1 {
rxresp rxresp
expect resp.http.miss == True expect resp.http.miss == True
txreq
rxresp
expect resp.http.pass == True
txreq
rxresp
expect resp.http.pass == True
txreq txreq
rxresp rxresp
expect resp.http.pass == True expect resp.http.pass == True
...@@ -50,7 +83,11 @@ client c1 { ...@@ -50,7 +83,11 @@ client c1 {
} -run } -run
logexpect l1 -wait logexpect l1 -wait
logexpect l2 -wait
logexpect l3 -wait
logexpect l4 -wait
logexpect l5 -wait
varnish v1 -expect MAIN.cache_hitpass == 1 varnish v1 -expect MAIN.cache_hitpass == 3
varnish v1 -expect MAIN.cache_miss == 2 varnish v1 -expect MAIN.cache_miss == 2
varnish v1 -expect MAIN.cache_hitmiss == 0 varnish v1 -expect MAIN.cache_hitmiss == 0
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