Murtadha Hubail has submitted this change and it was merged.

Change subject: [ASTERIXDB-2069][TEST] Stop NCServiceExecutionIT on UNUSABLE 
Cluster
......................................................................


[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 <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Contrib: Jenkins <[email protected]>
Reviewed-by: Michael Blow <[email protected]>
---
M 
asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/NCServiceExecutionIT.java
1 file changed, 19 insertions(+), 1 deletion(-)

Approvals:
  Anon. E. Moose #1000171: 
  Jenkins: Verified; No violations found; ; Verified
  Michael Blow: Looks good to me, approved



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.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.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 @@
     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 @@
                 new File(LOG_DIR, "cc.log"));
 
         testExecutor.waitForClusterActive(30, TimeUnit.SECONDS);
+        clusterActive = true;
     }
 
     @AfterClass
@@ -222,6 +226,13 @@
         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 @@
                 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");
+            }
         }
     }
 }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1990
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8fd470d224aeedbf9c7b0da2bc76f3fa8f0a962e
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Murtadha Hubail <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Michael Blow <[email protected]>
Gerrit-Reviewer: Murtadha Hubail <[email protected]>

Reply via email to