Repository: ignite
Updated Branches:
  refs/heads/ignite-2.5 912433ba9 -> 99feab6ac


IGNITE-6430 Complete failing test early


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

Branch: refs/heads/ignite-2.5
Commit: 99feab6ace66d011b677fd4d57b44fc54da8fd4f
Parents: 912433b
Author: Alexey Goncharuk <alexey.goncha...@gmail.com>
Authored: Tue Apr 10 20:33:47 2018 +0300
Committer: Alexey Goncharuk <alexey.goncha...@gmail.com>
Committed: Tue Apr 10 20:36:40 2018 +0300

----------------------------------------------------------------------
 .../cache/CacheGroupsMetricsRebalanceTest.java  | 31 ++++++++++++--------
 1 file changed, 18 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/99feab6a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupsMetricsRebalanceTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupsMetricsRebalanceTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupsMetricsRebalanceTest.java
index 89c8236..ceb9852 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupsMetricsRebalanceTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupsMetricsRebalanceTest.java
@@ -227,29 +227,34 @@ public class CacheGroupsMetricsRebalanceTest extends 
GridCommonAbstractTest {
 
                 System.out.println("Wait until keys left will be less " + 
keysLine);
 
-                while (finishRebalanceLatch.getCount() != 0) {
-                    CacheMetrics m = ig2.cache(CACHE1).localMetrics();
+                try {
+                    while (finishRebalanceLatch.getCount() != 0) {
+                        CacheMetrics m = ig2.cache(CACHE1).localMetrics();
 
-                    long keyLeft = m.getKeysToRebalanceLeft();
+                        long keyLeft = m.getKeysToRebalanceLeft();
 
-                    if (keyLeft > 0 && keyLeft < keysLine)
-                        latch.countDown();
+                        if (keyLeft > 0 && keyLeft < keysLine)
+                            latch.countDown();
 
-                    System.out.println("Keys left: " + 
m.getKeysToRebalanceLeft());
+                        System.out.println("Keys left: " + 
m.getKeysToRebalanceLeft());
 
-                    try {
-                        Thread.sleep(1_000);
-                    }
-                    catch (InterruptedException e) {
-                        System.out.println("Interrupt thread: " + 
e.getMessage());
+                        try {
+                            Thread.sleep(1_000);
+                        }
+                        catch (InterruptedException e) {
+                            System.out.println("Interrupt thread: " + 
e.getMessage());
 
-                        Thread.currentThread().interrupt();
+                            Thread.currentThread().interrupt();
+                        }
                     }
                 }
+                finally {
+                    latch.countDown();
+                }
             }
         });
 
-        latch.await();
+        assertTrue(latch.await(getTestTimeout(), TimeUnit.MILLISECONDS));
 
         long finishTime = 
ig2.cache(CACHE1).localMetrics().getEstimatedRebalancingFinishTime();
 

Reply via email to