Skip to content

Commit

Permalink
[TMP] review(*) avoid relying on output order
Browse files Browse the repository at this point in the history
  • Loading branch information
casimiro committed Jun 12, 2024
1 parent 0bcabbe commit f169644
Showing 1 changed file with 46 additions and 6 deletions.
52 changes: 46 additions & 6 deletions t/03-proxy_wasm/hfuncs/metrics/001-define_metric.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,61 @@ run_tests();

__DATA__

=== TEST 1: proxy_wasm - define_metric() sanity
=== TEST 1: proxy_wasm - define_metric() counter
--- valgrind
--- wasm_modules: hostcalls
--- load_nginx_modules: ngx_http_echo_module
--- config
location /t {
proxy_wasm hostcalls 'on_configure=define_metrics \
metrics=c1,g1,h1';
metrics=c1';
echo ok;
}
--- grep_error_log eval: qr/\["hostcalls" \#\d\] defined metric \w+ as \d+/
--- grep_error_log_out eval
qr/.*? defined metric c1 as \d+/
--- no_error_log
[error]
[crit]
[emerg]
[alert]



=== TEST 2: proxy_wasm - define_metric() gauge
--- valgrind
--- wasm_modules: hostcalls
--- load_nginx_modules: ngx_http_echo_module
--- config
location /t {
proxy_wasm hostcalls 'on_configure=define_metrics \
metrics=g1';
echo ok;
}
--- grep_error_log eval: qr/\["hostcalls" \#\d\] defined metric \w+ as \d+/
--- grep_error_log_out eval
qr/.*? defined metric g1 as \d+/
--- no_error_log
[error]
[crit]
[emerg]
[alert]



=== TEST 3: proxy_wasm - define_metric() histogram
--- valgrind
--- wasm_modules: hostcalls
--- load_nginx_modules: ngx_http_echo_module
--- config
location /t {
proxy_wasm hostcalls 'on_configure=define_metrics \
metrics=h1';
echo ok;
}
--- grep_error_log eval: qr/\["hostcalls" \#\d\] defined metric \w+ as \d+/
--- grep_error_log_out eval
qr/.*? defined metric c1 as \d+
.*? defined metric g1 as \d+
.*? defined metric h1 as \d+/
qr/.*? defined metric h1 as \d+/
--- no_error_log
[error]
[crit]
Expand All @@ -39,7 +79,7 @@ qr/.*? defined metric c1 as \d+



=== TEST 2: proxy_wasm - define_metric() redefinition
=== TEST 4: proxy_wasm - define_metric() redefinition
Definition happens only once, a second call defining an existing metric simply
returns its id.

Expand Down

0 comments on commit f169644

Please sign in to comment.