Skip to content

Commit 0c60d57

Browse files
committed
Add histogram_bucket test
1 parent 46e431b commit 0c60d57

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

t/023.histogram_buckets.t

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# vi:set ft=perl ts=4 sw=4 et fdm=marker:
2+
3+
use Test::Nginx::Socket;
4+
use Fcntl;
5+
6+
plan tests => repeat_each() * blocks() * 4;
7+
no_shuffle();
8+
run_tests();
9+
10+
__DATA__
11+
12+
=== TEST 1: access status with vhost_traffic_status_histogram_bucket to get the request and responseBuckets after accessing upstream backend
13+
--- http_config
14+
vhost_traffic_status_zone;
15+
vhost_traffic_status_histogram_buckets .1 .5 1 2;
16+
upstream backend {
17+
server 127.0.0.1;
18+
}
19+
server {
20+
server_name _;
21+
vhost_traffic_status_filter_by_host on;
22+
}
23+
--- config
24+
location /status {
25+
vhost_traffic_status_display;
26+
vhost_traffic_status_display_format json;
27+
access_log off;
28+
}
29+
location /one {
30+
proxy_set_header Host one.example.org;
31+
proxy_pass http://backend;
32+
}
33+
--- user_files eval
34+
[
35+
['one/file.txt' => 'one.example.org:OK'],
36+
]
37+
--- request eval
38+
[
39+
'GET /one/file.txt',
40+
'GET /status/',
41+
]
42+
--- response_body_like eval
43+
[
44+
'OK',
45+
'\"requestBuckets\"\:\{\"msecs\"\:\[100,500,1000,2000\],\"counters\"\:\[1,1,1,1\].*\"responseBuckets\"\:\{\"msecs\"\:\[100,500,1000,2000\],\"counters\"\:\[1,1,1,1\]',
46+
]

0 commit comments

Comments
 (0)