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