[ https://issues.apache.org/jira/browse/HDDS-1889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16898119#comment-16898119 ]
Dinesh Chitlangia commented on HDDS-1889: ----------------------------------------- [~adoroszlai] FYI. > Add support for verifying multiline log entry > --------------------------------------------- > > Key: HDDS-1889 > URL: https://issues.apache.org/jira/browse/HDDS-1889 > Project: Hadoop Distributed Data Store > Issue Type: Test > Components: test > Reporter: Dinesh Chitlangia > Priority: Major > > This jira aims to test the failure scenario where a multi-line stack trace > will be added in the audit log. Currently, for test assumes that even in > failure scenario we don't have multi-line log entry. > Example: > {code:java} > private static final AuditMessage READ_FAIL_MSG = > new AuditMessage.Builder() > .setUser("john") > .atIp("192.168.0.1") > .forOperation(DummyAction.READ_VOLUME.name()) > .withParams(PARAMS) > .withResult(FAILURE) > .withException(null).build(); > {code} > Therefore in verifyLog() we only compare for first line of the log file with > the expected message. > The test would fail if in future someone were to create a scenario with > multi-line log entry. > 1. Update READ_FAIL_MSG so that it has multiple lines of Exception stack > trace. > This is what multi-line log entry could look like: > {code:java} > ERROR | OMAudit | user=dchitlangia | ip=127.0.0.1 | op=GET_ACL > {volume=volume80100, bucket=bucket83878, key=null, aclType=CREATE, > resourceType=volume, storeType=ozone} | ret=FAILURE > org.apache.hadoop.ozone.om.exceptions.OMException: User dchitlangia doesn't > have CREATE permission to access volume > at org.apache.hadoop.ozone.om.OzoneManager.checkAcls(OzoneManager.java:1809) > ~[classes/:?] > at org.apache.hadoop.ozone.om.OzoneManager.checkAcls(OzoneManager.java:1769) > ~[classes/:?] > at > org.apache.hadoop.ozone.om.OzoneManager.createBucket(OzoneManager.java:2092) > ~[classes/:?] > at > org.apache.hadoop.ozone.protocolPB.OzoneManagerRequestHandler.createBucket(OzoneManagerRequestHandler.java:526) > ~[classes/:?] > at > org.apache.hadoop.ozone.protocolPB.OzoneManagerRequestHandler.handle(OzoneManagerRequestHandler.java:185) > ~[classes/:?] > at > org.apache.hadoop.ozone.protocolPB.OzoneManagerProtocolServerSideTranslatorPB.submitRequestDirectlyToOM(OzoneManagerProtocolServerSideTranslatorPB.java:192) > ~[classes/:?] > at > org.apache.hadoop.ozone.protocolPB.OzoneManagerProtocolServerSideTranslatorPB.submitRequest(OzoneManagerProtocolServerSideTranslatorPB.java:110) > ~[classes/:?] > at > org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos$OzoneManagerService$2.callBlockingMethod(OzoneManagerProtocolProtos.java) > ~[classes/:?] > at > org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:524) > ~[hadoop-common-3.2.0.jar:?] > at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1025) > ~[hadoop-common-3.2.0.jar:?] > at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:876) > ~[hadoop-common-3.2.0.jar:?] > at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:822) > ~[hadoop-common-3.2.0.jar:?] > at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_144] > at javax.security.auth.Subject.doAs(Subject.java:422) ~[?:1.8.0_144] > at > org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1730) > ~[hadoop-common-3.2.0.jar:?] > at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2682) > ~[hadoop-common-3.2.0.jar:?] > {code} > 2. Update verifyLog method to accept variable number of arguments. > 3. Update the assertion so that it compares beyond the first line when the > expected in a multi-line log entry. > {code:java} > assertTrue(expected.equalsIgnoreCase(lines.get(0))); > {code} -- This message was sent by Atlassian JIRA (v7.6.14#76016) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org