Gabriel39 commented on code in PR #71396: URL: https://github.com/apache/doris/pull/71396#discussion_r4794558623
########## regression-test/suites/external_table_p0/kerberos/test_iceberg_hms_manifest_kerberos.groovy: ########## @@ -0,0 +1,246 @@ +// 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. + +suite("test_iceberg_hms_manifest_kerberos", "p0,external,kerberos,external_docker,external_docker_kerberos") { + if (!"true".equalsIgnoreCase(context.config.otherConfigs.get("enableKerberosTest"))) { + return + } + String externalEnvIp = context.config.otherConfigs.get("externalEnvIp") + String suffix = UUID.randomUUID().toString().replace("-", "").substring(0, 12) + String database = "manifest_auth_${suffix}" + def fixtures = [ + [catalog: "iceberg_manifest_a_${suffix}", realm: "LABS.TERADATA.COM", host: "hadoop-master", + hmsPort: 9583, hdfsPort: 8520, keytab: "hive-presto-master.keytab"], + [catalog: "iceberg_manifest_b_${suffix}", realm: "OTHERREALM.COM", host: "hadoop-master-2", + hmsPort: 9683, hdfsPort: 8620, keytab: "other-hive-presto-master.keytab"] + ] + String rules = 'RULE:[2:$1@$0](.*@LABS.TERADATA.COM)s/@.*//\n' + + 'RULE:[2:$1@$0](.*@OTHERREALM.COM)s/@.*//\nDEFAULT' + // The regression runner also needs the fixture credentials to verify HDFS cleanup after SDK purge errors. + String clientKeytabDir = context.config.otherConfigs.get("kerberosClientKeytabDir") ?: "/keytabs" Review Comment: Fixed in 278d20bdbc54. The suite now selects an explicit client keytab directory first, otherwise the complete readable keytab pair beside the resolved krb5.conf, otherwise the legacy /keytabs directory. This supports the documented rootless layout while preserving older fixtures and authoritative explicit overrides. Eleven source-bound prefix/preflight controls cover rootless, legacy, relative config, invalid overrides and missing files before SQL mutation. The cleanup child/process code is unchanged and source-bound to its prior secured-HDFS runtime checks. ########## fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/IcebergAuthenticatedFileIOTest.java: ########## @@ -0,0 +1,316 @@ +// 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.doris.datasource.iceberg; + +import org.apache.doris.common.security.authentication.ExecutionAuthenticator; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.security.UserGroupInformation; +import org.apache.iceberg.encryption.NativeFileCryptoParameters; +import org.apache.iceberg.encryption.NativelyEncryptedFile; +import org.apache.iceberg.exceptions.NotFoundException; +import org.apache.iceberg.exceptions.RuntimeIOException; +import org.apache.iceberg.hadoop.HadoopFileIO; +import org.apache.iceberg.inmemory.InMemoryFileIO; +import org.apache.iceberg.io.BulkDeletionFailureException; +import org.apache.iceberg.io.FileIO; +import org.apache.iceberg.io.InputFile; +import org.apache.iceberg.io.OutputFile; +import org.apache.iceberg.io.PositionOutputStream; +import org.apache.iceberg.io.SeekableInputStream; +import org.apache.iceberg.io.SupportsBulkOperations; +import org.junit.Assert; +import org.junit.Test; +import org.mockito.Mockito; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.security.PrivilegedExceptionAction; +import java.util.Arrays; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +public class IcebergAuthenticatedFileIOTest { + @Test + public void testNativeEncryptionParametersRemainAvailable() { + InputFile input = Mockito.mock(InputFile.class, + Mockito.withSettings().extraInterfaces(NativelyEncryptedFile.class)); + OutputFile output = Mockito.mock(OutputFile.class, + Mockito.withSettings().extraInterfaces(NativelyEncryptedFile.class)); + NativeFileCryptoParameters parameters = Mockito.mock(NativeFileCryptoParameters.class); + Mockito.when(((NativelyEncryptedFile) input).nativeCryptoParameters()).thenReturn(parameters); + Mockito.when(((NativelyEncryptedFile) output).nativeCryptoParameters()).thenReturn(parameters); + HadoopFileIO delegate = new HadoopFileIO(new Configuration(false)) { + @Override + public InputFile newInputFile(String path) { + return input; + } + + @Override + public OutputFile newOutputFile(String path) { + return output; + } + }; + IcebergAuthenticatedFileIO io = new IcebergAuthenticatedFileIO(delegate, authenticator("catalog_writer")); + NativelyEncryptedFile wrappedInput = (NativelyEncryptedFile) io.newInputFile("memory://warehouse/data"); Review Comment: Fixed in 278d20bdbc54. Every direct FileIO adapter test now registers its raw delegate with a strong owner on the JUnit instance before constructing the weak adapter. After each test, the delegates are closed and cleared. This fixes the two unowned fixtures without changing production weak ownership. All seven tests passed in the standard FE reactor; separate GC controls verify retained ownership and release after teardown. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
