Commit 10e3b177 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

vtc: Move the remaining vmod_directors test cases

With a tiny bit of polish here and there.
parent 7cfe14da
...@@ -17,7 +17,7 @@ Naming scheme ...@@ -17,7 +17,7 @@ Naming scheme
id ~ ^a02 --> HTTP2 id ~ ^a02 --> HTTP2
id ~ ^b --> Basic functionality tests id ~ ^b --> Basic functionality tests
id ~ ^c --> Complex functionality tests id ~ ^c --> Complex functionality tests
id ~ ^d --> Director VMOD tests id ~ ^d --> Director facility tests
id ~ ^e --> ESI tests id ~ ^e --> ESI tests
id ~ ^f --> Security related tests id ~ ^f --> Security related tests
id ~ ^g --> GZIP tests id ~ ^g --> GZIP tests
...@@ -34,3 +34,5 @@ Naming scheme ...@@ -34,3 +34,5 @@ Naming scheme
id ~ ^t02 --> HTTP2 id ~ ^t02 --> HTTP2
id ~ ^u --> Utilities and background processes id ~ ^u --> Utilities and background processes
id ~ ^v --> VCL tests: execute VRT functions id ~ ^v --> VCL tests: execute VRT functions
Coverage for individual VMODs is in "${top_srcdir}vmod/tests".
...@@ -2,17 +2,17 @@ varnishtest "shard director/int key" ...@@ -2,17 +2,17 @@ varnishtest "shard director/int key"
server s1 { server s1 {
rxreq rxreq
txresp -body "ech3Ooj" txresp
} -start } -start
server s2 { server s2 {
rxreq rxreq
txresp -body "ieQu2qua" txresp
} -start } -start
server s3 { server s3 {
rxreq rxreq
txresp -body "xiuFi3Pe" txresp
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
...@@ -36,31 +36,26 @@ varnish v1 -vcl+backend { ...@@ -36,31 +36,26 @@ varnish v1 -vcl+backend {
} }
sub vcl_recv { sub vcl_recv {
if (req.url == "/1") { set req.backend_hint = vd.backend(by=KEY, key=std.integer(req.http.key));
set req.backend_hint = vd.backend(by=KEY, key=1);
}
if (req.url == "/2") {
set req.backend_hint = vd.backend(by=KEY, key=2147483647);
}
if (req.url == "/3") {
set req.backend_hint = vd.backend(by=KEY, key=4294967295);
}
return(pass); return(pass);
} }
sub vcl_backend_response {
set beresp.http.backend = beresp.backend;
}
} -start } -start
client c1 { client c1 {
txreq -url /1 txreq -hdr "key: 1"
rxresp rxresp
expect resp.body == "ech3Ooj" expect resp.http.backend == s1
txreq -url /2 txreq -hdr "key: 2147483647"
rxresp rxresp
expect resp.body == "ieQu2qua" expect resp.http.backend == s2
txreq -url /3 txreq -hdr "key: 4294967295"
rxresp rxresp
expect resp.body == "xiuFi3Pe" expect resp.http.backend == s3
} -run } -run
varnishtest "shard director LAZY - d18.vtc" varnishtest "shard director LAZY - directors_c00003.vtc"
server s1 -repeat 2 { server s1 -repeat 2 {
rxreq rxreq
......
...@@ -2,17 +2,17 @@ varnishtest "shard director by req.url (default)" ...@@ -2,17 +2,17 @@ varnishtest "shard director by req.url (default)"
server s1 { server s1 {
rxreq rxreq
txresp -body "ech3Ooj" txresp
} -start } -start
server s2 { server s2 {
rxreq rxreq
txresp -body "ieQu2qua" txresp
} -start } -start
server s3 { server s3 {
rxreq rxreq
txresp -body "xiuFi3Pe" txresp
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
...@@ -31,19 +31,22 @@ varnish v1 -vcl+backend { ...@@ -31,19 +31,22 @@ varnish v1 -vcl+backend {
return(pass); return(pass);
} }
sub vcl_backend_response {
set beresp.http.backend = beresp.backend;
}
} -start } -start
client c1 { client c1 {
txreq -url /Boo0aixe txreq -url /Boo0aixe
rxresp rxresp
expect resp.body == "ech3Ooj" expect resp.http.backend == s1
txreq -url /eishoSu2 txreq -url /eishoSu2
rxresp rxresp
expect resp.body == "ieQu2qua" expect resp.http.backend == s2
txreq -url /Aunah3uo txreq -url /Aunah3uo
rxresp rxresp
expect resp.body == "xiuFi3Pe" expect resp.http.backend == s3
} -run } -run
varnishtest "d00017.vtc but with weights" varnishtest "directors_c00005.vtc but with weights"
server s1 { server s1 {
rxreq rxreq
......
varnishtest "shard director - same as d00017.vtc but setting backend in fetch" varnishtest "directors_c00007.vtc but setting backend in fetch"
server s1 { server s1 {
rxreq rxreq
......
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