wernerdv commented on code in PR #12161:
URL: https://github.com/apache/ignite/pull/12161#discussion_r2876683116
##########
modules/core/src/test/java/org/apache/ignite/internal/GridCachePartitionExchangeManagerWarningsTest.java:
##########
@@ -131,6 +140,77 @@ public class GridCachePartitionExchangeManagerWarningsTest
extends GridCommonAbs
return cfg;
}
+ /**
+ *
+ */
+ @Test
+ public void testSingleMessageErrorWarnings() throws Exception {
+ final long waitingTimeout = 5_000;
+
+ LogListener logListener = LogListener.matches("Failed to send local
partitions").atLeast(1).build();
+ testLog = new ListeningTestLogger(log, logListener);
+
+ final CountDownLatch beforeSend = new CountDownLatch(1);
+ final CountDownLatch proceed = new CountDownLatch(1);
+
+ final AtomicReference<UUID> crdIdRef = new AtomicReference<>();
+
+ spiFactory = () -> new TcpCommunicationSpi() {
+ @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;
+ try {
+ assertTrue("Did not enter sendMessage() in time",
+ entered = beforeSend.await(waitingTimeout,
TimeUnit.MILLISECONDS));
+
+ stopGrid(0);
+
+ proceed.countDown();
+
+ fut.get(waitingTimeout);
+
+ assertTrue("Expected log not found",
+ GridTestUtils.waitForCondition(logListener::check,
waitingTimeout));
Review Comment:
```suggestion
assertTrue("Expected log not found",
GridTestUtils.waitForCondition(logListener::check, waitingTimeout));
```
--
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]