]> err.no Git - varnish/commitdiff
Add a test-case that exercises the backend-polling a bit. It does not
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 19 Aug 2008 20:48:52 +0000 (20:48 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 19 Aug 2008 20:48:52 +0000 (20:48 +0000)
really check anything yet, because we lack the stats counters to test.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3112 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishtest/tests/c00017.vtc [new file with mode: 0644]
varnish-cache/bin/varnishtest/vtc_http.c

diff --git a/varnish-cache/bin/varnishtest/tests/c00017.vtc b/varnish-cache/bin/varnishtest/tests/c00017.vtc
new file mode 100644 (file)
index 0000000..fcd4424
--- /dev/null
@@ -0,0 +1,63 @@
+# $Id: c00016.vtc 3012 2008-07-24 12:22:35Z des $
+
+test "Test Backend Polling"
+
+varnish v1 -vcl { 
+
+       backend foo {
+               .host = "127.0.0.1";
+               .port = "9080";
+               .probe = {
+                       .timeout = 1 s;
+                       .interval = 0.5 s;
+               }
+       }
+       
+} -start
+
+server s1 {
+       rxreq
+       expect req.url == "/"
+       txresp -hdr "Bar: foo" -body "foobar" 
+} 
+
+# Handle  probes
+server s1 -start -wait
+server s1 -start -wait
+server s1 -start -wait
+server s1 -start -wait
+server s1 -start -wait
+server s1 -start -wait
+server s1 -start -wait
+server s1 -start -wait
+
+server s1 {
+       rxreq
+       expect req.url == "/"
+       txresp -status 404 -hdr "Bar: foo" -body "foobar" 
+} -start -wait
+
+server s1 {
+       rxreq
+       expect req.url == "/"
+       txresp -status 200 -hdr "Bar: foo" -body "foobar" 
+} -start -wait
+
+server s1 {
+       rxreq
+       expect req.url == "/"
+       txresp -proto "FROBOZ" -status 200 -hdr "Bar: foo" -body "foobar" 
+} -start -wait
+
+server s1 {
+} -start -wait
+
+server s1 {
+       rxreq
+       expect req.url == "/"
+       delay 2
+} -start -wait
+
+delay 2
+
+varnish v1 -cli "debug.health"
index 007ae0660dc8367446e1a2a95f33bd1bd92654db..b8677f2fabf51f1dc530dee1365a2dcf17bffaf4 100644 (file)
@@ -167,6 +167,15 @@ cmd_http_expect(CMD_ARGS)
                        vtc_log(hp->vl, 4, "EXPECT %s (%s) %s %s (%s) match",
                            av[0], lhs, av[1], av[2], rhs);
                }
+       } else if (!strcmp(cmp, "!=")) {
+               if (!strcmp(lhs, rhs)) {
+                       vtc_log(hp->vl, 0, "EXPECT %s (%s) %s %s (%s) failed",
+                           av[0], lhs, av[1], av[2], rhs);
+                       exit (1);
+               } else {
+                       vtc_log(hp->vl, 4, "EXPECT %s (%s) %s %s (%s) match",
+                           av[0], lhs, av[1], av[2], rhs);
+               }
        } else {
                vtc_log(hp->vl, 0, "EXPECT %s (%s) %s %s (%s) not implemented",
                    av[0], lhs, av[1], av[2], rhs);