ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ag...@apache.org
Subject ignite git commit: IGNITE-5977 Flaky failure of IgniteClientDataStructuresTest
Date Wed, 06 Jun 2018 10:59:22 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 78e5d970b -> ecca4ca25


IGNITE-5977 Flaky failure of IgniteClientDataStructuresTest

Signed-off-by: Andrey Gura <agura@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ecca4ca2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ecca4ca2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ecca4ca2

Branch: refs/heads/master
Commit: ecca4ca252e0d8d9cd5123ca039bc2a8d9d3137f
Parents: 78e5d97
Author: Aleksey Plekhanov <plehanov.alex@gmail.com>
Authored: Wed Jun 6 13:58:57 2018 +0300
Committer: Andrey Gura <agura@apache.org>
Committed: Wed Jun 6 13:58:57 2018 +0300

----------------------------------------------------------------------
 .../IgniteClientDataStructuresAbstractTest.java | 108 +++++++++++++++++--
 1 file changed, 100 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ecca4ca2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteClientDataStructuresAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteClientDataStructuresAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteClientDataStructuresAbstractTest.java
index 6633f4a..118ea52 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteClientDataStructuresAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteClientDataStructuresAbstractTest.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.cache.datastructures;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.Callable;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
@@ -32,6 +34,8 @@ import org.apache.ignite.IgniteSet;
 import org.apache.ignite.configuration.CollectionConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -100,7 +104,11 @@ public abstract class IgniteClientDataStructuresAbstractTest extends
GridCommonA
         assertNull(creator.atomicSequence("seq1", 1L, false));
         assertNull(other.atomicSequence("seq1", 1L, false));
 
+        List<IgniteAtomicSequence> sequences = new ArrayList<>(2);
+
         try (IgniteAtomicSequence seq = creator.atomicSequence("seq1", 1L, true)) {
+            sequences.add(seq);
+
             assertNotNull(seq);
 
             assertEquals(1L, seq.get());
@@ -111,11 +119,29 @@ public abstract class IgniteClientDataStructuresAbstractTest extends
GridCommonA
 
             IgniteAtomicSequence seq0 = other.atomicSequence("seq1", 1L, false);
 
+            sequences.add(seq0);
+
             assertNotNull(seq0);
         }
 
-        assertNull(creator.atomicSequence("seq1", 1L, false));
-        assertNull(other.atomicSequence("seq1", 1L, false));
+        for (IgniteAtomicSequence seq : sequences) {
+            try {
+                seq.getAndAdd(seq.batchSize());
+
+                fail("Operations with closed sequence must fail");
+            }
+            catch (Throwable ignore) {
+                // No-op.
+            }
+        }
+
+        for (Ignite ignite : F.asList(creator, other)) {
+            assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                @Override public boolean apply() {
+                    return ignite.atomicSequence("seq1", 1L, false) == null;
+                }
+            }, 3_000L));
+        }
     }
 
     /**
@@ -265,7 +291,11 @@ public abstract class IgniteClientDataStructuresAbstractTest extends
GridCommonA
         assertNull(creator.countDownLatch("latch1", 1, true, false));
         assertNull(other.countDownLatch("latch1", 1, true, false));
 
+        List<IgniteCountDownLatch> latches = new ArrayList<>(2);
+
         try (IgniteCountDownLatch latch = creator.countDownLatch("latch1", 1, true, true))
{
+            latches.add(latch);
+
             assertNotNull(latch);
 
             assertEquals(1, latch.count());
@@ -276,6 +306,8 @@ public abstract class IgniteClientDataStructuresAbstractTest extends GridCommonA
 
                     IgniteCountDownLatch latch0 = other.countDownLatch("latch1", 1, true,
false);
 
+                    latches.add(latch0);
+
                     assertEquals(1, latch0.count());
 
                     log.info("Count down latch.");
@@ -297,8 +329,24 @@ public abstract class IgniteClientDataStructuresAbstractTest extends
GridCommonA
             fut.get();
         }
 
-        assertNull(creator.countDownLatch("latch1", 1, true, false));
-        assertNull(other.countDownLatch("latch1", 1, true, false));
+        for (IgniteCountDownLatch latch : latches) {
+            try {
+                latch.await(5_000L);
+
+                fail("Operations with closed latch must fail");
+            }
+            catch (Throwable ignore) {
+                // No-op.
+            }
+        }
+
+        for (Ignite ignite : F.asList(creator, other)) {
+            assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                @Override public boolean apply() {
+                    return ignite.countDownLatch("latch1", 1, true, false) == null;
+                }
+            }, 3_000L));
+        }
     }
 
     /**
@@ -321,7 +369,11 @@ public abstract class IgniteClientDataStructuresAbstractTest extends
GridCommonA
         assertNull(creator.semaphore("semaphore1", 1, true, false));
         assertNull(other.semaphore("semaphore1", 1, true, false));
 
+        final List<IgniteSemaphore> semaphores = new ArrayList(2);
+
         try (IgniteSemaphore semaphore = creator.semaphore("semaphore1", -1, true, true))
{
+            semaphores.add(semaphore);
+
             assertNotNull(semaphore);
 
             assertEquals(-1, semaphore.availablePermits());
@@ -332,6 +384,8 @@ public abstract class IgniteClientDataStructuresAbstractTest extends GridCommonA
 
                     IgniteSemaphore semaphore0 = other.semaphore("semaphore1", -1, true,
false);
 
+                    semaphores.add(semaphore0);
+
                     assertEquals(-1, semaphore0.availablePermits());
 
                     log.info("Release semaphore.");
@@ -353,8 +407,24 @@ public abstract class IgniteClientDataStructuresAbstractTest extends
GridCommonA
             assertEquals(0, semaphore.availablePermits());
         }
 
-        assertNull(creator.semaphore("semaphore1", 1, true, false));
-        assertNull(other.semaphore("semaphore1", 1, true, false));
+        for (IgniteSemaphore semaphore : semaphores) {
+            try {
+                semaphore.release();
+
+                fail("Operations with closed semaphore must fail");
+            }
+            catch (Throwable ignore) {
+                // No-op.
+            }
+        }
+
+        for (Ignite ignite : F.asList(creator, other)) {
+            assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                @Override public boolean apply() {
+                    return ignite.semaphore("semaphore1", 1, true, false) == null;
+                }
+            }, 3_000L));
+        }
     }
 
     /**
@@ -377,7 +447,11 @@ public abstract class IgniteClientDataStructuresAbstractTest extends
GridCommonA
         assertNull(creator.reentrantLock("lock1", true, false, false));
         assertNull(other.reentrantLock("lock1", true, false, false));
 
+        List<IgniteLock> locks = new ArrayList<>(2);
+
         try (IgniteLock lock = creator.reentrantLock("lock1", true, false, true)) {
+            locks.add(lock);
+
             assertNotNull(lock);
 
             assertFalse(lock.isLocked());
@@ -388,6 +462,8 @@ public abstract class IgniteClientDataStructuresAbstractTest extends GridCommonA
                 @Override public Object call() throws Exception {
                     IgniteLock lock0 = other.reentrantLock("lock1", true, false, false);
 
+                    locks.add(lock0);
+
                     lock0.lock();
 
                     assertTrue(lock0.isLocked());
@@ -421,8 +497,24 @@ public abstract class IgniteClientDataStructuresAbstractTest extends
GridCommonA
             assertFalse(lock.isLocked());
         }
 
-        assertNull(creator.reentrantLock("lock1", true, false, false));
-        assertNull(other.reentrantLock("lock1", true, false, false));
+        for (IgniteLock lock : locks) {
+            try {
+                lock.tryLock(5_000L, TimeUnit.MILLISECONDS);
+
+                fail("Operations with closed lock must fail");
+            }
+            catch (Throwable ignore) {
+                // No-op.
+            }
+        }
+
+        for (Ignite ignite : F.asList(creator, other)) {
+            assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                @Override public boolean apply() {
+                    return ignite.reentrantLock("lock1", true, false, false) == null;
+                }
+            }, 3_000L));
+        }
     }
 
     /**


Mime
View raw message