1
0

[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:
冯健
2022-07-23 08:58:04 +08:00
committed by GitHub
parent af10a97e7a
commit 340c3dbbe1
4 changed files with 7 additions and 6 deletions

View File

@@ -107,7 +107,7 @@ public class TestHiveSyncTool {
private HoodieHiveSyncClient hiveClient;
@AfterAll
public static void cleanUpClass() {
public static void cleanUpClass() throws IOException {
HiveTestUtil.shutdown();
}

View File

@@ -24,7 +24,6 @@ import org.apache.hudi.hive.testutils.TestCluster;
import org.apache.hadoop.fs.Path;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
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.assertTrue;
@Disabled
public class TestHiveSyncGlobalCommitTool {
@RegisterExtension

View File

@@ -141,7 +141,7 @@ public class HiveTestUtil {
hiveSyncProps.setProperty(META_SYNC_PARTITION_FIELDS.key(), "datestr");
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");
ddlExecutor = new HiveQueryDDLExecutor(hiveSyncConfig);
@@ -176,7 +176,7 @@ public class HiveTestUtil {
return hiveServer.getHiveConf();
}
public static void shutdown() {
public static void shutdown() throws IOException {
if (hiveServer != null) {
hiveServer.stop();
}
@@ -186,6 +186,7 @@ public class HiveTestUtil {
if (zkServer != null) {
zkServer.shutdown();
}
FileSystem.closeAll();
}
public static void createCOWTable(String instantTime, int numberOfPartitions, boolean useSchemaFromCommitMetadata,

View File

@@ -18,6 +18,7 @@
package org.apache.hudi.hive.testutils;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hudi.avro.HoodieAvroWriteSupport;
import org.apache.hudi.common.bloom.BloomFilter;
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();
Hive.closeCurrent();
hiveTestService.getHiveMetaStore().stop();
hdfsTestService.stop();
FileSystem.closeAll();
}
}