From 9c2a0963b4e96f6de5f21935bc3cf2f643cc4821 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 27 Jun 2008 12:44:47 +0000 Subject: [PATCH] Add test for simple restarts git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2853 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- .../bin/varnishtest/tests/c00009.vtc | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 varnish-cache/bin/varnishtest/tests/c00009.vtc diff --git a/varnish-cache/bin/varnishtest/tests/c00009.vtc b/varnish-cache/bin/varnishtest/tests/c00009.vtc new file mode 100644 index 00000000..29241235 --- /dev/null +++ b/varnish-cache/bin/varnishtest/tests/c00009.vtc @@ -0,0 +1,40 @@ +# $Id$ + +test "Test restarts" + +server s1 { + rxreq + expect req.url == "/foo" + txresp -status 404 +} -start + +server s2 -listen 127.0.0.1:9180 { + rxreq + expect req.url == "/foo" + txresp -body "foobar" +} -start + +varnish v1 -vcl+backend { + sub vcl_recv { + if (req.restarts == 0) { + set req.backend = s1; + } else { + set req.backend = s2; + } + } + + sub vcl_fetch { + if (obj.status != 200) { + restart; + } + } +} -start + +client c1 { + txreq -url "/foo" + rxresp + expect resp.status == 200 + expect resp.http.content-length == 6 +} + +client c1 -run -- 2.39.5