You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/07/04 18:00:20 UTC

ignite git commit: IGNITE-5693 - Fixed semaphore flaky test - Fixes #2239.

Repository: ignite
Updated Branches:
  refs/heads/ignite-2.1 50bb09012 -> 5b7165ca7


IGNITE-5693 - Fixed semaphore flaky test - Fixes #2239.

Signed-off-by: Alexey Goncharuk <al...@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
Commit: 5b7165ca717de038249570c4213f050ba9b5aee7
Parents: 50bb090
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Tue Jul 4 20:57:56 2017 +0300
Committer: Alexey Goncharuk <al...@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);
     }