Mailing List Archive

r2672 - trunk/varnish-cache/bin/varnishtest
Author: phk
Date: 2008-06-15 13:22:55 +0200 (Sun, 15 Jun 2008)
New Revision: 2672

Added:
trunk/varnish-cache/bin/varnishtest/t001.vtc
Modified:
trunk/varnish-cache/bin/varnishtest/t000.vtc
trunk/varnish-cache/bin/varnishtest/vtc_server.c
Log:
Make the first testcase a test of the testprogram



Modified: trunk/varnish-cache/bin/varnishtest/t000.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/t000.vtc 2008-06-15 11:17:45 UTC (rev 2671)
+++ trunk/varnish-cache/bin/varnishtest/t000.vtc 2008-06-15 11:22:55 UTC (rev 2672)
@@ -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 -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
-}

Added: trunk/varnish-cache/bin/varnishtest/t001.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/t001.vtc (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/t001.vtc 2008-06-15 11:22:55 UTC (rev 2672)
@@ -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
+}

Modified: trunk/varnish-cache/bin/varnishtest/vtc_server.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_server.c 2008-06-15 11:17:45 UTC (rev 2671)
+++ trunk/varnish-cache/bin/varnishtest/vtc_server.c 2008-06-15 11:22:55 UTC (rev 2672)
@@ -170,6 +170,11 @@
av++;
continue;
}
+ if (!strcmp(*av, "-listen")) {
+ s->listen = av[1];
+ av++;
+ continue;
+ }
if (!strcmp(*av, "-start")) {
server_start(s);
continue;