codope commented on a change in pull request #3771:
URL: https://github.com/apache/hudi/pull/3771#discussion_r730745244
##########
File path:
hudi-sync/hudi-hive-sync/src/test/java/org/apache/hudi/hive/TestHiveSyncTool.java
##########
@@ -1017,4 +1019,34 @@ public void testTypeConverter(String syncMode) throws
Exception {
.containsValue("BIGINT"), errorMsg);
ddlExecutor.runSQL(dropTableSql);
}
+
+ @Test
+ public void testHiveSyncOfKerberosEnvironment() throws Exception {
+ // Path to the krb5 file
+ String KER5_PATH = "/krb5.conf";
+ // Path to the user keytab file
+ String PRINCIPAL = "/test.keytab";
+ // User Principal
+ String KEYTAB_PATH = "test@HADOOP";
+ // Kerberos authentication of the client
+ System.setProperty("java.security.krb5.conf", KER5_PATH);
+ Configuration conf = new Configuration();
+ conf.set("hadoop.security.authentication", "kerberos");
+ UserGroupInformation.setConfiguration(conf);
+ UserGroupInformation.loginUserFromKeytab(PRINCIPAL, KEYTAB_PATH);
+ // If flink or Spark is used, you need to use the Kerberos authentication
method recommended by Flink or Spark
+
+ // Setting Kerberos Parameters
+ // Hive Principal
+ String HIVE_PRINCIPAL = "hive@HADOOP";
+ HiveTestUtil.hiveSyncConfig.useKerberos = true;
+ HiveTestUtil.hiveSyncConfig.kerberosPrincipal = HIVE_PRINCIPAL;
+ HiveSyncTool hiveSyncTool = new HiveSyncTool(hiveSyncConfig,
HiveTestUtil.getHiveConf(), HiveTestUtil.fileSystem);
+ HoodieHiveClient hoodieHiveClient = hiveSyncTool.hoodieHiveClient;
+
+ // Create a database in Hive. If the database is created successfully
+ // the client synchronizes the Kerberos metadata for managing Hive
+ hoodieHiveClient.createDatabase(hiveSyncConfig.databaseName);
+
Review comment:
In the end could you also assert that database got created? Something
like:
```
assertTrue(hoodieHiveClient.doesDataBaseExist(hiveSyncConfig.databaseName));
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]