wernerdv commented on code in PR #12161:
URL: https://github.com/apache/ignite/pull/12161#discussion_r2883825737


##########
modules/core/src/test/java/org/apache/ignite/internal/GridCachePartitionExchangeManagerWarningsTest.java:
##########
@@ -131,6 +137,77 @@ public class GridCachePartitionExchangeManagerWarningsTest 
extends GridCommonAbs
         return cfg;
     }
 
+    /**
+     *
+     */
+    @Test
+    public void testSingleMessageErrorWarnings() throws Exception {
+        long waitingTimeout = 5_000;
+        String logSubstr = "Failed to send local partitions to node because it 
left grid [nodeId=";
+
+        LogListener logListener = 
LogListener.matches(logSubstr).atLeast(1).build();
+        testLog = new ListeningTestLogger(log, logListener);
+
+        CountDownLatch beforeSend = new CountDownLatch(1);
+        CountDownLatch proceed = new CountDownLatch(1);
+
+        AtomicReference<UUID> crdIdRef = new AtomicReference<>();
+
+        spiSupp = () -> new TcpCommunicationSpi() {
+            /** {@inheritDoc} */
+            @Override public void sendMessage(ClusterNode node, Message msg, 
IgniteInClosure<IgniteException> ackC)
+                throws IgniteSpiException {
+                boolean isSingleMsg = ((GridIoMessage)msg).message() 
instanceof GridDhtPartitionsSingleMessage;
+                UUID crdId = crdIdRef.get();
+
+                if (isSingleMsg && node != null && crdId != null && 
crdId.equals(node.id())) {
+                    beforeSend.countDown();
+
+                    try {
+                        if (!proceed.await(waitingTimeout, 
TimeUnit.MILLISECONDS))
+                            throw new IgniteSpiException("Test timeout waiting 
to proceed");
+                    }
+                    catch (InterruptedException e) {
+                        Thread.currentThread().interrupt();
+
+                        throw new IgniteSpiException("Interrupted while 
waiting to proceed", e);
+                    }
+                }
+
+                super.sendMessage(node, msg, ackC);
+            }
+        };
+
+        IgniteEx crd = startGrid(0);
+        IgniteEx node1 = startGrid(1);
+
+        awaitPartitionMapExchange();
+
+        crdIdRef.set(crd.localNode().id());
+
+        IgniteInternalFuture<?> fut = GridTestUtils.runAsync(() ->
+            node1.context().cache().context().exchange().refreshPartitions());
+
+        boolean entered = false;

Review Comment:
   The test passes locally without this variable and the finally block.
   I suggest removing the try‑finally and the entered variable.
   
   But to prevent the test from flaking, let’s keep the try‑finally block but 
remove `entered`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to