ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [21/33] ignite git commit: IGNITE-5693 - Fixed semaphore flaky test - Fixes #2239.
Date Wed, 05 Jul 2017 11:24:03 GMT
IGNITE-5693 - Fixed semaphore flaky test - Fixes #2239.

Signed-off-by: Alexey Goncharuk <alexey.goncharuk@gmail.com>


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 5b7165ca717de038249570c4213f050ba9b5aee7
Parents: 50bb090
Author: Ilya Lantukh <ilantukh@gridgain.com>
Authored: Tue Jul 4 20:57:56 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Tue Jul 4 20:57:56 2017 +0300

----------------------------------------------------------------------
 .../IgniteSemaphoreAbstractSelfTest.java           | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5b7165ca/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
index d5f4e0e..445d469 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
@@ -35,6 +35,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.util.lang.GridAbsPredicateX;
 import org.apache.ignite.internal.util.typedef.G;
 import org.apache.ignite.internal.util.typedef.PA;
 import org.apache.ignite.lang.IgniteCallable;
@@ -437,8 +438,7 @@ public abstract class IgniteSemaphoreAbstractSelfTest extends IgniteAtomicsAbstr
      * @param semaphoreName Semaphore name.
      * @throws Exception If failed.
      */
-    private void removeSemaphore(String semaphoreName)
-        throws Exception {
+    private void removeSemaphore(final String semaphoreName) throws Exception {
         IgniteSemaphore semaphore = grid(RND.nextInt(NODES_CNT)).semaphore(semaphoreName,
10, false, true);
 
         assert semaphore != null;
@@ -454,8 +454,17 @@ public abstract class IgniteSemaphoreAbstractSelfTest extends IgniteAtomicsAbstr
         semaphore0.close();
 
         // Ensure semaphore is removed on all nodes.
-        for (Ignite g : G.allGrids())
-            assertNull(((IgniteKernal)g).context().dataStructures().semaphore(semaphoreName,
null, 10, true, false));
+        assert GridTestUtils.waitForCondition(new GridAbsPredicateX() {
+            @Override public boolean applyx() throws IgniteCheckedException {
+                for (Ignite g : G.allGrids()) {
+                    if (((IgniteKernal)g).context().dataStructures().semaphore(
+                        semaphoreName, null, 10, true, false) != null)
+                        return false;
+                }
+
+                return true;
+            }
+        }, 5_000);
 
         checkRemovedSemaphore(semaphore);
     }


Mime
View raw message