Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-backend_dyn
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
libvmod-backend_dyn
Commits
77f591c9
Commit
77f591c9
authored
Nov 08, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test v00006.vtc
parent
f4c4642b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
109 additions
and
0 deletions
+109
-0
v00006.vtc
src/tests/v00006.vtc
+109
-0
No files found.
src/tests/v00006.vtc
0 → 100644
View file @
77f591c9
varnishtest "VCL: Test backend retirement"
#
# This case is quite sensitive to ordering of the worker threads because
# it has so little actual traffic. In a real world setting, this should
# not be an issue.
#
# First do one request to get a work-thread that holds a VCL reference
server s1 {
rxreq
expect req.url == "/bar"
txresp
} -start
# Only one pool, to avoid getting more than one work thread
varnish v1 -arg "-p thread_pools=1" -vcl {
import backend_dyn from "${vmod_topbuild}/src/.libs/libvmod_backend_dyn.so";
backend dummy { .host = "${bad_ip}"; }
sub vcl_init {
if (!backend_dyn.create(name="b1", host="${s1_addr}",
port="${s1_port}")) {
return(fail);
}
}
sub vcl_recv {
set req.backend_hint = backend_dyn.by_name("b1");
}
} -start
# Give the varnishd a chance to start and create workers etc.
# NB: This is important for to avoid mis-ordering of the workers.
delay 1
client c1 {
txreq -url /bar
rxresp
expect resp.status == 200
} -run
server s1 -wait
varnish v1 -expect n_backend == 2
varnish v1 -expect n_vcl_avail == 1
varnish v1 -expect n_vcl_discard == 0
# Set up a new VCL and backend
server s2 {
rxreq
expect req.url == "/foo"
txresp
} -start
varnish v1 -vcl {
import backend_dyn from "${vmod_topbuild}/src/.libs/libvmod_backend_dyn.so";
backend dummy { .host = "${bad_ip}"; }
sub vcl_init {
if (!backend_dyn.create(name="b2", host="${s2_addr}",
port="${s2_port}")) {
return(fail);
}
}
sub vcl_recv {
set req.backend_hint = backend_dyn.by_name("b2");
}
}
varnish v1 -expect n_backend == 4
varnish v1 -expect n_vcl_avail == 2
varnish v1 -expect n_vcl_discard == 0
varnish v1 -cli "vcl.list"
# Discard the first VCL
varnish v1 -cli "vcl.discard vcl1"
# Give expiry thread a chance to let go
delay 2
# It won't go away as long as the workthread holds a VCL reference
varnish v1 -expect n_backend == 4
varnish v1 -expect n_vcl_avail == 1
varnish v1 -expect n_vcl_discard == 1
# Do another request through the new VCL to the new backend
client c1 {
txreq -url /foo
rxresp
expect resp.status == 200
} -run
server s2 -wait
# The workthread should have released its VCL reference now
# but we need to tickle the CLI to notice
varnish v1 -cli "vcl.list"
varnish v1 -expect n_backend == 2
varnish v1 -expect n_vcl_avail == 1
varnish v1 -expect n_vcl_discard == 0
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