blob: e896c05e8364c9894d1d49be7c9ebc86c9043c91 [file] [log] [blame]
PiBa-NLb07e7b42019-01-12 21:57:48 +01001varnishtest "Webgui stats page check filtering with scope and changing server state"
PiBa-NLb07e7b42019-01-12 21:57:48 +01002
3feature ignore_unknown_macro
4
5server s1 {
6} -start
7
8haproxy h1 -conf {
9 global
Willy Tarreaue1465c12021-05-09 14:41:41 +020010 # WT: limit false-positives causing "HTTP header incomplete" due to
11 # idle server connections being randomly used and randomly expiring
12 # under us.
13 tune.idle-pool.shared off
14
PiBa-NLb07e7b42019-01-12 21:57:48 +010015 defaults
16 mode http
PiBa-NLb07e7b42019-01-12 21:57:48 +010017
18 frontend fe1
19 bind "fd@${fe1}"
20 stats enable
21 stats refresh 5s
22 stats uri /
23 stats admin if TRUE
24
25 backend b1
26 server srv1 ${s1_addr}:${s1_port}
27 server srv2 ${s1_addr}:${s1_port}
28 server srv3 ${s1_addr}:${s1_port}
29
30 backend b2
31 server srv1 ${s1_addr}:${s1_port}
32 server srv2 ${s1_addr}:${s1_port}
33
34} -start
35
36client c1 -connect ${h1_fe1_sock} {
37 txreq -url "/;csv;"
38 rxresp
39 expect resp.status == 200
40} -run
41
42client c2 -connect ${h1_fe1_sock} {
43 txreq -url "/?;csv;scope=b1"
44 rxresp
45 expect resp.status == 200
46} -run
47
48haproxy h1 -cli {
49 send "show stat"
50 expect ~ .*
51}
52
53client c3 -connect ${h1_fe1_sock} {
54 txreq -url "/"
55 rxresp
56 expect resp.status == 200
57
58 txreq -url "/?;csv;scope=b1"
59 rxresp
60 expect resp.status == 200
61 expect resp.body ~ ".*\nb1,BACKEND.*"
62 expect resp.body !~ ".*\nb2,BACKEND.*"
63
64 txreq -req "POST" -url "/?scope=b2" -body "s=srv1&s=srv2&s=srv3&action=maint&b=%233"
65 rxresp
66 expect resp.status == 303
67
68 txreq -req "POST" -url "/" -body "s=srv2&action=drain&b=%233"
69 rxresp
70 expect resp.status == 303
71
72 txreq -req "POST" -url "/" -body "s=srv1&action=maint&b=%234"
73 rxresp
74 expect resp.status == 303
75
76 txreq -url "/?;csv;scope=fe1"
77 rxresp
78 expect resp.status == 200
79} -run
80
81haproxy h1 -cli {
82 send "show stat"
83 expect ~ "\nb1,srv1.*MAINT.*\nb1,srv2.*DRAIN.*\nb1,srv3.*MAINT.*\nb1,BACKEND.*DOWN.*\nb2,srv1.*MAINT.*\nb2,srv2.*no check.*\nb2,BACKEND.*UP"
84} -wait