From f034020f5cc0852e80c26dd6a4c669a23279e205 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 4 Nov 2024 13:18:46 +0100 Subject: [PATCH] test: net: lib: prometheus: formatter: Fix test flakiness If a string is already present in the provided buffer, prometheus_format_exposition() appends it instead of overwriting, hence the buffer needs to be cleared on the test start, otherwise it works by chance. Signed-off-by: Robert Lubos --- tests/net/lib/prometheus/formatter/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/net/lib/prometheus/formatter/src/main.c b/tests/net/lib/prometheus/formatter/src/main.c index 12af8153cc6e8..f8170b99c1987 100644 --- a/tests/net/lib/prometheus/formatter/src/main.c +++ b/tests/net/lib/prometheus/formatter/src/main.c @@ -36,7 +36,7 @@ PROMETHEUS_COLLECTOR_DEFINE(test_custom_collector); ZTEST(test_formatter, test_prometheus_formatter_simple) { int ret; - char formatted[MAX_BUFFER_SIZE]; + char formatted[MAX_BUFFER_SIZE] = { 0 }; struct prometheus_counter *counter; char exposed[] = "# HELP test_counter Test counter\n" "# TYPE test_counter counter\n"