Skip to content

Commit

Permalink
[HUDI-4830] Fix testNoGlobalConfFileConfigured when add hudi-defaults…
Browse files Browse the repository at this point in the history
….conf in default dir (#6652)
  • Loading branch information
Zouxxyy authored Sep 26, 2022
1 parent df69aa7 commit 8bf2f57
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -171,9 +174,14 @@ public void testLocalFileSystemLoading() throws IOException {
@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
Expand Down

0 comments on commit 8bf2f57

Please sign in to comment.