From 8bbddc63069357d7db1d43ea5407634526c1b876 Mon Sep 17 00:00:00 2001 From: Compot Developer Date: Sat, 17 Oct 2026 15:44:34 +0000 Subject: [PATCH] test: wait for the heartbeat count, it is updated after send() (flaky heartbeatWhilePlayingStopsWithTheSlot) --- .../src/test/java/com/openipc/decoder/RtspSessionTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/android/app/src/test/java/com/openipc/decoder/RtspSessionTest.java b/android/app/src/test/java/com/openipc/decoder/RtspSessionTest.java index 3e282f4b..59d4ca42 100644 --- a/android/app/src/test/java/com/openipc/decoder/RtspSessionTest.java +++ b/android/app/src/test/java/com/openipc/decoder/RtspSessionTest.java @@ -445,7 +445,13 @@ public void heartbeatWhilePlayingStopsWithTheSlot() throws Exception { } // The option is ours: the camera never sees it assertEquals("DESCRIBE " + base() + " RTSP/1.0", server.methods().get(0)); + // Counted after send(): the toy may get the second one before the count (#187) java.util.Map m = session.heartbeatStats(); + long deadline = System.currentTimeMillis() + 2000; + while ((Integer) m.get("sent") < 2 && System.currentTimeMillis() < deadline) { + Thread.sleep(10); + m = session.heartbeatStats(); + } assertTrue((Integer) m.get("sent") >= 2); assertEquals(true, m.get("running")); session.stop();