asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Maxon (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: Verify that BufferCache is clean after tests
Date Fri, 13 Nov 2015 22:05:53 GMT
Ian Maxon has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/498

Change subject: Verify that BufferCache is clean after tests
......................................................................

Verify that BufferCache is clean after tests

Change-Id: I5610e903be3347893e676c915b98316b06073c26
---
M asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
M asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
2 files changed, 27 insertions(+), 6 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/98/498/1

diff --git a/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
b/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
index 158bf0c..2897a15 100644
--- a/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
+++ b/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
@@ -43,9 +43,9 @@
 
     public static final int DEFAULT_HYRACKS_CC_CLUSTER_PORT = 1099;
 
-    private static ClusterControllerService cc;
-    private static NodeControllerService[] ncs = new NodeControllerService[NODES];
-    private static IHyracksClientConnection hcc;
+    public static ClusterControllerService cc;
+    public static NodeControllerService[] ncs = new NodeControllerService[NODES];
+    public static IHyracksClientConnection hcc;
 
     public static void init() throws Exception {
         CCConfig ccConfig = new CCConfig();
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
index 2cba6c8..760db0c 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
@@ -19,9 +19,11 @@
 package org.apache.asterix.test.runtime;
 
 import java.io.File;
+import java.lang.reflect.Field;
 import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -38,9 +40,11 @@
 import org.apache.asterix.testframework.xml.TestSuite;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.apache.hyracks.api.lifecycle.ILifeCycleComponent;
+import org.apache.hyracks.api.lifecycle.ILifeCycleComponentManager;
+import org.apache.hyracks.control.nc.NodeControllerService;
+import org.apache.hyracks.storage.common.buffercache.BufferCache;
+import org.junit.*;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
@@ -84,6 +88,7 @@
         }
         AsterixHyracksIntegrationUtil.init();
 
+
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("initializing HDFS");
         }
@@ -100,8 +105,24 @@
         FailedGroup.setName("failed");
     }
 
+    public static void validateBufferCacheState() throws NoSuchFieldException, IllegalAccessException
{
+        for(NodeControllerService nc: AsterixHyracksIntegrationUtil.ncs){
+           ILifeCycleComponentManager lccm = nc.getLifeCycleComponentManager();
+            Field f = lccm.getClass().getDeclaredField("components");
+            f.setAccessible(true);
+            for(ILifeCycleComponent c : ((List<ILifeCycleComponent>)f.get(lccm))){
+                if(c instanceof BufferCache){
+                    if(!((BufferCache)c).validateEmpty()){
+                        throw new IllegalStateException();
+                    }
+                }
+            }
+        }
+    }
+
     @AfterClass
     public static void tearDown() throws Exception {
+        validateBufferCacheState();
         AsterixHyracksIntegrationUtil.deinit();
         File outdir = new File(PATH_ACTUAL);
         File[] files = outdir.listFiles();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5610e903be3347893e676c915b98316b06073c26
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Ian Maxon <imaxon@apache.org>

Mime
View raw message