From 718a01bb429baedffa8f394e121d5c6e01599406 Mon Sep 17 00:00:00 2001 From: Rick Cheng Date: Thu, 8 Feb 2024 09:19:56 +0800 Subject: [PATCH] [Improvement][UT] Add UT for end time check when force success task (#15562) --- .../dolphinscheduler/api/service/TaskInstanceServiceTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskInstanceServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskInstanceServiceTest.java index b537c06dda..aca0d80a6f 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskInstanceServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskInstanceServiceTest.java @@ -343,7 +343,7 @@ public class TaskInstanceServiceTest { } @Test - public void forceTaskSuccess() { + public void testForceTaskSuccess() { User user = getAdminUser(); long projectCode = 1L; Project project = getProject(projectCode); @@ -392,12 +392,14 @@ public class TaskInstanceServiceTest { // test success task.setState(TaskExecutionStatus.FAILURE); + task.setEndTime(null); when(taskInstanceMapper.updateById(task)).thenReturn(1); putMsg(result, Status.SUCCESS, projectCode); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(user, project, projectCode, FORCED_SUCCESS)).thenReturn(result); Result successRes = taskInstanceService.forceTaskSuccess(user, projectCode, taskId); Assertions.assertEquals(Status.SUCCESS.getCode(), successRes.getCode().intValue()); + Assertions.assertNotNull(task.getEndTime()); }