From: phk Date: Sun, 15 Jun 2008 11:22:55 +0000 (+0000) Subject: Make the first testcase a test of the testprogram X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4936ad7cc2b50a39925e41ddeb9588d786ebc464;p=varnish Make the first testcase a test of the testprogram git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2672 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishtest/t000.vtc b/varnish-cache/bin/varnishtest/t000.vtc index 3bf14e7c..0d8c5b40 100644 --- a/varnish-cache/bin/varnishtest/t000.vtc +++ b/varnish-cache/bin/varnishtest/t000.vtc @@ -1,7 +1,7 @@ -# Test that we get anything through at all +# Quis custodiet ipsos custodes? # -server s1 -repeat 3 { +server s1 -listen :9080 { rxreq expect url == "/" txresponse -body "0123456789" @@ -9,67 +9,13 @@ server s1 -repeat 3 { server s1 -start -client c1 { +client c1 -connect localhost:9080 { txreq -url "/" rxresponse expect status == 200 expect length == 10 } - -####################################################################### -# Test trivial pipe mode - -vcl { - $s1; - sub vcl_recv { - set req.backend = s1; - pipe; - } -} - -client c1 -run - -####################################################################### -# Test trivial pass mode - -vcl { - $s1; - sub vcl_recv { - set req.backend = s1; - pass; - } -} - -client c1 -run - -####################################################################### -# Test trivial cache mode - -vcl { - $s1; - sub vcl_recv { - set req.backend = s1; - } -} - client c1 -run server s1 -wait - -####################################################################### -# And see that it stuck in cache - -client c1 -run - -varnish stop - -stats { - expect client_conn == 4 - expect client_req == 4 - expect cache_hit == 1 - expect cache_miss == 1 - expect s_pipe == 1 - expect s_pass == 1 - expect s_fetch == 2 -} diff --git a/varnish-cache/bin/varnishtest/t001.vtc b/varnish-cache/bin/varnishtest/t001.vtc new file mode 100644 index 00000000..3bf14e7c --- /dev/null +++ b/varnish-cache/bin/varnishtest/t001.vtc @@ -0,0 +1,75 @@ +# Test that we get anything through at all +# + +server s1 -repeat 3 { + rxreq + expect url == "/" + txresponse -body "0123456789" +} + +server s1 -start + +client c1 { + txreq -url "/" + rxresponse + expect status == 200 + expect length == 10 +} + + +####################################################################### +# Test trivial pipe mode + +vcl { + $s1; + sub vcl_recv { + set req.backend = s1; + pipe; + } +} + +client c1 -run + +####################################################################### +# Test trivial pass mode + +vcl { + $s1; + sub vcl_recv { + set req.backend = s1; + pass; + } +} + +client c1 -run + +####################################################################### +# Test trivial cache mode + +vcl { + $s1; + sub vcl_recv { + set req.backend = s1; + } +} + +client c1 -run + +server s1 -wait + +####################################################################### +# And see that it stuck in cache + +client c1 -run + +varnish stop + +stats { + expect client_conn == 4 + expect client_req == 4 + expect cache_hit == 1 + expect cache_miss == 1 + expect s_pipe == 1 + expect s_pass == 1 + expect s_fetch == 2 +} diff --git a/varnish-cache/bin/varnishtest/vtc_server.c b/varnish-cache/bin/varnishtest/vtc_server.c index 46de8b39..56a0a0a3 100644 --- a/varnish-cache/bin/varnishtest/vtc_server.c +++ b/varnish-cache/bin/varnishtest/vtc_server.c @@ -170,6 +170,11 @@ cmd_server(char **av, void *priv) av++; continue; } + if (!strcmp(*av, "-listen")) { + s->listen = av[1]; + av++; + continue; + } if (!strcmp(*av, "-start")) { server_start(s); continue;