Open zathoma-sys opened 1 week ago
Hi @zathoma-sys, thank you for your report The described problem may be relevant if we do not report an important attachment to the Jira. As a possible solution, I can suggest adding to the query "findAllUnderTestItemByLaunchIdAndTestItemIdsWithLimit" orderBy(LOG.ATTACHMENT_ID.isNotNull().desc()) which will return first of all those logs that have attachments. I don't see the point in attaching 50+ logs to the Jira, since it is more convenient to analyze errors in RP anyway.
Describe the bug If Attachments are selected for inclusion in JIRA-Server Issue Post, but Logs are not, only the attachments form the first 50 logs get included.
It seems that the problem is originating from the maximum log limit being applied on the wrong code level, that is before the logs are checked for attachments and evaluated against the "include attachment" and "include logs" options:
com.epam.reportportal.extension.bugtracking.jira.JIRATicketDescriptionService#updateWithLogsInfo(StringBuilder descriptionBuilder, Long backLinkId, PostTicketRQ ticketRQ) calls com.epam.ta.reportportal.dao.LogRepository#findAllUnderTestItemByLaunchIdAndTestItemIdsWithLimit(Long launchId, List itemIds, int limit) to get all log entries used for including logs and/or attachments to the JIRA issue post here:
The limit on number of entries is passed to LogRepository#(findAllUnderTestItemByLaunchIdAndTestItemIdsWithLimit(...)) in the code block above via a call to ticketRQ.getNumberOfLogs(), which will return 50 (ultimately from ValidationConstraints.TICKET_MAX_LOG_SIZE). After retrieving the first 50 logs from the test item, JIRATicketDescriptionService#updateWithLog(...) is applied to each item in the collection of log entries (see lines 136-137 above), where attachments are included, if that option was selected (see the "includeScreenshot" boolean parameter):
The result of all of this is that attachments will only ever be included from the first 50 logs, whether the number of included attachments is very large or not.
Expected behavior All attachments (at least up to some reasonable maximum) are included in the JIRA issue regardless of how far into the log output they are.
Screenshots The test step output showing all attachments:
The post issue form as submitted:
All attachments included in the JIRA issue (note the missing html attachment and two missing screenshots):
Versions: