[HUDI-4437] Fix test conflicts by clearing file system cache (#6123)
Co-authored-by: jian.feng <fengjian428@gmial.com> Co-authored-by: jian.feng <jian.feng@shopee.com> Co-authored-by: Raymond Xu <2701446+xushiyan@users.noreply.github.com>
This commit is contained in:
@@ -107,7 +107,7 @@ public class TestHiveSyncTool {
|
|||||||
private HoodieHiveSyncClient hiveClient;
|
private HoodieHiveSyncClient hiveClient;
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void cleanUpClass() {
|
public static void cleanUpClass() throws IOException {
|
||||||
HiveTestUtil.shutdown();
|
HiveTestUtil.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import org.apache.hudi.hive.testutils.TestCluster;
|
|||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||||
|
|
||||||
@@ -49,7 +48,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
@Disabled
|
|
||||||
public class TestHiveSyncGlobalCommitTool {
|
public class TestHiveSyncGlobalCommitTool {
|
||||||
|
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public class HiveTestUtil {
|
|||||||
hiveSyncProps.setProperty(META_SYNC_PARTITION_FIELDS.key(), "datestr");
|
hiveSyncProps.setProperty(META_SYNC_PARTITION_FIELDS.key(), "datestr");
|
||||||
hiveSyncProps.setProperty(HIVE_BATCH_SYNC_PARTITION_NUM.key(), "3");
|
hiveSyncProps.setProperty(HIVE_BATCH_SYNC_PARTITION_NUM.key(), "3");
|
||||||
|
|
||||||
hiveSyncConfig = new HiveSyncConfig(hiveSyncProps, configuration);
|
hiveSyncConfig = new HiveSyncConfig(hiveSyncProps, getHiveConf());
|
||||||
|
|
||||||
dtfOut = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
dtfOut = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
||||||
ddlExecutor = new HiveQueryDDLExecutor(hiveSyncConfig);
|
ddlExecutor = new HiveQueryDDLExecutor(hiveSyncConfig);
|
||||||
@@ -176,7 +176,7 @@ public class HiveTestUtil {
|
|||||||
return hiveServer.getHiveConf();
|
return hiveServer.getHiveConf();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void shutdown() {
|
public static void shutdown() throws IOException {
|
||||||
if (hiveServer != null) {
|
if (hiveServer != null) {
|
||||||
hiveServer.stop();
|
hiveServer.stop();
|
||||||
}
|
}
|
||||||
@@ -186,6 +186,7 @@ public class HiveTestUtil {
|
|||||||
if (zkServer != null) {
|
if (zkServer != null) {
|
||||||
zkServer.shutdown();
|
zkServer.shutdown();
|
||||||
}
|
}
|
||||||
|
FileSystem.closeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createCOWTable(String instantTime, int numberOfPartitions, boolean useSchemaFromCommitMetadata,
|
public static void createCOWTable(String instantTime, int numberOfPartitions, boolean useSchemaFromCommitMetadata,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package org.apache.hudi.hive.testutils;
|
package org.apache.hudi.hive.testutils;
|
||||||
|
|
||||||
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hudi.avro.HoodieAvroWriteSupport;
|
import org.apache.hudi.avro.HoodieAvroWriteSupport;
|
||||||
import org.apache.hudi.common.bloom.BloomFilter;
|
import org.apache.hudi.common.bloom.BloomFilter;
|
||||||
import org.apache.hudi.common.bloom.BloomFilterFactory;
|
import org.apache.hudi.common.bloom.BloomFilterFactory;
|
||||||
@@ -264,10 +265,11 @@ public class TestCluster implements BeforeAllCallback, AfterAllCallback,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutDown() {
|
public void shutDown() throws IOException {
|
||||||
stopHiveServer2();
|
stopHiveServer2();
|
||||||
Hive.closeCurrent();
|
Hive.closeCurrent();
|
||||||
hiveTestService.getHiveMetaStore().stop();
|
hiveTestService.getHiveMetaStore().stop();
|
||||||
hdfsTestService.stop();
|
hdfsTestService.stop();
|
||||||
|
FileSystem.closeAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user