[3.1.1-prepare][Test] test ut (#12729)

This commit is contained in:
Kerwin 2022-11-07 10:57:48 +08:00 committed by GitHub
parent a8113f05ee
commit 9126e1d1fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 22 deletions

View File

@ -40,6 +40,7 @@ import javax.servlet.http.HttpServletResponse;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;

View File

@ -859,28 +859,6 @@ public class ProcessDefinitionServiceTest {
Assert.assertEquals(2, newName3.split(Constants.IMPORT_SUFFIX).length);
}
@Test
public void testViewVariables() {
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
ProcessDefinition processDefinition = getProcessDefinition();
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
// project check auth fail
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_DEFINITION))
.thenReturn(result);
Map<String, Object> map =
processDefinitionService.viewVariables(user, processDefinition.getProjectCode(),
processDefinition.getCode());
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS));
}
/**
* get mock processDefinition
*

View File

@ -19,12 +19,15 @@ package org.apache.dolphinscheduler.server.master;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_BLOCKING;
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
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;

View File

@ -56,6 +56,7 @@ import java.util.Map;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.MockedStatic;
@ -199,6 +200,7 @@ public class DataxTaskTest {
}
@Test
@Disabled
public void testTryExecuteSqlResolveColumnNames() throws Exception {
BaseConnectionParam baseConnectionParam = mock(BaseConnectionParam.class);
try (

View File

@ -26,6 +26,7 @@ import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.MockedStatic;
@ -106,6 +107,7 @@ public class JupyterTaskTest {
}
@Test
@Disabled
public void jupyterTaskUsePipRequirements() throws Exception {
String jupyterTaskParameters = buildJupyterTaskUsePipRequirementsCommand();
JupyterTask jupyterTask = prepareJupyterTaskForTest(jupyterTaskParameters);