mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-23 13:17:16 +00:00
1704efee89
it does not seem to have a reason to close connections after each request; reflect that in tests by doing all requests within the same client. Signed-off-by: William Dauchy <wdauchy@gmail.com>
66 lines
1.4 KiB
Plaintext
66 lines
1.4 KiB
Plaintext
varnishtest "prometheus exporter test"
|
|
|
|
#REQUIRE_VERSION=2.0
|
|
#REQUIRE_SERVICES=prometheus-exporter
|
|
|
|
feature ignore_unknown_macro
|
|
|
|
server s1 {
|
|
rxreq
|
|
txresp
|
|
} -repeat 2 -start
|
|
|
|
haproxy h1 -conf {
|
|
defaults
|
|
mode http
|
|
timeout connect 1s
|
|
timeout client 1s
|
|
timeout server 1s
|
|
|
|
listen stats
|
|
bind "fd@${stats}"
|
|
http-request use-service prometheus-exporter if { path /metrics }
|
|
|
|
frontend fe
|
|
bind "fd@${fe}"
|
|
default_backend be
|
|
|
|
backend be
|
|
server s1 ${s1_addr}:${s1_port}
|
|
} -start
|
|
|
|
client c1 -connect ${h1_stats_sock} {
|
|
txreq -url "/metrics"
|
|
rxresp
|
|
expect resp.status == 200
|
|
expect resp.body ~ ".*haproxy_process.*"
|
|
expect resp.body ~ ".*haproxy_frontend.*"
|
|
expect resp.body ~ ".*haproxy_backend.*"
|
|
expect resp.body ~ ".*haproxy_server.*"
|
|
|
|
txreq -url "/metrics?scope="
|
|
rxresp
|
|
expect resp.status == 200
|
|
expect resp.bodylen == 0
|
|
|
|
txreq -url "/metrics?scope=server"
|
|
rxresp
|
|
expect resp.status == 200
|
|
expect resp.body !~ ".*haproxy_process.*"
|
|
expect resp.body !~ ".*haproxy_frontend.*"
|
|
expect resp.body !~ ".*haproxy_backend.*"
|
|
expect resp.body ~ ".*haproxy_server.*"
|
|
|
|
txreq -url "/metrics?scope=frontend&scope=backend"
|
|
rxresp
|
|
expect resp.status == 200
|
|
expect resp.body !~ ".*haproxy_process.*"
|
|
expect resp.body ~ ".*haproxy_frontend.*"
|
|
expect resp.body ~ ".*haproxy_backend.*"
|
|
expect resp.body !~ ".*haproxy_server.*"
|
|
|
|
txreq -url "/metrics?scope"
|
|
rxresp
|
|
expect resp.status == 400
|
|
} -run
|