Browse Source

add mock getTaskLogName() for UT test pass (#6369)

2.0.7-release
百岁 3 years ago committed by GitHub
parent
commit
545173faa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dolphinscheduler-task-plugin/dolphinscheduler-task-tis/src/test/java/org/apache/dolphinscheduler/plugin/task/tis/TISTaskTest.java

4
dolphinscheduler-task-plugin/dolphinscheduler-task-tis/src/test/java/org/apache/dolphinscheduler/plugin/task/tis/TISTaskTest.java

@ -56,6 +56,7 @@ public class TISTaskTest {
String taskParams = "{\"targetJobName\":\"mysql_elastic\"}";
taskExecutionContext = Mockito.mock(TaskRequest.class);
Mockito.when(taskExecutionContext.getTaskLogName()).thenReturn("tislogger");
Mockito.when(taskExecutionContext.getTaskParams()).thenReturn(taskParams);
Mockito.when(taskExecutionContext.getExecutePath()).thenReturn("/tmp");
Mockito.when(taskExecutionContext.getTaskAppId()).thenReturn(UUID.randomUUID().toString());
@ -68,8 +69,7 @@ public class TISTaskTest {
Map<String, String> gloabParams = Collections.singletonMap(TISTask.KEY_POOL_VAR_TIS_HOST, "127.0.0.1:8080");
Mockito.when(taskExecutionContext.getDefinedParams()).thenReturn(gloabParams);
tisTask = PowerMockito.spy(new TISTask(taskExecutionContext));
//tisTask = new TISTask(taskExecutionContext);
tisTask = new TISTask(taskExecutionContext);
tisTask.init();
}

Loading…
Cancel
Save