YARN-8348. Incorrect and missing AfterClass in HBase-tests to fix NPE failures. Contributed by Giovanni Matteo Fumarola.

This commit is contained in:
Inigo Goiri 2018-05-23 14:43:59 -07:00
parent e99e5bf104
commit d72615611c
7 changed files with 31 additions and 5 deletions

View File

@ -1936,6 +1936,8 @@ public void testReadAppsInfoFilters() throws Exception {
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
if (util != null) {
util.shutdownMiniCluster(); util.shutdownMiniCluster();
} }
} }
}

View File

@ -32,6 +32,7 @@
import org.apache.hadoop.yarn.server.timelineservice.storage.domain.DomainColumn; import org.apache.hadoop.yarn.server.timelineservice.storage.domain.DomainColumn;
import org.apache.hadoop.yarn.server.timelineservice.storage.domain.DomainRowKey; import org.apache.hadoop.yarn.server.timelineservice.storage.domain.DomainRowKey;
import org.apache.hadoop.yarn.server.timelineservice.storage.domain.DomainTableRW; import org.apache.hadoop.yarn.server.timelineservice.storage.domain.DomainTableRW;
import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -123,4 +124,11 @@ public void testDomainIdTable() throws Exception {
assertEquals("user1,user2 group1,group2", readers); assertEquals("user1,user2 group1,group2", readers);
assertEquals("writer1,writer2", writers); assertEquals("writer1,writer2", writers);
} }
@AfterClass
public static void tearDownAfterClass() throws Exception {
if (util != null) {
util.shutdownMiniCluster();
}
}
} }

View File

@ -1879,8 +1879,10 @@ public void testListTypesInApp() throws Exception {
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
if (util != null) {
util.shutdownMiniCluster(); util.shutdownMiniCluster();
} }
}
private boolean verifyRowKeyForSubApplication(byte[] rowKey, String suAppUser, private boolean verifyRowKeyForSubApplication(byte[] rowKey, String suAppUser,
String cluster, String user, TimelineEntity te) { String cluster, String user, TimelineEntity te) {

View File

@ -24,6 +24,7 @@
import org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTableRW; import org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTableRW;
import org.apache.hadoop.yarn.server.timelineservice.storage.entity.EntityTableRW; import org.apache.hadoop.yarn.server.timelineservice.storage.entity.EntityTableRW;
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunTableRW; import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunTableRW;
import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -137,4 +138,11 @@ public void createWithSetPrefix() throws IOException {
hbaseConf hbaseConf
.unset(YarnConfiguration.TIMELINE_SERVICE_HBASE_SCHEMA_PREFIX_NAME); .unset(YarnConfiguration.TIMELINE_SERVICE_HBASE_SCHEMA_PREFIX_NAME);
} }
@AfterClass
public static void tearDownAfterClass() throws Exception {
if (util != null) {
util.shutdownMiniCluster();
}
}
} }

View File

@ -492,6 +492,8 @@ private void checkFlowActivityRunId(long runid, String flowVersion,
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
if (util != null) {
util.shutdownMiniCluster(); util.shutdownMiniCluster();
} }
} }
}

View File

@ -1075,6 +1075,8 @@ public void testMetricFilters() throws Exception {
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
if (util != null) {
util.shutdownMiniCluster(); util.shutdownMiniCluster();
} }
} }
}

View File

@ -850,6 +850,8 @@ public void testProcessSummationEmpty() throws IOException {
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
if (util != null) {
util.shutdownMiniCluster(); util.shutdownMiniCluster();
} }
} }
}