You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2026/07/14 10:01:49 UTC

(plc4x) 02/02: fix: Hopefully hardened a flaky test.

This is an automated email from the ASF dual-hosted git repository.

chrisdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 8c0d7d914a93bb472c3bd655a88d9385c0419aaa
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Tue Jul 14 12:01:37 2026 +0200

    fix: Hopefully hardened a flaky test.
---
 .../plc4x/java/utils/cache/CachedPlcConnectionManagerTest.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plc4j/tools/connection-cache/src/test/java/org/apache/plc4x/java/utils/cache/CachedPlcConnectionManagerTest.java b/plc4j/tools/connection-cache/src/test/java/org/apache/plc4x/java/utils/cache/CachedPlcConnectionManagerTest.java
index f1416f5708..25827d83bc 100644
--- a/plc4j/tools/connection-cache/src/test/java/org/apache/plc4x/java/utils/cache/CachedPlcConnectionManagerTest.java
+++ b/plc4j/tools/connection-cache/src/test/java/org/apache/plc4x/java/utils/cache/CachedPlcConnectionManagerTest.java
@@ -593,8 +593,12 @@ class CachedPlcConnectionManagerTest {
         PlcConnection connection1 = manager.getConnection("test:tcp://localhost");
         connection1.close();
 
-        // Wait for connection to become idle beyond threshold
-        Thread.sleep(600);
+        // Wait for connection to become idle beyond threshold.
+        // Use a generous margin over the 500ms threshold: the connection is only marked
+        // "requires validation" by a task on the (single-thread) scheduler that fires at the
+        // threshold, and on a loaded CI runner that task can be delayed. A small margin
+        // (e.g. 100ms) makes this test flaky; 1500ms gives the scheduler ample room.
+        Thread.sleep(1500);
 
         // Reset ping mock to track subsequent calls
         reset(mockConnection);