ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject ambari git commit: AMBARI-15923. Metrics Unit Tests Failing on b.a.o. (swagle)
Date Fri, 15 Apr 2016 17:32:39 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 01b2af13d -> 6c2697ad2


AMBARI-15923. Metrics Unit Tests Failing on b.a.o. (swagle)


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

Branch: refs/heads/branch-2.2
Commit: 6c2697ad28e201fe283bfcb9fb0bf40d50d64705
Parents: 01b2af1
Author: Siddharth Wagle <swagle@hortonworks.com>
Authored: Fri Apr 15 10:33:05 2016 -0700
Committer: Siddharth Wagle <swagle@hortonworks.com>
Committed: Fri Apr 15 10:33:05 2016 -0700

----------------------------------------------------------------------
 .../TimelineMetricMetadataManager.java          |  1 -
 .../timeline/AbstractMiniHBaseClusterTest.java  | 56 +++++++++++++-------
 .../timeline/ITPhoenixHBaseAccessor.java        | 32 -----------
 .../timeline/discovery/TestMetadataManager.java |  2 +-
 4 files changed, 38 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6c2697ad/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TimelineMetricMetadataManager.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TimelineMetricMetadataManager.java
b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TimelineMetricMetadataManager.java
index 8e58203..50f7518 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TimelineMetricMetadataManager.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TimelineMetricMetadataManager.java
@@ -24,7 +24,6 @@ import org.apache.hadoop.metrics2.sink.timeline.MetadataException;
 import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
 import org.apache.hadoop.metrics2.sink.timeline.TimelineMetricMetadata;
 import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor;
-
 import java.sql.SQLException;
 import java.util.Collection;
 import java.util.HashSet;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6c2697ad/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
index 7410e9d..b0dba17 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
@@ -99,40 +99,58 @@ public abstract class AbstractMiniHBaseClusterTest extends BaseTest {
     hdb.initMetricSchema();
   }
 
+  private void deleteTableIgnoringExceptions(Statement stmt, String tableName) {
+    try {
+      stmt.execute("delete from " + tableName);
+    } catch (Exception e) {
+      LOG.warn("Exception on delete table " + tableName, e);
+    }
+  }
+
   @After
-  public void tearDown() throws Exception {
+  public void tearDown() {
     Connection conn = null;
     Statement stmt = null;
     try {
       conn = getConnection(getUrl());
       stmt = conn.createStatement();
 
-      stmt.execute("delete from METRIC_AGGREGATE");
-      stmt.execute("delete from METRIC_AGGREGATE_MINUTE");
-      stmt.execute("delete from METRIC_AGGREGATE_HOURLY");
-      stmt.execute("delete from METRIC_AGGREGATE_DAILY");
-      stmt.execute("delete from METRIC_RECORD");
-      stmt.execute("delete from METRIC_RECORD_MINUTE");
-      stmt.execute("delete from METRIC_RECORD_HOURLY");
-      stmt.execute("delete from METRIC_RECORD_DAILY");
-      stmt.execute("delete from METRICS_METADATA");
-      stmt.execute("delete from HOSTED_APPS_METADATA");
+      deleteTableIgnoringExceptions(stmt, "METRIC_AGGREGATE");
+      deleteTableIgnoringExceptions(stmt, "METRIC_AGGREGATE_MINUTE");
+      deleteTableIgnoringExceptions(stmt, "METRIC_AGGREGATE_HOURLY");
+      deleteTableIgnoringExceptions(stmt, "METRIC_AGGREGATE_DAILY");
+      deleteTableIgnoringExceptions(stmt, "METRIC_RECORD");
+      deleteTableIgnoringExceptions(stmt, "METRIC_RECORD_MINUTE");
+      deleteTableIgnoringExceptions(stmt, "METRIC_RECORD_HOURLY");
+      deleteTableIgnoringExceptions(stmt, "METRIC_RECORD_DAILY");
+      deleteTableIgnoringExceptions(stmt, "METRICS_METADATA");
+      deleteTableIgnoringExceptions(stmt, "HOSTED_APPS_METADATA");
 
       conn.commit();
-    } finally {
+    } catch (Exception e) {
+      LOG.warn("Error on deleting HBase schema.", e);
+    }  finally {
       if (stmt != null) {
-        stmt.close();
+        try {
+          stmt.close();
+        } catch (SQLException e) {
+          // Ignore
+        }
       }
 
       if (conn != null) {
-        conn.close();
+        try {
+          conn.close();
+        } catch (SQLException e) {
+          // Ignore
+        }
       }
     }
-  }
-
-  @After
-  public void cleanUpAfterTest() throws Exception {
-    deletePriorTables(HConstants.LATEST_TIMESTAMP, getUrl());
+    try {
+      deletePriorTables(HConstants.LATEST_TIMESTAMP, getUrl());
+    } catch (Exception e) {
+      LOG.warn("Failed in delete prior tables.", e);
+    }
   }
 
   public static Map<String, String> getDefaultProps() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6c2697ad/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/ITPhoenixHBaseAccessor.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/ITPhoenixHBaseAccessor.java
b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/ITPhoenixHBaseAccessor.java
index f8e4c94..c729162 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/ITPhoenixHBaseAccessor.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/ITPhoenixHBaseAccessor.java
@@ -35,15 +35,11 @@ import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.
 import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.discovery.TimelineMetricMetadataManager;
 import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.Condition;
 import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.DefaultCondition;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 
 import java.io.IOException;
 import java.lang.reflect.Field;
-import java.sql.Connection;
 import java.sql.SQLException;
-import java.sql.Statement;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -61,38 +57,10 @@ import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.ti
 import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.METRICS_AGGREGATE_MINUTE_TABLE_NAME;
 import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.METRICS_RECORD_TABLE_NAME;
 import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.PHOENIX_TABLES;
-import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TimelineMetricConfiguration.TIMELINE_METRICS_TABLES_DURABILITY;
 
 
 
 public class ITPhoenixHBaseAccessor extends AbstractMiniHBaseClusterTest {
-  private Connection conn;
-  private PhoenixHBaseAccessor hdb;
-
-  @Before
-  public void setUp() throws Exception {
-    hdb = createTestableHBaseAccessor();
-    // inits connection, starts mini cluster
-    conn = getConnection(getUrl());
-
-    hdb.initMetricSchema();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    Connection conn = getConnection(getUrl());
-    Statement stmt = conn.createStatement();
-
-    stmt.execute("delete from METRIC_AGGREGATE");
-    stmt.execute("delete from METRIC_AGGREGATE_HOURLY");
-    stmt.execute("delete from METRIC_RECORD");
-    stmt.execute("delete from METRIC_RECORD_HOURLY");
-    stmt.execute("delete from METRIC_RECORD_MINUTE");
-    conn.commit();
-
-    stmt.close();
-    conn.close();
-  }
 
   @Test
   public void testGetMetricRecordsSeconds() throws IOException, SQLException {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6c2697ad/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TestMetadataManager.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TestMetadataManager.java
b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TestMetadataManager.java
index bf887be..92e4dfc 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TestMetadataManager.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TestMetadataManager.java
@@ -72,7 +72,7 @@ public class TestMetadataManager extends AbstractMiniHBaseClusterTest {
     hdb.insertMetricRecordsWithMetadata(metadataManager, timelineMetrics);
   }
 
-  @Test
+  @Test(timeout = 180000)
   public void testSaveMetricsMetadata() throws Exception {
     Map<TimelineMetricMetadataKey, TimelineMetricMetadata> cachedData = metadataManager.getMetadataCache();
 


Mime
View raw message