reportportal / reportportal

Main Repository. ReportPortal starts here - see readme below.
http://reportportal.io
Apache License 2.0
1.75k stars 467 forks source link

Missing Attachments from Jira-Server Issue Post #2412

Open zathoma-sys opened 1 week ago

zathoma-sys commented 1 week ago

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:

{52B67329-C043-44E9-BBEA-54B9DBB66B06}

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):

{72A545FB-602F-40F7-BEE9-2FF010502DD6}

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: {3C48C65B-160F-4A14-9310-96F28052022C}

The post issue form as submitted: {D9C7043C-EC45-497A-951F-1ACC241A7F7B}

All attachments included in the JIRA issue (note the missing html attachment and two missing screenshots): {7EF7C5BC-5F59-4B70-B187-151567F59437}

Versions:

APiankouski commented 6 days 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.