From 41cfd08c13080de01c330fc4abe3b736a7c84351 Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 19 Aug 2008 20:48:52 +0000 Subject: [PATCH] Add a test-case that exercises the backend-polling a bit. It does not 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 --- .../bin/varnishtest/tests/c00017.vtc | 63 +++++++++++++++++++ varnish-cache/bin/varnishtest/vtc_http.c | 9 +++ 2 files changed, 72 insertions(+) create mode 100644 varnish-cache/bin/varnishtest/tests/c00017.vtc diff --git a/varnish-cache/bin/varnishtest/tests/c00017.vtc b/varnish-cache/bin/varnishtest/tests/c00017.vtc new file mode 100644 index 00000000..fcd44245 --- /dev/null +++ b/varnish-cache/bin/varnishtest/tests/c00017.vtc @@ -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" diff --git a/varnish-cache/bin/varnishtest/vtc_http.c b/varnish-cache/bin/varnishtest/vtc_http.c index 007ae066..b8677f2f 100644 --- a/varnish-cache/bin/varnishtest/vtc_http.c +++ b/varnish-cache/bin/varnishtest/vtc_http.c @@ -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); -- 2.39.5