From 2c09535a90b688e63245907d09ec83a407b49b17 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 1 Aug 2008 08:24:23 +0000 Subject: [PATCH] Go over the b* series of tests: add expectes for stats counters where necessary generally polish. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3052 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- .../bin/varnishtest/tests/b00000.vtc | 26 ++++++++++++------- .../bin/varnishtest/tests/b00001.vtc | 20 ++++++++------ .../bin/varnishtest/tests/b00002.vtc | 22 +++++++++------- .../bin/varnishtest/tests/b00003.vtc | 24 ++++++++++------- .../bin/varnishtest/tests/b00004.vtc | 24 ++++++++--------- .../bin/varnishtest/tests/b00005.vtc | 10 +++---- .../bin/varnishtest/tests/b00006.vtc | 14 +++------- .../bin/varnishtest/tests/b00007.vtc | 10 +++---- .../bin/varnishtest/tests/b00008.vtc | 16 ++++++------ .../bin/varnishtest/tests/b00009.vtc | 14 +++------- .../bin/varnishtest/tests/b00010.vtc | 14 +++------- .../bin/varnishtest/tests/b00011.vtc | 10 +++---- .../bin/varnishtest/tests/b00012.vtc | 10 +++---- .../bin/varnishtest/tests/b00013.vtc | 10 +++---- .../bin/varnishtest/tests/b00014.vtc | 4 +-- .../bin/varnishtest/tests/b00015.vtc | 7 +---- 16 files changed, 104 insertions(+), 131 deletions(-) diff --git a/varnish-cache/bin/varnishtest/tests/b00000.vtc b/varnish-cache/bin/varnishtest/tests/b00000.vtc index f9f9e679..72a34e38 100644 --- a/varnish-cache/bin/varnishtest/tests/b00000.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00000.vtc @@ -2,23 +2,29 @@ # # $Id$ -varnish v1 -arg "-b 127.0.0.1:9080" -start +test "Does anything get through at all ?" server s1 { rxreq - txresp -hdr "Connection: close" -body "012345\n" -} + txresp -body "012345\n" +} -start -server s1 -start +varnish v1 -vcl+backend {} -start + +varnish v1 -expect n_object == 0 +varnish v1 -expect client_conn == 0 +varnish v1 -expect client_req == 0 +varnish v1 -expect cache_miss == 0 client c1 { txreq -url "/" rxresp expect resp.status == 200 -} - -client c1 -run - -server s1 -wait +} -run -varnish v1 -stop +varnish v1 -expect n_object == 1 +varnish v1 -expect client_conn == 1 +varnish v1 -expect client_req == 1 +varnish v1 -expect cache_miss == 1 +varnish v1 -expect s_sess == 1 +varnish v1 -expect s_req == 1 diff --git a/varnish-cache/bin/varnishtest/tests/b00001.vtc b/varnish-cache/bin/varnishtest/tests/b00001.vtc index 971820f1..4bf4656a 100644 --- a/varnish-cache/bin/varnishtest/tests/b00001.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00001.vtc @@ -4,10 +4,8 @@ test "Check that a pipe transaction works" server s1 -repeat 1 { rxreq - txresp \ - -hdr "Connection: close" \ - -body "012345\n" -} + txresp -body "012345\n" +} -start varnish v1 -vcl+backend { sub vcl_recv { @@ -15,12 +13,18 @@ varnish v1 -vcl+backend { } } -start -server s1 -start - client c1 { txreq -url "/" rxresp expect resp.status == 200 -} +} -run + +# Give varnish a chance to update stats +delay .1 -client c1 -run +varnish v1 -expect n_object == 0 +varnish v1 -expect client_conn == 1 +varnish v1 -expect client_req == 1 +varnish v1 -expect s_sess == 1 +varnish v1 -expect s_req == 1 +varnish v1 -expect s_pipe == 1 diff --git a/varnish-cache/bin/varnishtest/tests/b00002.vtc b/varnish-cache/bin/varnishtest/tests/b00002.vtc index dab4bede..f9e10e33 100644 --- a/varnish-cache/bin/varnishtest/tests/b00002.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00002.vtc @@ -2,12 +2,10 @@ test "Check that a pass transaction works" -server s1 -repeat 1 { +server s1 { rxreq - txresp \ - -hdr "Connection: close" \ - -body "012345\n" -} + txresp -hdr "Connection: close" -body "012345\n" +} -start varnish v1 -vcl+backend { sub vcl_recv { @@ -15,12 +13,18 @@ varnish v1 -vcl+backend { } } -start -server s1 -start - client c1 { txreq -url "/" rxresp expect resp.status == 200 -} +} -run + +# Give varnish a chance to update stats +delay .1 -client c1 -run +varnish v1 -expect n_object == 0 +varnish v1 -expect client_conn == 1 +varnish v1 -expect client_req == 1 +varnish v1 -expect s_sess == 1 +varnish v1 -expect s_req == 1 +varnish v1 -expect s_pass == 1 diff --git a/varnish-cache/bin/varnishtest/tests/b00003.vtc b/varnish-cache/bin/varnishtest/tests/b00003.vtc index 98af189d..6de3ee4e 100644 --- a/varnish-cache/bin/varnishtest/tests/b00003.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00003.vtc @@ -4,28 +4,32 @@ test "Check that a cache fetch + hit transaction works" server s1 { rxreq - txresp \ - -hdr "Connection: close" \ - -body "012345\n" -} + txresp -hdr "Connection: close" -body "012345\n" +} -start varnish v1 -vcl+backend { } -start -server s1 -start - client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" -} +} -run client c2 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1002 1001" -} +} -run + +# Give varnish a chance to update stats +delay .1 -client c1 -run -client c2 -run +varnish v1 -expect client_conn == 2 +varnish v1 -expect cache_hit == 1 +varnish v1 -expect cache_miss == 1 +varnish v1 -expect client_req == 2 +varnish v1 -expect s_sess == 2 +varnish v1 -expect s_req == 2 +varnish v1 -expect s_fetch == 1 diff --git a/varnish-cache/bin/varnishtest/tests/b00004.vtc b/varnish-cache/bin/varnishtest/tests/b00004.vtc index 79ba92ff..5817b5af 100644 --- a/varnish-cache/bin/varnishtest/tests/b00004.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00004.vtc @@ -8,21 +8,21 @@ server s1 { varnish v1 -vcl+backend { } -varnish v1 -cli start -varnish v1 -cli start -varnish v1 -cli start +varnish v1 -cliok start +varnish v1 -clierr 300 start +varnish v1 -clierr 300 start -varnish v1 -cli stop -varnish v1 -cli stop -varnish v1 -cli stop +varnish v1 -cliok stop +varnish v1 -clierr 300 stop +varnish v1 -clierr 300 stop -varnish v1 -cli start -varnish v1 -cli stop +varnish v1 -cliok start +varnish v1 -cliok stop -varnish v1 -cli start -varnish v1 -cli stop +varnish v1 -cliok start +varnish v1 -cliok stop -varnish v1 -cli start -varnish v1 -cli stop +varnish v1 -cliok start +varnish v1 -cliok stop varnish v1 -wait diff --git a/varnish-cache/bin/varnishtest/tests/b00005.vtc b/varnish-cache/bin/varnishtest/tests/b00005.vtc index f290b7f8..9eed1b32 100644 --- a/varnish-cache/bin/varnishtest/tests/b00005.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00005.vtc @@ -2,22 +2,18 @@ test "Check that -s works" -varnish v1 -arg "-s file,varnishtest_backing,10M -b 127.0.0.1:9080" -start - server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" -} +} -start -server s1 -start +varnish v1 -arg "-s file,varnishtest_backing,10M" -vcl+backend {} -start client c1 { txreq -url "/" rxresp expect resp.status == 200 -} - -client c1 -run +} -run server s1 -wait diff --git a/varnish-cache/bin/varnishtest/tests/b00006.vtc b/varnish-cache/bin/varnishtest/tests/b00006.vtc index 02ee741d..530a3cdd 100644 --- a/varnish-cache/bin/varnishtest/tests/b00006.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00006.vtc @@ -2,23 +2,15 @@ test "Check that -s malloc works" -varnish v1 -arg "-s malloc -b 127.0.0.1:9080" -start - server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" -} +} -start -server s1 -start +varnish v1 -arg "-s malloc" -vcl+backend {} -start client c1 { txreq -url "/" rxresp expect resp.status == 200 -} - -client c1 -run - -server s1 -wait - -varnish v1 -stop +} -run diff --git a/varnish-cache/bin/varnishtest/tests/b00007.vtc b/varnish-cache/bin/varnishtest/tests/b00007.vtc index 559b558d..8af9b4e6 100644 --- a/varnish-cache/bin/varnishtest/tests/b00007.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00007.vtc @@ -2,8 +2,6 @@ test "Check chunked encoding from backend works" -varnish v1 -arg "-s malloc -b 127.0.0.1:9080" -start - server s1 { rxreq expect req.url == "/bar" @@ -21,9 +19,9 @@ server s1 { send "00000004\r\n1234\r\n" chunked "1234" chunked "" -} +} -start -server s1 -start +varnish v1 -vcl+backend {} -start client c1 { txreq -url "/bar" @@ -34,6 +32,4 @@ client c1 { rxresp expect resp.status == 200 expect resp.http.content-length == "8" -} - -client c1 -run +} -run diff --git a/varnish-cache/bin/varnishtest/tests/b00008.vtc b/varnish-cache/bin/varnishtest/tests/b00008.vtc index 98a5f564..baf36fbc 100644 --- a/varnish-cache/bin/varnishtest/tests/b00008.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00008.vtc @@ -2,20 +2,20 @@ test "Test CLI help and parameter functions" -varnish v1 -arg "-b localhost:9080" +varnish v1 -arg "-b 127.0.0.2:9080" -varnish v1 -cli "help" +varnish v1 -cliok "help" -varnish v1 -cli "param.show" +varnish v1 -cliok "param.show" -varnish v1 -cli "param.show diag_bitmap" +varnish v1 -cliok "param.show diag_bitmap" -varnish v1 -cli "param.set diag_bitmap 0x40" +varnish v1 -cliok "param.set diag_bitmap 0x40" -varnish v1 -cli "param.set diag_bitmap 0x0" +varnish v1 -cliok "param.set diag_bitmap 0x0" varnish v1 -start -varnish v1 -cli "help" +varnish v1 -cliok "help" -varnish v1 -cli "stats" +varnish v1 -cliok "stats" diff --git a/varnish-cache/bin/varnishtest/tests/b00009.vtc b/varnish-cache/bin/varnishtest/tests/b00009.vtc index b6c38e82..62a2b5d0 100644 --- a/varnish-cache/bin/varnishtest/tests/b00009.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00009.vtc @@ -2,23 +2,15 @@ test "Check poll acceptor" -varnish v1 -arg "-p acceptor=poll -b 127.0.0.1:9080" -start - server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" -} +} -start -server s1 -start +varnish v1 -arg "-p acceptor=poll" -vcl+backend {} -start client c1 { txreq -url "/" rxresp expect resp.status == 200 -} - -client c1 -run - -server s1 -wait - -varnish v1 -stop +} -run diff --git a/varnish-cache/bin/varnishtest/tests/b00010.vtc b/varnish-cache/bin/varnishtest/tests/b00010.vtc index 3da8c7e9..c6be22ed 100644 --- a/varnish-cache/bin/varnishtest/tests/b00010.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00010.vtc @@ -2,14 +2,12 @@ test "Check simple list hasher" -varnish v1 -arg "-h simple_list -b 127.0.0.1:9080" -start - server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" -} +} -start -server s1 -start +varnish v1 -arg "-h simple_list" -vcl+backend {} -start client c1 { txreq -url "/" @@ -19,10 +17,4 @@ client c1 { rxresp expect resp.status == 200 expect resp.http.x-varnish == "1002 1001" -} - -client c1 -run - -server s1 -wait - -varnish v1 -stop +} -run diff --git a/varnish-cache/bin/varnishtest/tests/b00011.vtc b/varnish-cache/bin/varnishtest/tests/b00011.vtc index cc43db7d..4ad854a4 100644 --- a/varnish-cache/bin/varnishtest/tests/b00011.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00011.vtc @@ -2,23 +2,19 @@ test "Check HTTP/1.0 EOF transmission" -varnish v1 -arg "-h simple_list -b 127.0.0.1:9080" -start - server s1 { rxreq txresp -hdr "Connection: close" send "Body line 1\n" send "Body line 2\n" send "Body line 3\n" -} +} -start -server s1 -start +varnish v1 -vcl+backend {} -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.content-length == 36 -} - -client c1 -run +} -run diff --git a/varnish-cache/bin/varnishtest/tests/b00012.vtc b/varnish-cache/bin/varnishtest/tests/b00012.vtc index f3a5e71e..a41294e7 100644 --- a/varnish-cache/bin/varnishtest/tests/b00012.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00012.vtc @@ -2,8 +2,6 @@ test "Check pipelining" -varnish v1 -arg "-h simple_list -b 127.0.0.1:9080" -start - server s1 { rxreq expect req.url == "/foo" @@ -11,9 +9,9 @@ server s1 { rxreq expect req.url == "/bar" txresp -body "foobar" -} +} -start -server s1 -start +varnish v1 -vcl+backend {} -start client c1 { send "GET /foo HTTP/1.1\n\nGET /bar HTTP/1.1\n\nGET /bar HTTP/1.1\n\n" @@ -29,6 +27,6 @@ client c1 { expect resp.status == 200 expect resp.http.content-length == 6 expect resp.http.x-varnish == "1003 1002" -} +} -run -client c1 -run +varnish v1 -expect sess_pipeline == 2 diff --git a/varnish-cache/bin/varnishtest/tests/b00013.vtc b/varnish-cache/bin/varnishtest/tests/b00013.vtc index cf5f5081..eac54362 100644 --- a/varnish-cache/bin/varnishtest/tests/b00013.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00013.vtc @@ -2,8 +2,6 @@ test "Check read-head / partial pipelining" -varnish v1 -arg "-h simple_list -b 127.0.0.1:9080" -start - server s1 { rxreq expect req.url == "/foo" @@ -11,9 +9,9 @@ server s1 { rxreq expect req.url == "/bar" txresp -body "foobar" -} +} -start -server s1 -start +varnish v1 -vcl+backend {} -start client c1 { send "GET /foo HTTP/1.1\n\nGET " @@ -31,6 +29,6 @@ client c1 { expect resp.status == 200 expect resp.http.content-length == 6 expect resp.http.x-varnish == "1003 1002" -} +} -run -client c1 -run +varnish v1 -expect sess_readahead == 2 diff --git a/varnish-cache/bin/varnishtest/tests/b00014.vtc b/varnish-cache/bin/varnishtest/tests/b00014.vtc index bf7686f2..71049d2b 100644 --- a/varnish-cache/bin/varnishtest/tests/b00014.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00014.vtc @@ -3,7 +3,7 @@ test "Check -f command line arg" shell "echo 'backend foo { .host = \"127.0.0.1\"; .port = \"9080\"; }' > /tmp/_b00014.vcl" -varnish v1 -arg "-h simple_list -f /tmp/_b00014.vcl" -start +varnish v1 -arg "-f /tmp/_b00014.vcl" -start server s1 { rxreq @@ -19,7 +19,7 @@ client c1 { rxresp } -run -varnish v1 -cli "vcl.load foo /tmp/_b00014.vcl" -cli "vcl.use foo" +varnish v1 -cliok "vcl.load foo /tmp/_b00014.vcl" -cliok "vcl.use foo" client c1 { txreq -url /bar diff --git a/varnish-cache/bin/varnishtest/tests/b00015.vtc b/varnish-cache/bin/varnishtest/tests/b00015.vtc index b0c249bf..48c6cd67 100644 --- a/varnish-cache/bin/varnishtest/tests/b00015.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00015.vtc @@ -2,7 +2,6 @@ test "Check synthetic error page caching" - # First test that an internally generated error is not cached varnish v1 -vcl { @@ -41,8 +40,6 @@ client c1 { expect resp.http.X-varnish == "1003" } -run -server s1 -wait - client c1 { txreq -url "/" rxresp @@ -64,7 +61,7 @@ varnish v1 -vcl+backend { set obj.ttl = 10m; } } - } +} client c1 { txreq -url "/2" @@ -73,8 +70,6 @@ client c1 { expect resp.http.X-varnish == "1005" } -run -server s1 -wait - client c1 { txreq -url "/2" rxresp -- 2.39.5