Browse Source

[hotfix][UI] Remove SURVEIL and NEXT_LOOP in ui (#12160)

* Remove SURVEIL and NEXT_LOOP in ui

* Fix UT
3.2.0-release
Wenjun Ruan 2 years ago committed by GitHub
parent
commit
d526dd89f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-api/src/main/resources/task-type-config.yaml
  2. 41
      dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/BlockingTaskTest.java
  3. 36
      dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/SubProcessTaskTest.java

2
dolphinscheduler-api/src/main/resources/task-type-config.yaml

@ -37,8 +37,6 @@ task:
- 'DEPENDENT'
- 'CONDITIONS'
- 'SWITCH'
- 'NEXT_LOOP'
- 'SURVEIL'
dataIntegration:
- 'SEATUNNEL'
- 'DATAX'

41
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/BlockingTaskTest.java

@ -19,16 +19,16 @@ package org.apache.dolphinscheduler.server.master;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_BLOCKING;
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.plugin.task.api.enums.DependentRelation;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.plugin.task.api.model.DependentItem;
import org.apache.dolphinscheduler.plugin.task.api.model.DependentTaskModel;
import org.apache.dolphinscheduler.plugin.task.api.parameters.BlockingParameters;
@ -47,14 +47,12 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.context.ApplicationContext;
@RunWith(MockitoJUnitRunner.Silent.class)
public class BlockingTaskTest {
/**
@ -68,22 +66,22 @@ public class BlockingTaskTest {
private MasterConfig config;
@Before
public void before() {
// init spring context
ApplicationContext applicationContext = Mockito.mock(ApplicationContext.class);
SpringApplicationContext springApplicationContext = new SpringApplicationContext();
springApplicationContext.setApplicationContext(applicationContext);
private MockedStatic<SpringApplicationContext> mockedStaticSpringApplicationContext;
@BeforeEach
public void before() {
// mock master
config = new MasterConfig();
Mockito.when(applicationContext.getBean(MasterConfig.class)).thenReturn(config);
config.setTaskCommitRetryTimes(3);
config.setTaskCommitInterval(Duration.ofSeconds(1));
mockedStaticSpringApplicationContext = Mockito.mockStatic(SpringApplicationContext.class);
Mockito.when(SpringApplicationContext.getBean(MasterConfig.class)).thenReturn(config);
// mock process service
processService = Mockito.mock(ProcessService.class);
Mockito.when(applicationContext.getBean(ProcessService.class)).thenReturn(processService);
Mockito.when(SpringApplicationContext.getBean(ProcessService.class)).thenReturn(processService);
// mock process instance
processInstance = getProcessInstance();
@ -99,6 +97,11 @@ public class BlockingTaskTest {
.thenReturn(taskDefinition);
}
@AfterEach
public void after() {
mockedStaticSpringApplicationContext.close();
}
private ProcessInstance getProcessInstance() {
// mock process instance
ProcessInstance processInstance = new ProcessInstance();
@ -200,8 +203,8 @@ public class BlockingTaskTest {
// for BlockingTaskExecThread.waitTaskQuit
List<TaskInstance> conditions = getTaskInstanceForValidTaskList(expectResults);
Mockito.when(processService.
findValidTaskListByProcessId(processInstance.getId(),processInstance.getTestFlag()))
Mockito.when(
processService.findValidTaskListByProcessId(processInstance.getId(), processInstance.getTestFlag()))
.thenReturn(conditions);
return taskInstance;
}

36
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/SubProcessTaskTest.java

@ -39,17 +39,13 @@ import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.context.ApplicationContext;
@RunWith(MockitoJUnitRunner.class)
public class SubProcessTaskTest {
/**
@ -62,23 +58,22 @@ public class SubProcessTaskTest {
private ProcessInstance processInstance;
private MockedStatic<ServerLifeCycleManager> mockedStaticServerLifeCycleManager;
private MockedStatic<SpringApplicationContext> mockedStaticSpringApplicationContext;
@Before
@BeforeEach
public void before() {
ApplicationContext applicationContext = Mockito.mock(ApplicationContext.class);
SpringApplicationContext springApplicationContext = new SpringApplicationContext();
springApplicationContext.setApplicationContext(applicationContext);
MasterConfig config = new MasterConfig();
Mockito.when(applicationContext.getBean(MasterConfig.class)).thenReturn(config);
config.setTaskCommitRetryTimes(3);
config.setTaskCommitInterval(Duration.ofSeconds(1));
mockedStaticServerLifeCycleManager = Mockito.mockStatic(ServerLifeCycleManager.class);
Mockito.when(ServerLifeCycleManager.isStopped()).thenReturn(false);
mockedStaticSpringApplicationContext = Mockito.mockStatic(SpringApplicationContext.class);
Mockito.when(SpringApplicationContext.getBean(MasterConfig.class)).thenReturn(config);
processService = Mockito.mock(ProcessService.class);
Mockito.when(applicationContext.getBean(ProcessService.class)).thenReturn(processService);
Mockito.when(SpringApplicationContext.getBean(ProcessService.class)).thenReturn(processService);
mockedStaticServerLifeCycleManager = Mockito.mockStatic(ServerLifeCycleManager.class);
Mockito.when(ServerLifeCycleManager.isStopped()).thenReturn(false);
processInstance = getProcessInstance();
Mockito.when(processService
@ -91,9 +86,10 @@ public class SubProcessTaskTest {
taskDefinition.setTimeout(0);
}
@After
@AfterEach
public void after() {
mockedStaticServerLifeCycleManager.close();
mockedStaticSpringApplicationContext.close();
}
private TaskInstance testBasicInit(WorkflowExecutionStatus expectResult) {
@ -166,12 +162,6 @@ public class SubProcessTaskTest {
return processInstance;
}
private TaskInstance getTaskInstance() {
TaskInstance taskInstance = new TaskInstance();
taskInstance.setId(1000);
return taskInstance;
}
private ProcessInstance getSubProcessInstance(WorkflowExecutionStatus executionStatus) {
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(102);

Loading…
Cancel
Save