All Opened hoodie clients in tests needs to be closed
TestMergeOnReadTable must use embedded timeline server
This commit is contained in:
committed by
Balaji Varadarajan
parent
136f8478a3
commit
cd7623e216
@@ -84,6 +84,7 @@ public class TestHbaseIndex {
|
||||
private static String tableName = "test_table";
|
||||
private String basePath = null;
|
||||
private transient FileSystem fs;
|
||||
private HoodieWriteClient writeClient;
|
||||
|
||||
public TestHbaseIndex() throws Exception {
|
||||
}
|
||||
@@ -113,6 +114,11 @@ public class TestHbaseIndex {
|
||||
|
||||
@After
|
||||
public void clear() throws Exception {
|
||||
if (null != writeClient) {
|
||||
writeClient.close();
|
||||
writeClient = null;
|
||||
}
|
||||
|
||||
if (basePath != null) {
|
||||
new File(basePath).delete();
|
||||
}
|
||||
@@ -128,6 +134,14 @@ public class TestHbaseIndex {
|
||||
HoodieTestUtils.init(jsc.hadoopConfiguration(), basePath);
|
||||
}
|
||||
|
||||
private HoodieWriteClient getWriteClient(HoodieWriteConfig config) throws Exception {
|
||||
if (null != writeClient) {
|
||||
writeClient.close();
|
||||
}
|
||||
writeClient = new HoodieWriteClient(jsc, config);
|
||||
return writeClient;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleTagLocationAndUpdate() throws Exception {
|
||||
|
||||
@@ -139,7 +153,7 @@ public class TestHbaseIndex {
|
||||
// Load to memory
|
||||
HoodieWriteConfig config = getConfig();
|
||||
HBaseIndex index = new HBaseIndex(config);
|
||||
HoodieWriteClient writeClient = new HoodieWriteClient(jsc, config);
|
||||
HoodieWriteClient writeClient = getWriteClient(config);
|
||||
writeClient.startCommit();
|
||||
HoodieTableMetaClient metaClient = new HoodieTableMetaClient(jsc.hadoopConfiguration(), basePath);
|
||||
HoodieTable hoodieTable = HoodieTable.getHoodieTable(metaClient, config, jsc);
|
||||
@@ -178,7 +192,7 @@ public class TestHbaseIndex {
|
||||
// Load to memory
|
||||
HoodieWriteConfig config = getConfig();
|
||||
HBaseIndex index = new HBaseIndex(config);
|
||||
HoodieWriteClient writeClient = new HoodieWriteClient(jsc, config);
|
||||
HoodieWriteClient writeClient = getWriteClient(config);
|
||||
|
||||
String newCommitTime = writeClient.startCommit();
|
||||
List<HoodieRecord> records = dataGen.generateInserts(newCommitTime, 200);
|
||||
@@ -231,7 +245,7 @@ public class TestHbaseIndex {
|
||||
// only for test, set the hbaseConnection to mocked object
|
||||
index.setHbaseConnection(hbaseConnection);
|
||||
|
||||
HoodieWriteClient writeClient = new HoodieWriteClient(jsc, config);
|
||||
HoodieWriteClient writeClient = getWriteClient(config);
|
||||
|
||||
// start a commit and generate test data
|
||||
String newCommitTime = writeClient.startCommit();
|
||||
@@ -258,7 +272,7 @@ public class TestHbaseIndex {
|
||||
HoodieTestDataGenerator dataGen = new HoodieTestDataGenerator();
|
||||
HoodieWriteConfig config = getConfig();
|
||||
HBaseIndex index = new HBaseIndex(config);
|
||||
HoodieWriteClient writeClient = new HoodieWriteClient(jsc, config);
|
||||
HoodieWriteClient writeClient = getWriteClient(config);
|
||||
|
||||
// start a commit and generate test data
|
||||
String newCommitTime = writeClient.startCommit();
|
||||
|
||||
Reference in New Issue
Block a user