HBASE-23999 [flakey test] TestTableOutputFormatConnectionExhaust (#1302)

Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
This commit is contained in:
Huaxiang Sun 2020-03-18 21:51:04 -07:00 committed by stack
parent c8d6ee31b8
commit 5e764f57a8
1 changed files with 4 additions and 10 deletions

View File

@ -19,9 +19,6 @@ package org.apache.hadoop.hbase.regionserver;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.FileOutputStream;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileSystem;
@ -60,12 +57,6 @@ public class TestCompactionTool {
public void setUp() throws Exception { public void setUp() throws Exception {
this.testUtil.startMiniCluster(); this.testUtil.startMiniCluster();
testUtil.createTable(tableName, HBaseTestingUtility.fam1); testUtil.createTable(tableName, HBaseTestingUtility.fam1);
String defaultFS = testUtil.getMiniHBaseCluster().getConfiguration().get("fs.defaultFS");
Configuration config = HBaseConfiguration.create();
config.set("fs.defaultFS", defaultFS);
String configPath = this.getClass().getClassLoader()
.getResource("hbase-site.xml").getFile();
config.writeXml(new FileOutputStream(new File(configPath)));
rootDir = testUtil.getDefaultRootDirPath(); rootDir = testUtil.getDefaultRootDirPath();
this.region = testUtil.getMiniHBaseCluster().getRegions(tableName).get(0); this.region = testUtil.getMiniHBaseCluster().getRegions(tableName).get(0);
} }
@ -89,7 +80,10 @@ public class TestCompactionTool {
+ Bytes.toString(HBaseTestingUtility.fam1); + Bytes.toString(HBaseTestingUtility.fam1);
FileStatus[] regionDirFiles = fs.listStatus(new Path(storePath)); FileStatus[] regionDirFiles = fs.listStatus(new Path(storePath));
assertEquals(10, regionDirFiles.length); assertEquals(10, regionDirFiles.length);
int result = ToolRunner.run(HBaseConfiguration.create(), new CompactionTool(), String defaultFS = testUtil.getMiniHBaseCluster().getConfiguration().get("fs.defaultFS");
Configuration config = HBaseConfiguration.create();
config.set("fs.defaultFS", defaultFS);
int result = ToolRunner.run(config, new CompactionTool(),
new String[]{"-compactOnce", "-major", storePath}); new String[]{"-compactOnce", "-major", storePath});
assertEquals(0,result); assertEquals(0,result);
regionDirFiles = fs.listStatus(new Path(storePath)); regionDirFiles = fs.listStatus(new Path(storePath));