From 18ec9d400383e1ffd1ab2b991239d93942e9d4d5 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Sat, 17 Oct 2026 14:47:13 -0600 Subject: [PATCH] tests: runtime_shell: stop Fluent Bit in the proxy logs test The test started Fluent Bit in the background and never stopped it, so a process was left running after every run. It also only checked that the output file existed, which the shell redirection always creates. Wait for the Go output to print the three dummy records, check their count, and always stop Fluent Bit and wait for it. Signed-off-by: Eduardo Silva --- tests/runtime_shell/proxy_logs_expect.sh | 39 +++++++++++++++--------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/tests/runtime_shell/proxy_logs_expect.sh b/tests/runtime_shell/proxy_logs_expect.sh index 08148d7542c..d32406c5042 100755 --- a/tests/runtime_shell/proxy_logs_expect.sh +++ b/tests/runtime_shell/proxy_logs_expect.sh @@ -13,25 +13,34 @@ echo "Using Fluent Bit at: $FLB_BIN" test_proxy_logs_compatibility() { export SIGNAL_FILE_PATH="/tmp/flb_signal_logs_$$.txt" STDOUT_OUTPUT_FILE="/tmp/test_logs_stdout_$$.txt" - + rm -f "$STDOUT_OUTPUT_FILE" "$SIGNAL_FILE_PATH" - + $FLB_BIN -e $FLB_ROOT/build/test_logs_go.so -c $FLB_RUNTIME_SHELL_CONF/proxy_logs_test.conf > "$STDOUT_OUTPUT_FILE" 2>&1 & FLB_PID=$! - - sleep 3 - - if [ -f "$STDOUT_OUTPUT_FILE" ]; then - echo "SUCCESS: Captured Fluent Bit output" - echo "Output contents:" - cat "$STDOUT_OUTPUT_FILE" - else - echo "FAIL: No stdout output captured" - return 1 - fi - - # Clean up + + # the Go output prints every record it receives: wait for the 3 samples + records=0 + for retry in `seq 20` + do + records=$(grep -c '^map\[level:' "$STDOUT_OUTPUT_FILE" 2>/dev/null || true) + records=${records:-0} + if [ "$records" -ge 3 ]; then + break + fi + sleep 0.5 + done + + # stop Fluent Bit, it does not exit by itself + kill -15 "$FLB_PID" 2>/dev/null || true + wait "$FLB_PID" 2>/dev/null || true + + echo "Output contents:" + cat "$STDOUT_OUTPUT_FILE" + rm -f "$STDOUT_OUTPUT_FILE" "$SIGNAL_FILE_PATH" + + assertEquals "records printed by the Go output" 3 "$records" } # Load the runtime shell environment