Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,22 @@ jobs:
-Dmaven.test.skip=false \
-Dspotless.skip=true \
-DskipUT=false \
-Danalyze.skip=true
-Danalyze.skip=true \
-Dsurefire.printSummary=true \
-Dsurefire.useFile=false \
-Dsurefire.reportFormat=plain \
-Dsurefire.redirectTestOutputToFile=false

- name: Collect jacoco exec files
if: always()
run: |
mkdir -p /tmp/jacoco-exec
find . -name "jacoco.exec" -exec cp --backup=numbered {} /tmp/jacoco-exec/ \;
find . -path "*/target/*.exec" -type f | while IFS= read -r exec_file; do
target_file="/tmp/jacoco-exec/${exec_file#./}"
mkdir -p "$(dirname "$target_file")"
cp "$exec_file" "$target_file"
done
find /tmp/jacoco-exec -name "*.exec" -print

- name: Upload jacoco exec
uses: actions/upload-artifact@v6
Expand Down
38 changes: 38 additions & 0 deletions dolphinscheduler-master/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,44 @@
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<configuration>
<excludes>
<exclude>**/integration/cases/*TestCase.java</exclude>
</excludes>
<properties>
<configurationParameters>junit.jupiter.execution.parallel.enabled = false</configurationParameters>
</properties>
</configuration>
</execution>
<execution>
<id>spring-boot-integration-test</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
<configuration>
<includes>
<include>**/integration/cases/*TestCase.java</include>
</includes>
<forkCount>4</forkCount>
<reuseForks>true</reuseForks>
<properties>
<configurationParameters>junit.jupiter.execution.parallel.enabled = false</configurationParameters>
</properties>
<systemPropertyVariables>
<jacoco-agent.destfile>${project.build.directory}/jacoco-${surefire.forkNumber}.exec</jacoco-agent.destfile>
</systemPropertyVariables>
Comment thread
SbloodyS marked this conversation as resolved.
Comment thread
SbloodyS marked this conversation as resolved.
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@Slf4j
@SpringBootTest(classes = {
MasterServer.class,
DaoConfiguration.class})
DaoConfiguration.class}, properties = "spring.config.additional-location=classpath:/spring-it-application.yaml")
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
public abstract class AbstractMasterIntegrationTestCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.dolphinscheduler.dao.repository.WorkflowDefinitionLogDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowTaskRelationLogDao;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;

import org.apache.commons.collections4.CollectionUtils;

Expand All @@ -51,6 +52,8 @@
@Component
public class WorkflowTestCaseContextFactory {

private static final String DEFAULT_MASTER_ADDRESS = "127.0.0.1:5678";

@Autowired
private ProjectDao projectDao;

Expand Down Expand Up @@ -84,8 +87,12 @@ public class WorkflowTestCaseContextFactory {
@Autowired
private IEnvironmentDao environmentDao;

@Autowired
private MasterConfig masterConfig;

public WorkflowTestCaseContext initializeContextFromYaml(final String yamlPath) {
final WorkflowTestCaseContext workflowTestCaseContext = YamlFactory.load(yamlPath);
normalizeDefaultMasterAddress(workflowTestCaseContext);
initializeProjectToDB(workflowTestCaseContext.getProject());
initializeWorkflowDefinitionToDB(workflowTestCaseContext.getWorkflows());
initializeTaskDefinitionsToDB(workflowTestCaseContext.getTasks());
Expand All @@ -98,6 +105,33 @@ public WorkflowTestCaseContext initializeContextFromYaml(final String yamlPath)
return workflowTestCaseContext;
}

private void normalizeDefaultMasterAddress(final WorkflowTestCaseContext workflowTestCaseContext) {
normalizeWorkflowInstanceHost(workflowTestCaseContext.getWorkflowInstances());
normalizeTaskInstanceHost(workflowTestCaseContext.getTaskInstances());
}

private void normalizeWorkflowInstanceHost(final List<WorkflowInstance> workflowInstances) {
if (CollectionUtils.isEmpty(workflowInstances)) {
return;
}
for (final WorkflowInstance workflowInstance : workflowInstances) {
if (DEFAULT_MASTER_ADDRESS.equals(workflowInstance.getHost())) {
workflowInstance.setHost(masterConfig.getMasterAddress());
}
}
}

private void normalizeTaskInstanceHost(final List<TaskInstance> taskInstances) {
if (CollectionUtils.isEmpty(taskInstances)) {
return;
}
for (final TaskInstance taskInstance : taskInstances) {
if (DEFAULT_MASTER_ADDRESS.equals(taskInstance.getHost())) {
taskInstance.setHost(masterConfig.getMasterAddress());
}
}
}

private void initializeTaskInstancesToDB(List<TaskInstance> taskInstances) {
if (CollectionUtils.isEmpty(taskInstances)) {
return;
Expand Down
Loading
Loading