r3169 - in trunk/varnish-cache: bin/varnishd bin/varnishtest/tests include lib/libvcl

tfheen at projects.linpro.no tfheen at projects.linpro.no
Mon Sep 8 11:49:02 CEST 2008


Author: tfheen
Date: 2008-09-08 11:49:01 +0200 (Mon, 08 Sep 2008)
New Revision: 3169

Added:
   trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc
Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
   trunk/varnish-cache/include/vrt_obj.h
   trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
   trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl
   trunk/varnish-cache/lib/libvcl/vcc_obj.c
Log:
Rename backend.health to req.backend.health and add test


Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2008-09-08 09:47:08 UTC (rev 3168)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2008-09-08 09:49:01 UTC (rev 3169)
@@ -585,7 +585,7 @@
 }
 
 unsigned
-VRT_r_backend_healthy(const struct sess *sp)
+VRT_r_req_backend_healthy(const struct sess *sp)
 {
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC);

Added: trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc	                        (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc	2008-09-08 09:49:01 UTC (rev 3169)
@@ -0,0 +1,48 @@
+# $Id$
+
+test "Check req.backend.healthy"
+
+server s1 {
+	rxreq
+	expect req.url == "/"
+	txresp -body "slash"
+} -start -repeat 4
+
+varnish v1 -vcl {
+
+	backend default {
+		.host = "127.0.0.1";
+		.port = "9080";
+		.max_connections = 1;
+		.probe = {
+			.url = "/";
+			.timeout = 100 ms;
+			.interval = 1s;
+			.window = 3;
+			.threshold = 2;
+		}
+	}
+
+	sub vcl_recv {
+		if (req.backend.healthy) {
+			error 200 "Backend healthy";
+		} else {
+			error 500 "Backend sick";
+		}
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.status == 500
+} -run
+
+shell "sleep 1"
+
+client c2 {
+	txreq
+	rxresp
+	expect resp.status == 200
+} -start
+

Modified: trunk/varnish-cache/include/vrt_obj.h
===================================================================
--- trunk/varnish-cache/include/vrt_obj.h	2008-09-08 09:47:08 UTC (rev 3168)
+++ trunk/varnish-cache/include/vrt_obj.h	2008-09-08 09:49:01 UTC (rev 3169)
@@ -52,4 +52,4 @@
 const char * VRT_r_resp_response(const struct sess *);
 void VRT_l_resp_response(const struct sess *, const char *, ...);
 double VRT_r_now(const struct sess *);
-unsigned VRT_r_backend_healthy(const struct sess *);
+unsigned VRT_r_req_backend_healthy(const struct sess *);

Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c	2008-09-08 09:47:08 UTC (rev 3168)
+++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c	2008-09-08 09:49:01 UTC (rev 3169)
@@ -510,5 +510,5 @@
 	vsb_cat(sb, "const char * VRT_r_resp_response(const struct sess *);\n");
 	vsb_cat(sb, "void VRT_l_resp_response(const struct sess *, const char *, ...);\n");
 	vsb_cat(sb, "double VRT_r_now(const struct sess *);\n");
-	vsb_cat(sb, "unsigned VRT_r_backend_healthy(const struct sess *);\n");
+	vsb_cat(sb, "unsigned VRT_r_req_backend_healthy(const struct sess *);\n");
 }

Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl	2008-09-08 09:47:08 UTC (rev 3168)
+++ trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl	2008-09-08 09:49:01 UTC (rev 3169)
@@ -216,7 +216,7 @@
 	    {recv pipe pass hash miss hit fetch deliver discard timeout}
 	    "const struct sess *"
     }
-    { backend.healthy	RO BOOL
+    { req.backend.healthy	RO BOOL
 	    {recv pipe pass hash miss hit fetch deliver discard timeout}
 	    "const struct sess *"
     }

Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_obj.c	2008-09-08 09:47:08 UTC (rev 3168)
+++ trunk/varnish-cache/lib/libvcl/vcc_obj.c	2008-09-08 09:49:01 UTC (rev 3169)
@@ -235,8 +235,8 @@
 	    0,
 	    VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_DISCARD | VCL_MET_TIMEOUT
 	},
-	{ "backend.healthy", BOOL, 15,
-	    "VRT_r_backend_healthy(sp)",
+	{ "req.backend.healthy", BOOL, 19,
+	    "VRT_r_req_backend_healthy(sp)",
 	    NULL,
 	    V_RO,
 	    0,




More information about the varnish-commit mailing list