Commit 82158a0c authored by Federico G. Schwindt's avatar Federico G. Schwindt

Move vmod director tests to the d* space

parent f5845973
......@@ -16,10 +16,11 @@ Naming scheme
id ~ [a] --> varnishtest(1) tests
id ~ [b] --> Basic functionality tests
id ~ [c] --> Complex functionality tests
id ~ [d] --> Director VMOD tests
id ~ [e] --> ESI tests
id ~ [g] --> GZIP tests
id ~ [l] --> VSL tests
id ~ [m] --> VMOD tests
id ~ [m] --> VMOD tests excluding director
id ~ [p] --> Persistent tests
id ~ [r] --> Regression tests, same number as ticket
id ~ [s] --> Slow tests, expiry, grace etc.
......
varnishtest "Test vmod.directors round robin director"
varnishtest "Test round robin director"
server s1 {
rxreq
......@@ -22,10 +21,9 @@ server s4 {
txresp -body "4444"
} -start
varnish v1 -vcl+backend {
import ${vmod_directors};
sub vcl_init {
new rr = directors.round_robin();
rr.add_backend(s1);
......@@ -37,6 +35,7 @@ varnish v1 -vcl+backend {
sub vcl_backend_fetch {
set bereq.backend = rr.backend();
}
sub vcl_backend_response {
set beresp.http.where = bereq.backend + "-->" + beresp.backend;
}
......
......@@ -28,6 +28,7 @@ varnish v1 -vcl+backend {
sub vcl_recv {
return (pass);
}
sub vcl_backend_fetch {
set bereq.backend = fb1.backend();
}
......
......@@ -19,6 +19,7 @@ varnish v1 -vcl+backend {
sub vcl_backend_fetch {
set bereq.backend = foo.backend();
}
sub vcl_backend_response {
set beresp.http.where = bereq.backend + "-->" + beresp.backend;
}
......
varnishtest "Hash director"
varnishtest "Test hash director"
server s1 {
rxreq
......@@ -18,7 +18,6 @@ server s2 {
txresp -hdr "Foo: 8" -body "8"
} -start
varnish v1 -vcl+backend {
import ${vmod_directors};
......@@ -31,6 +30,7 @@ varnish v1 -vcl+backend {
sub vcl_recv {
return(pass);
}
sub vcl_backend_fetch {
if (bereq.url == "/nohdr") {
set bereq.backend = h1.backend(bereq.http.Void);
......@@ -42,6 +42,7 @@ varnish v1 -vcl+backend {
set bereq.backend = h1.backend(bereq.url);
}
}
sub vcl_backend_response {
set beresp.http.where = bereq.backend + "-->" + beresp.backend;
}
......@@ -73,6 +74,4 @@ client c1 {
txreq -url /nohdr
rxresp
expect resp.http.foo == "8"
} -run
......@@ -6,6 +6,7 @@ server s1 {
rxreq
txresp -body "1"
} -start
server s2 {
rxreq
txresp -body "22"
......@@ -16,10 +17,12 @@ server s2 {
rxreq
txresp -body "22"
} -start
server s3 {
rxreq
txresp -body "333"
} -start
server s4 {
rxreq
txresp -body "4444"
......@@ -45,6 +48,7 @@ varnish v1 -vcl+backend {
sub vcl_recv {
return(pass);
}
sub vcl_backend_fetch {
set bereq.backend = foo.backend();
}
......
varnishtest "Test round robin stacked within fallback"
server s1 -repeat 2 {
rxreq
txresp -body "1"
} -start
server s2 -repeat 4 {
rxreq
txresp -body "22"
} -start
server s3 -repeat 2 {
rxreq
txresp -body "333"
} -start
server s4 -repeat 2 {
rxreq
txresp -body "4444"
} -start
varnish v1 -vcl+backend {
import ${vmod_directors};
sub vcl_init {
new rr1 = directors.round_robin();
rr1.add_backend(s1);
rr1.add_backend(s2);
new rr2 = directors.round_robin();
rr2.add_backend(s3);
rr2.add_backend(s4);
new fb = directors.fallback();
fb.add_backend(rr1.backend());
fb.add_backend(rr2.backend());
}
sub vcl_recv {
return (pass);
}
sub vcl_backend_fetch {
set bereq.backend = fb.backend();
}
} -start
client c1 {
txreq
rxresp
expect resp.body == "1"
txreq
rxresp
expect resp.body == "22"
txreq
rxresp
expect resp.body == "1"
txreq
rxresp
expect resp.body == "22"
} -run
varnish v1 -cliok "backend.set_health s1 sick"
client c1 {
txreq
rxresp
expect resp.body == "22"
txreq
rxresp
expect resp.body == "22"
} -run
varnish v1 -cliok "backend.set_health s2 sick"
client c1 {
txreq
rxresp
expect resp.body == "333"
txreq
rxresp
expect resp.body == "4444"
txreq
rxresp
expect resp.body == "333"
txreq
rxresp
expect resp.body == "4444"
} -run
varnishtest "Test round robin director"
server s1 {
rxreq
txresp -body "1"
} -start
server s2 {
rxreq
txresp -body "22"
} -start
server s3 {
rxreq
txresp -body "333"
} -start
server s4 {
rxreq
txresp -body "4444"
} -start
varnish v1 -vcl+backend {
import ${vmod_directors};
sub vcl_init {
new batman = directors.round_robin();
batman.add_backend(s1);
batman.add_backend(s2);
batman.add_backend(s3);
batman.add_backend(s4);
}
sub vcl_backend_fetch {
set bereq.backend = batman.backend();
}
} -start
client c1 {
timeout 3
txreq -url "/foo1"
rxresp
expect resp.bodylen == 1
txreq -url "/foo2"
rxresp
expect resp.bodylen == 2
txreq -url "/foo3"
rxresp
expect resp.bodylen == 3
txreq -url "/foo4"
rxresp
expect resp.bodylen == 4
} -run
server s1 -start
server s2 -start
client c2 {
timeout 3
txreq -url "/foo11"
rxresp
expect resp.bodylen == 1
txreq -url "/foo22"
rxresp
expect resp.bodylen == 2
} -run
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