You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by xu...@apache.org on 2022/09/26 04:29:02 UTC

[hudi] branch master updated: [HUDI-4830] Fix testNoGlobalConfFileConfigured when add hudi-defaults.conf in default dir (#6652)

This is an automated email from the ASF dual-hosted git repository.

xushiyan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 8bf2f5738b [HUDI-4830] Fix testNoGlobalConfFileConfigured when add hudi-defaults.conf in default dir (#6652)
8bf2f5738b is described below

commit 8bf2f5738b627d18cd05d13c1bbd3cff14dffdc7
Author: Zouxxyy <zo...@qq.com>
AuthorDate: Mon Sep 26 12:28:55 2022 +0800

    [HUDI-4830] Fix testNoGlobalConfFileConfigured when add hudi-defaults.conf in default dir (#6652)
---
 .../hudi/common/util/TestDFSPropertiesConfiguration.java     | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/hudi-common/src/test/java/org/apache/hudi/common/util/TestDFSPropertiesConfiguration.java b/hudi-common/src/test/java/org/apache/hudi/common/util/TestDFSPropertiesConfiguration.java
index 465739340d..73d10d73d2 100644
--- a/hudi-common/src/test/java/org/apache/hudi/common/util/TestDFSPropertiesConfiguration.java
+++ b/hudi-common/src/test/java/org/apache/hudi/common/util/TestDFSPropertiesConfiguration.java
@@ -18,13 +18,16 @@
 
 package org.apache.hudi.common.util;
 
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hudi.common.config.DFSPropertiesConfiguration;
 import org.apache.hudi.common.config.TypedProperties;
+import org.apache.hudi.common.fs.FSUtils;
 import org.apache.hudi.common.testutils.minicluster.HdfsTestService;
 
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.DistributedFileSystem;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.apache.hudi.exception.HoodieIOException;
 import org.junit.Rule;
 import org.junit.contrib.java.lang.system.EnvironmentVariables;
 import org.junit.jupiter.api.AfterAll;
@@ -171,9 +174,14 @@ public class TestDFSPropertiesConfiguration {
   @Test
   public void testNoGlobalConfFileConfigured() {
     ENVIRONMENT_VARIABLES.clear(DFSPropertiesConfiguration.CONF_FILE_DIR_ENV_NAME);
-    // Should not throw any exception when no external configuration file configured
     DFSPropertiesConfiguration.refreshGlobalProps();
-    assertEquals(0, DFSPropertiesConfiguration.getGlobalProps().size());
+    try {
+      if (!FSUtils.getFs(DFSPropertiesConfiguration.DEFAULT_PATH, new Configuration()).exists(DFSPropertiesConfiguration.DEFAULT_PATH)) {
+        assertEquals(0, DFSPropertiesConfiguration.getGlobalProps().size());
+      }
+    } catch (IOException e) {
+      throw new HoodieIOException("Cannot check if the default config file exist: " + DFSPropertiesConfiguration.DEFAULT_PATH);
+    }
   }
 
   @Test