Skip to content

Commit 51b0fc9

Browse files
sobolevsvwalid-git
authored andcommitted
HSH: Add more coverage for ban_any_variant
Refs: varnishcache#4236
1 parent 5f2fc18 commit 51b0fc9

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

bin/varnishtest/tests/c00134.vtc

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
varnishtest "Optimized HSH_Lookup - ban is checked after Vary is matched"
2+
3+
server s1 {
4+
rxreq
5+
expect req.url == /foo
6+
expect req.http.foobar == "1"
7+
txresp -hdr "Vary: Foobar" -body "1111"
8+
9+
rxreq
10+
expect req.url == /foo
11+
expect req.http.foobar == "2"
12+
txresp -hdr "Vary: Foobar" -body "2222"
13+
14+
rxreq
15+
expect req.url == /foo
16+
expect req.http.foobar == "3"
17+
txresp -hdr "Vary: Foobar" -body "3333"
18+
19+
rxreq
20+
expect req.url == /foo
21+
expect req.http.foobar == "1"
22+
txresp -hdr "Vary: Foobar" -body "1111"
23+
24+
rxreq
25+
expect req.url == /foo
26+
expect req.http.foobar == "1"
27+
txresp -hdr "Vary: Foobar" -body "1111"
28+
29+
} -start
30+
31+
varnish v1 -arg "-p ban_any_variant=0" -vcl+backend {
32+
sub vcl_backend_response {
33+
set beresp.http.url = bereq.url;
34+
}
35+
} -start
36+
37+
38+
client c1 {
39+
txreq -url /foo -hdr "Foobar: 1"
40+
rxresp
41+
expect resp.body == "1111"
42+
} -run
43+
44+
client c1 {
45+
txreq -url /foo -hdr "Foobar: 2"
46+
rxresp
47+
expect resp.body == "2222"
48+
} -run
49+
50+
client c1 {
51+
txreq -url /foo -hdr "Foobar: 3"
52+
rxresp
53+
expect resp.body == "3333"
54+
55+
} -run
56+
57+
varnish v1 -expect n_object == 3
58+
varnish v1 -expect cache_hit == 0
59+
varnish v1 -expect cache_miss == 3
60+
61+
client c1 {
62+
txreq -url /foo -hdr "Foobar: 1"
63+
rxresp
64+
} -run
65+
66+
varnish v1 -expect cache_hit == 1
67+
varnish v1 -expect cache_miss == 3
68+
69+
varnish v1 -cliok "ban obj.http.url == /foo"
70+
varnish v1 -cliok "ban obj.http.url == /bar"
71+
varnish v1 -cliok "ban obj.http.url == /baz"
72+
73+
client c1 {
74+
txreq -url /foo -hdr "Foobar: 1"
75+
rxresp
76+
} -run
77+
78+
varnish v1 -expect bans_tested == 1
79+
varnish v1 -expect bans_tests_tested == 3
80+
varnish v1 -expect bans_obj_killed == 1
81+
varnish v1 -expect n_object == 3
82+
83+
84+
varnish v1 -expect cache_hit == 1
85+
varnish v1 -expect cache_miss == 4
86+
varnish v1 -expect client_req == 5

0 commit comments

Comments
 (0)