Repository: asterixdb
Updated Branches:
  refs/heads/master 424413743 -> a5b37d678


[ASTERIXDB-2069][TEST] Stop NCServiceExecutionIT on UNUSABLE Cluster

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Stop executing the rest of NCServiceExecutionIT tests if waiting
  for the cluster to become ACTIVE fails.

Change-Id: I8fd470d224aeedbf9c7b0da2bc76f3fa8f0a962e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1990
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mb...@apache.org>


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

Branch: refs/heads/master
Commit: a5b37d6785ae8a0bccb2d933a5fa02dd77acc1dc
Parents: 4244137
Author: Murtadha Hubail <mhub...@apache.org>
Authored: Fri Sep 1 15:16:32 2017 -0700
Committer: Murtadha Hubail <mhub...@apache.org>
Committed: Wed Sep 6 11:28:44 2017 -0700

----------------------------------------------------------------------
 .../server/test/NCServiceExecutionIT.java       | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/a5b37d67/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/NCServiceExecutionIT.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/NCServiceExecutionIT.java
 
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/NCServiceExecutionIT.java
index 9e51f8c..7b926a6 100644
--- 
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/NCServiceExecutionIT.java
+++ 
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/NCServiceExecutionIT.java
@@ -24,6 +24,7 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Random;
 import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.asterix.test.common.TestExecutor;
@@ -37,6 +38,7 @@ import 
org.apache.hyracks.server.process.HyracksNCServiceProcess;
 import org.apache.hyracks.server.process.HyracksVirtualCluster;
 import org.junit.AfterClass;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -118,6 +120,7 @@ public class NCServiceExecutionIT {
     private static final List<String> badTestCases = new ArrayList<>();
     private static HyracksVirtualCluster cluster;
     private final KillCommand killType;
+    private static boolean clusterActive = false;
 
     @BeforeClass
     public static void setUp() throws Exception {
@@ -149,6 +152,7 @@ public class NCServiceExecutionIT {
                 new File(LOG_DIR, "cc.log"));
 
         testExecutor.waitForClusterActive(30, TimeUnit.SECONDS);
+        clusterActive = true;
     }
 
     @AfterClass
@@ -222,6 +226,13 @@ public class NCServiceExecutionIT {
         this.killType = killType;
     }
 
+    @Before
+    public void before() {
+        if (!clusterActive) {
+            Assert.fail("Skipping test since cluster is not ACTIVE");
+        }
+    }
+
     @Test
     public void test() throws Exception {
         if (tcCtx != null) {
@@ -252,7 +263,14 @@ public class NCServiceExecutionIT {
                 default:
                     Assert.fail("killType: " + killType);
             }
-            testExecutor.waitForClusterActive(30, TimeUnit.SECONDS);
+            try {
+                testExecutor.waitForClusterActive(30, TimeUnit.SECONDS);
+            } catch (Exception e) {
+                // stop executing the rest of the tests since the cluster is 
not ACTIVE
+                LOGGER.log(Level.SEVERE, "Cannot continue since cluster is not 
ACTIVE", e);
+                clusterActive = false;
+                Assert.fail("Cluster is not ACTIVE");
+            }
         }
     }
 }

Reply via email to