Commit 47219c78 authored by Tollef Fog Heen's avatar Tollef Fog Heen

Rename backend.health to req.backend.health and add test


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3169 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent d20a44e4
......@@ -585,7 +585,7 @@ VRT_r_obj_hash(const struct sess *sp)
}
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);
......
# $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
......@@ -52,4 +52,4 @@ void VRT_l_resp_status(const struct sess *, int);
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 *);
......@@ -510,5 +510,5 @@ vcl_output_lang_h(struct vsb *sb)
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");
}
......@@ -216,7 +216,7 @@ set spobj {
{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 *"
}
......
......@@ -235,8 +235,8 @@ struct var vcc_vars[] = {
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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment