blob: b88287a7aa69c58d80e02c0e45190c1b82af89bd [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 stats socket /tmp/haproxy.socket level admin
16
17 defaults
18 mode http
PiBa-NLb07e7b42019-01-12 21:57:48 +010019
20 frontend fe1
21 bind "fd@${fe1}"
22 stats enable
23 stats refresh 5s
24 stats uri /
25 stats admin if TRUE
26
27 backend b1
28 server srv1 ${s1_addr}:${s1_port}
29 server srv2 ${s1_addr}:${s1_port}
30 server srv3 ${s1_addr}:${s1_port}
31
32 backend b2
33 server srv1 ${s1_addr}:${s1_port}
34 server srv2 ${s1_addr}:${s1_port}
35
36} -start
37
38client c1 -connect ${h1_fe1_sock} {
39 txreq -url "/;csv;"
40 rxresp
41 expect resp.status == 200
42} -run
43
44client c2 -connect ${h1_fe1_sock} {
45 txreq -url "/?;csv;scope=b1"
46 rxresp
47 expect resp.status == 200
48} -run
49
50haproxy h1 -cli {
51 send "show stat"
52 expect ~ .*
53}
54
55client c3 -connect ${h1_fe1_sock} {
56 txreq -url "/"
57 rxresp
58 expect resp.status == 200
59
60 txreq -url "/?;csv;scope=b1"
61 rxresp
62 expect resp.status == 200
63 expect resp.body ~ ".*\nb1,BACKEND.*"
64 expect resp.body !~ ".*\nb2,BACKEND.*"
65
66 txreq -req "POST" -url "/?scope=b2" -body "s=srv1&s=srv2&s=srv3&action=maint&b=%233"
67 rxresp
68 expect resp.status == 303
69
70 txreq -req "POST" -url "/" -body "s=srv2&action=drain&b=%233"
71 rxresp
72 expect resp.status == 303
73
74 txreq -req "POST" -url "/" -body "s=srv1&action=maint&b=%234"
75 rxresp
76 expect resp.status == 303
77
78 txreq -url "/?;csv;scope=fe1"
79 rxresp
80 expect resp.status == 200
81} -run
82
83haproxy h1 -cli {
84 send "show stat"
85 expect ~ "\nb1,srv1.*MAINT.*\nb1,srv2.*DRAIN.*\nb1,srv3.*MAINT.*\nb1,BACKEND.*DOWN.*\nb2,srv1.*MAINT.*\nb2,srv2.*no check.*\nb2,BACKEND.*UP"
86} -wait