From b4db8b160b420bc30bc9fc8176b205962da57050 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Fri, 19 Dec 2025 17:09:57 +0000 Subject: [PATCH] fix(test): resolve flaky concurrent temperature collection test --- internal/monitoring/temperature_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/monitoring/temperature_test.go b/internal/monitoring/temperature_test.go index 28e19e9..f47053d 100644 --- a/internal/monitoring/temperature_test.go +++ b/internal/monitoring/temperature_test.go @@ -647,7 +647,10 @@ func TestTemperatureCollector_ConcurrentCollectTemperature(t *testing.T) { stub := &stubTemperatureProxy{ responseFunc: func(int) stubProxyResponse { n := atomic.AddInt32(&callCounter, 1) - if n%2 == 1 { + // Only fail every 5th call to avoid hitting the consecutive failure threshold (3) + // due to concurrent execution ordering. n%2 was causing flaky failures where + // 3 failures could happen before a success reset the counter. + if n%5 == 0 { return stubProxyResponse{ err: &tempproxy.ProxyError{Type: tempproxy.ErrorTypeTransport, Message: "transient transport error"}, }