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