Skip to content

Commit

Permalink
Merge pull request #256 from u5surf/add_buckets_test
Browse files Browse the repository at this point in the history
Add histogram_bucket test
  • Loading branch information
u5surf committed Jan 4, 2023
2 parents 46e431b + 0c60d57 commit 5b3812e
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions t/023.histogram_buckets.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# vi:set ft=perl ts=4 sw=4 et fdm=marker:

use Test::Nginx::Socket;
use Fcntl;

plan tests => repeat_each() * blocks() * 4;
no_shuffle();
run_tests();

__DATA__
=== TEST 1: access status with vhost_traffic_status_histogram_bucket to get the request and responseBuckets after accessing upstream backend
--- http_config
vhost_traffic_status_zone;
vhost_traffic_status_histogram_buckets .1 .5 1 2;
upstream backend {
server 127.0.0.1;
}
server {
server_name _;
vhost_traffic_status_filter_by_host on;
}
--- config
location /status {
vhost_traffic_status_display;
vhost_traffic_status_display_format json;
access_log off;
}
location /one {
proxy_set_header Host one.example.org;
proxy_pass http://backend;
}
--- user_files eval
[
['one/file.txt' => 'one.example.org:OK'],
]
--- request eval
[
'GET /one/file.txt',
'GET /status/',
]
--- response_body_like eval
[
'OK',
'\"requestBuckets\"\:\{\"msecs\"\:\[100,500,1000,2000\],\"counters\"\:\[1,1,1,1\].*\"responseBuckets\"\:\{\"msecs\"\:\[100,500,1000,2000\],\"counters\"\:\[1,1,1,1\]',
]

0 comments on commit 5b3812e

Please sign in to comment.