PiBa-NL | b07e7b4 | 2019-01-12 21:57:48 +0100 | [diff] [blame] | 1 | varnishtest "Webgui stats page check filtering with scope and changing server state" |
PiBa-NL | b07e7b4 | 2019-01-12 21:57:48 +0100 | [diff] [blame] | 2 | |
| 3 | feature ignore_unknown_macro |
| 4 | |
| 5 | server s1 { |
| 6 | } -start |
| 7 | |
| 8 | haproxy h1 -conf { |
| 9 | global |
Willy Tarreau | e1465c1 | 2021-05-09 14:41:41 +0200 | [diff] [blame] | 10 | # 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-NL | b07e7b4 | 2019-01-12 21:57:48 +0100 | [diff] [blame] | 15 | defaults |
| 16 | mode http |
PiBa-NL | b07e7b4 | 2019-01-12 21:57:48 +0100 | [diff] [blame] | 17 | |
| 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 | |
| 36 | client c1 -connect ${h1_fe1_sock} { |
| 37 | txreq -url "/;csv;" |
| 38 | rxresp |
| 39 | expect resp.status == 200 |
| 40 | } -run |
| 41 | |
| 42 | client c2 -connect ${h1_fe1_sock} { |
| 43 | txreq -url "/?;csv;scope=b1" |
| 44 | rxresp |
| 45 | expect resp.status == 200 |
| 46 | } -run |
| 47 | |
| 48 | haproxy h1 -cli { |
| 49 | send "show stat" |
| 50 | expect ~ .* |
| 51 | } |
| 52 | |
| 53 | client 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 | |
| 81 | haproxy 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 |