[6.0] 0e9b5ec63 Test more of varnishadms error handling
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:12 UTC 2018
commit 0e9b5ec6395ff68e3db8e0f912ab7a1fa144377a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Sep 4 07:38:27 2018 +0000
Test more of varnishadms error handling
diff --git a/bin/varnishtest/tests/b00041.vtc b/bin/varnishtest/tests/b00041.vtc
index 2fd2690a4..ca66c4539 100644
--- a/bin/varnishtest/tests/b00041.vtc
+++ b/bin/varnishtest/tests/b00041.vtc
@@ -2,4 +2,94 @@ varnishtest "Test varnishadm and the Telnet CLI"
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"
diff --git a/bin/varnishtest/tests/c00081.vtc b/bin/varnishtest/tests/c00081.vtc
index b08fa3250..419036cfe 100644
--- a/bin/varnishtest/tests/c00081.vtc
+++ b/bin/varnishtest/tests/c00081.vtc
@@ -4,7 +4,11 @@ server s1 {
rxreq
txresp -hdr "foo: 1"
rxreq
- txresp -hdr "foo: 2"
+ txresp -hdr "foo: 2a"
+ rxreq
+ txresp -hdr "foo: 2b"
+ rxreq
+ txresp -hdr "foo: 2c"
rxreq
txresp -hdr "foo: 3"
} -start
@@ -29,8 +33,31 @@ varnish v1 -vcl+backend {
} -start
+varnish v1 -cliok "param.set debug +refcnt"
+
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
client c1 {
@@ -38,6 +65,12 @@ client c1 {
rxresp
expect resp.http.miss == True
+ txreq
+ rxresp
+ expect resp.http.pass == True
+ txreq
+ rxresp
+ expect resp.http.pass == True
txreq
rxresp
expect resp.http.pass == True
@@ -50,7 +83,11 @@ client c1 {
} -run
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_hitmiss == 0
More information about the varnish-commit
mailing list