Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oob_probe
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
oob_probe
Commits
b4082c9c
Commit
b4082c9c
authored
Oct 24, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a test for error handling
parent
1d24988c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
137 additions
and
1 deletion
+137
-1
test11.vtc
src/tests/test11.vtc
+136
-0
vmod.c
src/vmod.c
+1
-1
No files found.
src/tests/test11.vtc
0 → 100644
View file @
b4082c9c
varnishtest "Test error handling for VMOD oob_probe"
server s1 {} -start
server s2 {} -start
varnish v1 -vcl {
backend default { .host = "${s1_addr}"; }
} -start
varnish v1 -errvcl {Symbol not found: 'rr' (expected type BACKEND):} {
import oob_probe from "${vmod_topbuild}/src/.libs/libvmod_oob_probe.so";
import ${vmod_directors};
probe p { .url = "/"; }
backend s1 {
.host = "${s1_addr}";
.port = "${s1_port}";
}
sub vcl_init {
new rr = directors.round_robin();
oob_probe.port(rr, p, "${s2_port}");
}
}
varnish v1 -errvcl {Symbol not found: 'rr' (expected type BACKEND):} {
import oob_probe from "${vmod_topbuild}/src/.libs/libvmod_oob_probe.so";
import ${vmod_directors};
probe p { .url = "/"; }
backend s1 {
.host = "${s1_addr}";
.port = "${s1_port}";
}
sub vcl_init {
new rr = directors.round_robin();
oob_probe.addr(rr, p, "${s2_addr}", "${s2_port}");
}
}
varnish v1 -errvcl "vmod oob_probe error: Bad port specification: invalid" {
import oob_probe from "${vmod_topbuild}/src/.libs/libvmod_oob_probe.so";
probe p { .url = "/"; }
backend s1 {
.host = "${s1_addr}";
.port = "${s1_port}";
}
sub vcl_init {
oob_probe.port(s1, p, "invalid");
}
}
varnish v1 -errvcl "vmod oob_probe error: Cannot resolve invalid:${s2_port} as a unique IPv4 or IPv6 address" {
import oob_probe from "${vmod_topbuild}/src/.libs/libvmod_oob_probe.so";
probe p { .url = "/"; }
backend s1 {
.host = "${s1_addr}";
.port = "${s1_port}";
}
sub vcl_init {
oob_probe.addr(s1, p, "invalid", "${s2_port}");
}
}
varnish v1 -vcl {
import oob_probe from "${vmod_topbuild}/src/.libs/libvmod_oob_probe.so";
import ${vmod_std};
probe p { .url = "/"; }
backend s1 {
.host = "${s1_addr}";
.port = "${s1_port}";
}
sub vcl_recv {
oob_probe.port(s1, p, "invalid");
if (std.healthy(s1)) {
return(synth(200,"Backend healthy"));
} else {
return(synth(500,"Backend sick"));
}
}
}
logexpect l1 -v v1 {
expect 0 * Begin req
expect * = VCL_Error "Bad port specification: invalid$"
expect * = End
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.body ~ "Backend healthy"
} -run
logexpect l1 -wait
varnish v1 -vcl {
import oob_probe from "${vmod_topbuild}/src/.libs/libvmod_oob_probe.so";
import ${vmod_std};
probe p { .url = "/"; }
backend s1 {
.host = "${s1_addr}";
.port = "${s1_port}";
}
sub vcl_recv {
oob_probe.addr(s1, p, "invalid", "${s2_port}");
if (std.healthy(s1)) {
return(synth(200,"Backend healthy"));
} else {
return(synth(500,"Backend sick"));
}
}
}
logexpect l2 -v v1 {
expect 0 * Begin req
expect * = VCL_Error "Cannot resolve invalid:${s2_port}"
expect * = End
} -start
client c1 -run
logexpect l2 -wait
src/vmod.c
View file @
b4082c9c
...
...
@@ -132,7 +132,7 @@ vmod_port(VRT_CTX, VCL_BACKEND be, VCL_PROBE probe, VCL_STRING port)
sa6
=
get_suckaddr
(
bp
->
ipv6_addr
,
port
,
AF_INET6
);
if
(
sa4
==
NULL
&&
sa6
==
NULL
)
{
errmsg
(
ctx
,
"vmod oob_probe error: "
"Bad port specification %s"
,
port
);
"Bad port specification
:
%s"
,
port
);
return
;
}
insert_probe
(
bp
,
probe
,
sa4
,
sa6
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment