openinx commented on a change in pull request #1659:
URL: https://github.com/apache/iceberg/pull/1659#discussion_r512543268
##########
File path:
flink/src/test/java/org/apache/iceberg/flink/TestFlinkHiveCatalog.java
##########
@@ -76,6 +78,36 @@ public void testCreateCatalogWithHiveConfDir() throws
IOException {
checkSQLQuery(props, warehouseDir);
}
+ @Test
+ public void testCreateCatalogWithHiveHome() throws IOException {
+ File hiveHome = tempFolder.newFolder();
+ File hiveConfDir = new File(hiveHome, "conf");
+ hiveConfDir.mkdir();
+ File hiveSiteXML = new File(hiveConfDir, "hive-site.xml");
+ File warehouseDir = tempFolder.newFolder();
+
+ try (FileOutputStream fos = new FileOutputStream(hiveSiteXML)) {
+ Configuration newConf = new Configuration(hiveConf);
+ newConf.set(HiveConf.ConfVars.METASTOREWAREHOUSE.varname, "file://" +
warehouseDir.getAbsolutePath());
+ newConf.writeXml(fos);
+ }
+ Assert.assertTrue("hive-site.xml should be created now.",
Files.exists(hiveSiteXML.toPath()));
+
+ final Map<String, String> originalEnv = System.getenv();
+ final Map<String, String> newEnv = new HashMap<>(originalEnv);
+
+ newEnv.put("HIVE_HOME", hiveHome.getAbsolutePath());
+ CommonTestUtils.setEnv(newEnv);
+
+ // Construct the catalog attributions.
+ Map<String, String> props = Maps.newHashMap();
+ props.put("type", "iceberg");
+ props.put(FlinkCatalogFactory.ICEBERG_CATALOG_TYPE, "hive");
+ props.put(FlinkCatalogFactory.HIVE_URI,
FlinkCatalogTestBase.getURI(hiveConf));
+
+ checkSQLQuery(props, warehouseDir);
Review comment:
We only need to read the HIVE_HOME when `CREATE CATALOG`, and we've
done all testing things when in `finally` block. I did not get you point why
the UT would be failure .
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]