From 3329257d99d2808e66ae6c2fe87a9c4f8877026f Mon Sep 17 00:00:00 2001 From: HUAN-PING SU Date: Tue, 27 Aug 2019 14:28:23 +0800 Subject: [PATCH] HDDS-1998. TestSecureContainerServer#testClientServerRatisGrpc is failing (#1328) --- .../container/server/TestSecureContainerServer.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/server/TestSecureContainerServer.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/server/TestSecureContainerServer.java index 4de814c9f61..431994e23dd 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/server/TestSecureContainerServer.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/server/TestSecureContainerServer.java @@ -19,6 +19,7 @@ package org.apache.hadoop.ozone.container.server; import org.apache.commons.lang3.RandomUtils; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.hadoop.hdds.HddsConfigKeys; import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.hdds.protocol.DatanodeDetails; @@ -72,7 +73,6 @@ import java.util.List; import java.util.Set; import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_BLOCK_TOKEN_ENABLED; -import static org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.Result.BLOCK_TOKEN_VERIFICATION_FAILED; import static org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.Result.SUCCESS; import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_SECURITY_ENABLED_KEY; import static org.apache.hadoop.ozone.container.ContainerTestHelper.getCreateContainerRequest; @@ -80,6 +80,7 @@ import static org.apache.hadoop.ozone.container.ContainerTestHelper.getTestConta import static org.apache.ratis.rpc.SupportedRpcType.GRPC; import static org.apache.ratis.rpc.SupportedRpcType.NETTY; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * Test Container servers when security is enabled. @@ -202,9 +203,11 @@ public class TestSecureContainerServer { " authenticate with GRPC XceiverServer with Ozone block token", () -> finalClient.sendCommand(request)); } else { - ContainerCommandResponseProto response = finalClient. - sendCommand(request); - assertEquals(BLOCK_TOKEN_VERIFICATION_FAILED, response.getResult()); + IOException e = LambdaTestUtils.intercept(IOException.class, + () -> finalClient.sendCommand(request)); + Throwable rootCause = ExceptionUtils.getRootCause(e); + String msg = rootCause.getMessage(); + assertTrue(msg, msg.contains("Block token verification failed")); } // Test 2: Test success in request with valid block token.