Skip to content

Commit

Permalink
EPMRPP-88291 || Fix case when child recalculates parent status when s…
Browse files Browse the repository at this point in the history
…tatus is already defined (#1874)

* EPMRPP-88291 || Fix case when child recalculates parent status when status is already defined

* EPMRPP-88291 || Fix tests
  • Loading branch information
IvanKustau authored Nov 23, 2023
1 parent fa85842 commit 7eb2abb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public void changeParentStatus(TestItem childItem, Long projectId, ReportPortalU

private boolean isParentStatusUpdateRequired(TestItem parent) {
return parent.getItemResults().getStatus() != StatusEnum.IN_PROGRESS
&& parent.getItemResults().getStatus() != PASSED
&& parent.getItemResults().getStatus() != FAILED
&& !testItemRepository.hasItemsInStatusByParent(parent.getItemId(), parent.getPath(),
StatusEnum.IN_PROGRESS.name());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ void changeStatusFromPassedToSkippedWithoutIssue() throws Exception {

@Sql("/db/test-item/item-change-status-from-passed.sql")
@Test
void finishTestItemWithFinishedParent() throws Exception {
void finishChildTestItemWithFailedStatusWithFinishedParentWithPassedStatus() throws Exception {
FinishTestItemRQ rq = new FinishTestItemRQ();
rq.setLaunchUuid(UUID.randomUUID().toString());
rq.setEndTime(Date.from(LocalDateTime.now().atZone(ZoneId.of("UTC")).toInstant()));
Expand All @@ -783,12 +783,12 @@ void finishTestItemWithFinishedParent() throws Exception {
updatedItem.get().getItemResults().getIssue().getIssueType().getIssueGroup()
.getTestItemIssueGroup()
);
assertEquals(StatusEnum.FAILED,
assertEquals(StatusEnum.PASSED,
testItemRepository.findById(updatedItem.get().getParentId()).get().getItemResults()
.getStatus());

Launch launch = launchRepository.findById(updatedItem.get().getLaunchId()).get();
assertEquals(StatusEnum.FAILED, launch.getStatus());
assertEquals(StatusEnum.PASSED, launch.getStatus());
}

@Sql("/db/test-item/item-change-status-from-failed.sql")
Expand Down

0 comments on commit 7eb2abb

Please sign in to comment.