You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flaky unit test: UdpHeartbeatTest reads the sent count before it is updated #247
UdpHeartbeatTest.sendsOneOneEverySecondUntilClosed fails now and then, locally and possibly in CI; it failed 2 of 4 runs of the unit tests in Docker on 2026-10-20 (the other 358 tests pass):
java.lang.AssertionError
at com.openipc.decoder.UdpHeartbeatTest.sendsOneOneEverySecondUntilClosed(UdpHeartbeatTest.java:102)
Line 102 is assertTrue(h.sent() >= 4);, right after the test has received the 4th packet. The heartbeat counts a packet after send() returns, while the test's receive() can return as soon as the datagram arrives, so the count may still be 3 when it is read. The test races the counter; the heartbeat itself works.
Fix: wait briefly for the count (or assert >= 3 and check the 4th after close()), so the test does not depend on thread timing. Test-only change, no new version (no-release).
Activity
Merge pull request #249 from OpenIPC/test/heartbeat-flaky-247