From cc10f5dd873745435155526f065b97d422fde984 Mon Sep 17 00:00:00 2001 From: Caio Ramos Casimiro Date: Tue, 11 Jun 2024 15:35:27 +0100 Subject: [PATCH] [TMP] review(*) skip_no_hup fix --- t/07-metrics/003-metrics_sighup_fail.t | 64 ++++++++++++++++++++++++++ t/TestWasmX.pm | 2 +- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 t/07-metrics/003-metrics_sighup_fail.t diff --git a/t/07-metrics/003-metrics_sighup_fail.t b/t/07-metrics/003-metrics_sighup_fail.t new file mode 100644 index 000000000..5758339cc --- /dev/null +++ b/t/07-metrics/003-metrics_sighup_fail.t @@ -0,0 +1,64 @@ +# vim:set ft= ts=4 sts=4 sw=4 et fdm=marker: +use strict; +use lib '.'; +use t::TestWasmX; + +skip_no_hup(); + + +our $metrics = "c2,g2,h2"; + +no_shuffle(); +plan_tests(6); +run_tests(); + +__DATA__ + +=== TEST 1: SIGHUP metrics - define metrics +--- valgrind +--- load_nginx_modules: ngx_http_echo_module +--- wasm_modules: hostcalls +--- config eval +qq{ + location /t { + proxy_wasm hostcalls 'on_configure=define_and_increment_counters \ + metrics=$::metrics'; + echo ok; + } +} +--- error_log eval +qr/c2_Configure: $::workers.*/ +--- no_error_log +[error] +[crit] +[emerg] +[alert] + + + +=== TEST 2: SIGHUP metrics - decreased slab_size - not enough memory +--- reload_fails +--- valgrind +--- load_nginx_modules: ngx_http_echo_module +--- main_config eval +qq{ + wasm { + module hostcalls $ENV{TEST_NGINX_CRATES_DIR}/hostcalls.wasm; + + metrics { + slab_size 12k; + } + } +} +--- config eval +qq{ + location /t { + echo ok; + } +} +--- error_log: failed redefining metric +--- no_error_log +[stub] +[stub] +[stub] +[stub] diff --git a/t/TestWasmX.pm b/t/TestWasmX.pm index a8d207146..fd6655103 100644 --- a/t/TestWasmX.pm +++ b/t/TestWasmX.pm @@ -62,7 +62,7 @@ sub skip_hup { sub skip_no_hup { if ($ENV{TEST_NGINX_USE_HUP} == 0) { - plan(skip_all => "skip in default mode"); + plan(skip_all => "skip without HUP mode"); } }