From ec39237e69f53ddc4c8ce2da70c53cf05da3c305 Mon Sep 17 00:00:00 2001 From: David Fifield Date: Fri, 15 Aug 2025 18:22:21 +0000 Subject: [PATCH] Add a test that formatAndClearCountryStats clears the map. --- broker/snowflake-broker_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/broker/snowflake-broker_test.go b/broker/snowflake-broker_test.go index 04fa77d..c701753 100644 --- a/broker/snowflake-broker_test.go +++ b/broker/snowflake-broker_test.go @@ -1048,6 +1048,8 @@ snowflake-ips-nat-unknown 0 atomic.AddUint64(ptr, count) } So(formatAndClearCountryStats(stats, false), ShouldEqual, "CN=250,FR=200,RU=150,TZ=100,IT=50,BE=1,CA=1,PH=1") + // The map should be cleared on return. + stats.Range(func(_, _ any) bool { panic("map was not cleared") }) }) }) }