[MINOR] HoodieClientTestHarness close resources in AfterAll phase (#2646)
Parameterized test case like `org.apache.hudi.table.upgrade.TestUpgradeDowngrade#testUpgrade` incurs flakiness when org.apache.hadoop.fs.FileSystem#closeAll is invoked at BeforeEach; it should be invoked in AfterAll instead.
This commit is contained in:
@@ -48,6 +48,7 @@ import org.apache.log4j.Logger;
|
|||||||
import org.apache.spark.api.java.JavaRDD;
|
import org.apache.spark.api.java.JavaRDD;
|
||||||
import org.apache.spark.api.java.JavaSparkContext;
|
import org.apache.spark.api.java.JavaSparkContext;
|
||||||
import org.apache.spark.sql.SQLContext;
|
import org.apache.spark.sql.SQLContext;
|
||||||
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.TestInfo;
|
import org.junit.jupiter.api.TestInfo;
|
||||||
import scala.Tuple2;
|
import scala.Tuple2;
|
||||||
@@ -86,6 +87,11 @@ public abstract class HoodieClientTestHarness extends HoodieCommonTestHarness im
|
|||||||
protected transient MiniDFSCluster dfsCluster;
|
protected transient MiniDFSCluster dfsCluster;
|
||||||
protected transient DistributedFileSystem dfs;
|
protected transient DistributedFileSystem dfs;
|
||||||
|
|
||||||
|
@AfterAll
|
||||||
|
public static void tearDownAll() throws IOException {
|
||||||
|
FileSystem.closeAll();
|
||||||
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setTestMethodName(TestInfo testInfo) {
|
public void setTestMethodName(TestInfo testInfo) {
|
||||||
if (testInfo.getTestMethod().isPresent()) {
|
if (testInfo.getTestMethod().isPresent()) {
|
||||||
@@ -246,7 +252,6 @@ public abstract class HoodieClientTestHarness extends HoodieCommonTestHarness im
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
protected void initDFS() throws IOException {
|
protected void initDFS() throws IOException {
|
||||||
FileSystem.closeAll();
|
|
||||||
hdfsTestService = new HdfsTestService();
|
hdfsTestService = new HdfsTestService();
|
||||||
dfsCluster = hdfsTestService.start(true);
|
dfsCluster = hdfsTestService.start(true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user