You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by mp...@apache.org on 2026/03/26 07:04:02 UTC

(ignite) branch master updated: IGNITE-28340 Fixed flaky IgniteClientConnectionEventListenerTest (#12928)

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

mpetrov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new b092459d830 IGNITE-28340 Fixed flaky IgniteClientConnectionEventListenerTest (#12928)
b092459d830 is described below

commit b092459d830a5d0a8bce9fe4198b1989b04f6782
Author: Mikhail Petrov <32...@users.noreply.github.com>
AuthorDate: Thu Mar 26 10:03:57 2026 +0300

    IGNITE-28340 Fixed flaky IgniteClientConnectionEventListenerTest (#12928)
---
 .../events/IgniteClientConnectionEventListenerTest.java    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/core/src/test/java/org/apache/ignite/internal/client/thin/events/IgniteClientConnectionEventListenerTest.java b/modules/core/src/test/java/org/apache/ignite/internal/client/thin/events/IgniteClientConnectionEventListenerTest.java
index d5502bc8918..91ed01bf3fa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/client/thin/events/IgniteClientConnectionEventListenerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/client/thin/events/IgniteClientConnectionEventListenerTest.java
@@ -179,6 +179,8 @@ public class IgniteClientConnectionEventListenerTest extends GridCommonAbstractT
         BiConsumer<Event, Throwable> checkEventAction,
         Class<Event> eventCls
     ) {
+        IgniteClient cli = null;
+
         try (FakeIgniteServer srv = srvFactory.get()) {
             srv.start();
 
@@ -190,11 +192,15 @@ public class IgniteClientConnectionEventListenerTest extends GridCommonAbstractT
                 }
 
                 @Override public void onHandshakeFail(HandshakeFailEvent event) {
-                    evSet.put(event.getClass(), event);
+                    // The thin client may attempt to reestablish the connection asynchronously, which may result in
+                    // multiple Handshake Failed events (see ReliableChannelImpl#initAllChannelsAsync).
+                    evSet.putIfAbsent(event.getClass(), event);
                 }
             };
 
-            try (IgniteClient cli = startClient(lsnr)) {
+            try { // We do not close the client using a try with resource block to avoid unexpected events caused by the client stopping.
+                cli = startClient(lsnr);
+
                 clientAction.accept(cli);
             }
             catch (Throwable e) {
@@ -221,6 +227,10 @@ public class IgniteClientConnectionEventListenerTest extends GridCommonAbstractT
         catch (Exception e) {
             throw new RuntimeException("Failed event test", e);
         }
+        finally {
+            if (cli != null)
+                cli.close();
+        }
     }
 
     /** */