Skip to content

Commit a597fea

Browse files
rlubosdkalowsk
authored andcommitted
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 <[email protected]>
1 parent 130c5c0 commit a597fea

File tree

1 file changed

+1
-1
lines changed
  • tests/net/lib/prometheus/formatter/src

1 file changed

+1
-1
lines changed

tests/net/lib/prometheus/formatter/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ PROMETHEUS_COLLECTOR_DEFINE(test_custom_collector);
3636
ZTEST(test_formatter, test_prometheus_formatter_simple)
3737
{
3838
int ret;
39-
char formatted[MAX_BUFFER_SIZE];
39+
char formatted[MAX_BUFFER_SIZE] = { 0 };
4040
struct prometheus_counter *counter;
4141
char exposed[] = "# HELP test_counter Test counter\n"
4242
"# TYPE test_counter counter\n"

0 commit comments

Comments
 (0)