jerqi commented on code in PR #9565: URL: https://github.com/apache/gravitino/pull/9565#discussion_r2655001682
########## flink-connector/flink/src/test/java/org/apache/gravitino/flink/connector/integration/test/hive/FlinkHiveKerberosClientIT.java: ########## @@ -0,0 +1,243 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.gravitino.flink.connector.integration.test.hive; + +import static org.apache.gravitino.server.authentication.KerberosConfig.KEYTAB; +import static org.apache.gravitino.server.authentication.KerberosConfig.PRINCIPAL; +import static org.apache.hadoop.minikdc.MiniKdc.MAX_TICKET_LIFETIME; + +import com.google.common.collect.Maps; +import java.io.File; +import java.security.PrivilegedAction; +import java.util.Arrays; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Collectors; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.table.api.EnvironmentSettings; +import org.apache.flink.table.api.TableEnvironment; +import org.apache.flink.table.catalog.Catalog; +import org.apache.flink.table.catalog.CommonCatalogOptions; +import org.apache.flink.table.catalog.hive.factories.HiveCatalogFactoryOptions; +import org.apache.gravitino.Configs; +import org.apache.gravitino.auth.AuthenticatorType; +import org.apache.gravitino.catalog.hive.HiveConstants; +import org.apache.gravitino.flink.connector.PropertiesConverter; +import org.apache.gravitino.flink.connector.hive.GravitinoHiveCatalog; +import org.apache.gravitino.flink.connector.hive.GravitinoHiveCatalogFactoryOptions; +import org.apache.gravitino.flink.connector.integration.test.FlinkEnvIT; +import org.apache.gravitino.flink.connector.store.GravitinoCatalogStoreFactoryOptions; +import org.apache.hadoop.minikdc.KerberosSecurityTestcase; +import org.apache.hadoop.security.UserGroupInformation; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; + +/** + * Integration test for creating Gravitino Hive catalogs with Kerberos authentication. This test + * verifies that catalog creation works correctly when the Gravitino server is configured with + * Kerberos authentication. The test extends FlinkEnvIT directly to keep the test scope focused on + * Kerberos-specific scenarios. + */ +@Tag("gravitino-docker-test") +public class FlinkHiveKerberosClientIT extends FlinkEnvIT { + + private static final KerberosSecurityTestcase kdc = + new KerberosSecurityTestcase() { + @Override + public void createMiniKdcConf() { + super.createMiniKdcConf(); + // Use a very short ticket lifetime to speed up Kerberos expiration in tests. + // The test operations are executed immediately after the MiniKdc is started and + // are not long-running, so a 5-second lifetime is sufficient and keeps the test + // fast. If this test ever becomes flaky on slower environments or CI systems, + // consider increasing this value to a more forgiving lifetime (for example, 60s). + getConf().setProperty(MAX_TICKET_LIFETIME, "5"); Review Comment: MAX_TICKET_LIFETIME property expects seconds. If it expects millseconds, it will be very flaky. We have similar test cases. They didn't fail. -- 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]
