IGNITE-5729 Added proper exception handling to test. Fixed test.

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

Branch: refs/heads/master
Commit: f975110f54cb08fcf85c09ec67eb0a5b45c429e5
Parents: 591566e
Author: Pavel Kovalenko <[email protected]>
Authored: Fri Jul 28 16:50:35 2017 +0300
Committer: Pavel Kovalenko <[email protected]>
Committed: Fri Jul 28 16:50:35 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/IgniteCacheGroupsTest.java | 22 +++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f975110f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
index b55e3d0..468bbc8 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
@@ -2872,13 +2872,25 @@ public class IgniteCacheGroupsTest extends 
GridCommonAbstractTest {
                     ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
                     while (!stop.get()) {
-                        String grp = rnd.nextBoolean() ? GROUP1 : GROUP2;
-                        int cacheIdx = rnd.nextInt(CACHES);
+                        try {
+                            String grp = rnd.nextBoolean() ? GROUP1 : GROUP2;
+                            int cacheIdx = rnd.nextInt(CACHES);
 
-                        IgniteCache cache = node.cache(grp + "-" + cacheIdx);
+                            IgniteCache cache = node.cache(grp + "-" + 
cacheIdx);
 
-                        for (int i = 0; i < 10; i++)
-                            cacheOperation(rnd, cache);
+                            for (int i = 0; i < 10; i++)
+                                cacheOperation(rnd, cache);
+                        }
+                        catch (Exception e) {
+                            if (X.hasCause(e, CacheStoppedException.class)) {
+                                // Cache operation can be blocked on
+                                // awaiting new topology version and cancelled 
with CacheStoppedException cause.
+
+                                continue;
+                            }
+
+                            throw e;
+                        }
                     }
                 }
                 catch (Exception e) {

Reply via email to