This is an automated email from the ASF dual-hosted git repository. adoroszlai pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push: new 5c62fcb8940 HDDS-13496. Intermittent fork exit timeout in TestOzoneClientFactory (#8853) 5c62fcb8940 is described below commit 5c62fcb89407917ca2d8a85100467901b895d040 Author: Doroszlai, Attila <6454655+adorosz...@users.noreply.github.com> AuthorDate: Fri Aug 1 13:51:28 2025 +0200 HDDS-13496. Intermittent fork exit timeout in TestOzoneClientFactory (#8853) --- .../ozone/client/TestOzoneClientFactory.java | 68 ---------------------- .../ozone/client/rpc/TestSecureOzoneRpcClient.java | 19 ++++++ 2 files changed, 19 insertions(+), 68 deletions(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/TestOzoneClientFactory.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/TestOzoneClientFactory.java deleted file mode 100644 index 8e36254870b..00000000000 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/TestOzoneClientFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.hadoop.ozone.client; - -import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_RATIS_PIPELINE_LIMIT; -import static org.junit.jupiter.api.Assertions.assertInstanceOf; -import static org.junit.jupiter.api.Assertions.assertThrows; - -import java.io.IOException; -import java.security.PrivilegedExceptionAction; -import org.apache.hadoop.hdds.conf.OzoneConfiguration; -import org.apache.hadoop.ozone.MiniOzoneCluster; -import org.apache.hadoop.security.AccessControlException; -import org.apache.hadoop.security.UserGroupInformation; -import org.junit.jupiter.api.Test; - -/** - * Test implementation for OzoneClientFactory. - */ -public class TestOzoneClientFactory { - - @Test - public void testRemoteException() { - - OzoneConfiguration conf = new OzoneConfiguration(); - conf.setInt(OZONE_SCM_RATIS_PIPELINE_LIMIT, 10); - Exception e = assertThrows(Exception.class, () -> { - MiniOzoneCluster cluster = MiniOzoneCluster.newBuilder(conf) - .setNumDatanodes(3) - .build(); - - String omPort = cluster.getOzoneManager().getRpcPort(); - - UserGroupInformation realUser = - UserGroupInformation.createRemoteUser("realUser"); - UserGroupInformation proxyUser = UserGroupInformation.createProxyUser( - "user", realUser); - proxyUser.doAs(new PrivilegedExceptionAction<Void>() { - @Override - public Void run() throws IOException { - conf.set("ozone.security.enabled", "true"); - try (OzoneClient ozoneClient = - OzoneClientFactory.getRpcClient("localhost", Integer.parseInt(omPort), conf)) { - ozoneClient.getObjectStore().listVolumes("/"); - } - return null; - } - }); - }); - assertInstanceOf(AccessControlException.class, e); - } - -} diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java index b16b9effae8..750a4f4eb01 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java @@ -35,6 +35,7 @@ import java.io.File; import java.io.IOException; +import java.security.PrivilegedExceptionAction; import java.time.Instant; import java.util.HashMap; import java.util.UUID; @@ -62,6 +63,8 @@ import org.apache.hadoop.ozone.TestDataUtil; import org.apache.hadoop.ozone.client.BucketArgs; import org.apache.hadoop.ozone.client.OzoneBucket; +import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientFactory; import org.apache.hadoop.ozone.client.OzoneKey; import org.apache.hadoop.ozone.client.OzoneVolume; import org.apache.hadoop.ozone.client.SecretKeyTestClient; @@ -84,6 +87,7 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.S3Authentication; import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status; import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.VolumeInfo; +import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.security.UserGroupInformation; import org.apache.ozone.test.GenericTestUtils; import org.junit.jupiter.api.AfterAll; @@ -425,6 +429,21 @@ public void testS3Auth() throws Exception { assertEquals(Status.INVALID_TOKEN, omResponse.getStatus()); } + @Test + public void testRemoteException() { + UserGroupInformation realUser = UserGroupInformation.createRemoteUser("realUser"); + UserGroupInformation proxyUser = UserGroupInformation.createProxyUser("user", realUser); + + assertThrows(AccessControlException.class, () -> { + proxyUser.doAs((PrivilegedExceptionAction<Void>) () -> { + try (OzoneClient ozoneClient = OzoneClientFactory.getRpcClient(getCluster().getConf())) { + ozoneClient.getObjectStore().listVolumes("/"); + } + return null; + }); + }); + } + @Test @Override // Restart DN doesn't work with security enabled. --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@ozone.apache.org For additional commands, e-mail: commits-h...@ozone.apache.org