From 4c0993cdf490eb0898fba42908270d10dff32001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=B1=E5=88=BB?= Date: Mon, 26 Jul 2021 22:04:36 +0800 Subject: [PATCH] [Fix-5781][UT] Fix test coverage in sonar (#5817) * build(UT): make jacoco running in offline-instrumentation issue: #5781 * build(UT): remove the jacoco agent dependency in microbench issue: #5781 --- .github/workflows/ci_ut.yml | 2 +- .../dolphinscheduler-alert-dingtalk/pom.xml | 7 +++++ .../dolphinscheduler-alert-email/pom.xml | 7 +++++ .../dolphinscheduler-alert-feishu/pom.xml | 7 +++++ .../dolphinscheduler-alert-http/pom.xml | 7 +++++ .../dolphinscheduler-alert-script/pom.xml | 7 +++++ .../dolphinscheduler-alert-slack/pom.xml | 7 +++++ .../dolphinscheduler-alert-wechat/pom.xml | 7 +++++ dolphinscheduler-alert/pom.xml | 7 +++++ dolphinscheduler-api/pom.xml | 7 +++++ dolphinscheduler-common/pom.xml | 7 +++++ dolphinscheduler-dao/pom.xml | 6 +++++ .../pom.xml | 7 +++++ dolphinscheduler-remote/pom.xml | 7 +++++ dolphinscheduler-server/pom.xml | 6 +++++ dolphinscheduler-service/pom.xml | 6 +++++ dolphinscheduler-spi/pom.xml | 6 +++++ pom.xml | 27 ++++++++++++++----- 18 files changed, 130 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_ut.yml b/.github/workflows/ci_ut.yml index f7f6e1cf57..0246aaf80e 100644 --- a/.github/workflows/ci_ut.yml +++ b/.github/workflows/ci_ut.yml @@ -64,7 +64,7 @@ jobs: - name: Compile run: | export MAVEN_OPTS='-Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx5g' - mvn test -B -Dmaven.test.skip=false + mvn clean verify -B -Dmaven.test.skip=false - name: Upload coverage report to codecov run: | CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash) diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/pom.xml b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/pom.xml index 84b39b2d87..cb2d7fba13 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/pom.xml +++ b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/pom.xml @@ -68,6 +68,13 @@ jar test + + + org.jacoco + org.jacoco.agent + runtime + test + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml index 492a621da2..74dedf4e0f 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml +++ b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml @@ -118,6 +118,13 @@ + + + org.jacoco + org.jacoco.agent + runtime + test + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/pom.xml b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/pom.xml index 8155435764..ef47874c36 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/pom.xml +++ b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/pom.xml @@ -68,6 +68,13 @@ jar test + + + org.jacoco + org.jacoco.agent + runtime + test + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/pom.xml b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/pom.xml index aff9388182..83c4d41f7f 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/pom.xml +++ b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/pom.xml @@ -62,6 +62,13 @@ jar test + + + org.jacoco + org.jacoco.agent + runtime + test + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/pom.xml b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/pom.xml index 0088cc85fd..eb64e25787 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/pom.xml +++ b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/pom.xml @@ -64,6 +64,13 @@ jar test + + + org.jacoco + org.jacoco.agent + runtime + test + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/pom.xml b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/pom.xml index 5fe7f77680..3b1d8067e6 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/pom.xml +++ b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/pom.xml @@ -69,6 +69,13 @@ jar test + + + org.jacoco + org.jacoco.agent + runtime + test + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/pom.xml b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/pom.xml index 4b94f18077..fccf0e28da 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/pom.xml +++ b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/pom.xml @@ -64,6 +64,13 @@ test + + org.jacoco + org.jacoco.agent + runtime + test + + diff --git a/dolphinscheduler-alert/pom.xml b/dolphinscheduler-alert/pom.xml index 0007da1276..cf586c38d0 100644 --- a/dolphinscheduler-alert/pom.xml +++ b/dolphinscheduler-alert/pom.xml @@ -108,6 +108,13 @@ + + + org.jacoco + org.jacoco.agent + runtime + test + diff --git a/dolphinscheduler-api/pom.xml b/dolphinscheduler-api/pom.xml index e4db57ce43..67d7d090c7 100644 --- a/dolphinscheduler-api/pom.xml +++ b/dolphinscheduler-api/pom.xml @@ -247,5 +247,12 @@ + + org.jacoco + org.jacoco.agent + runtime + test + + diff --git a/dolphinscheduler-common/pom.xml b/dolphinscheduler-common/pom.xml index 6d55afe682..fe1ed3aac2 100644 --- a/dolphinscheduler-common/pom.xml +++ b/dolphinscheduler-common/pom.xml @@ -90,6 +90,13 @@ + + org.jacoco + org.jacoco.agent + runtime + test + + commons-configuration commons-configuration diff --git a/dolphinscheduler-dao/pom.xml b/dolphinscheduler-dao/pom.xml index f095a9ba54..2cf3de29ac 100644 --- a/dolphinscheduler-dao/pom.xml +++ b/dolphinscheduler-dao/pom.xml @@ -48,6 +48,12 @@ junit test + + org.jacoco + org.jacoco.agent + runtime + test + com.baomidou mybatis-plus diff --git a/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/pom.xml b/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/pom.xml index d632a04ccc..e2e158f20a 100644 --- a/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/pom.xml +++ b/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/pom.xml @@ -70,6 +70,13 @@ test + + org.jacoco + org.jacoco.agent + runtime + test + + diff --git a/dolphinscheduler-remote/pom.xml b/dolphinscheduler-remote/pom.xml index d1e9a7ffca..5f13a329e1 100644 --- a/dolphinscheduler-remote/pom.xml +++ b/dolphinscheduler-remote/pom.xml @@ -73,6 +73,13 @@ test + + org.jacoco + org.jacoco.agent + runtime + test + + com.google.guava guava diff --git a/dolphinscheduler-server/pom.xml b/dolphinscheduler-server/pom.xml index 4d762383fd..03544ad713 100644 --- a/dolphinscheduler-server/pom.xml +++ b/dolphinscheduler-server/pom.xml @@ -77,6 +77,12 @@ mockito-core test + + org.jacoco + org.jacoco.agent + runtime + test + org.springframework spring-test diff --git a/dolphinscheduler-service/pom.xml b/dolphinscheduler-service/pom.xml index 415ce53c05..84771399f2 100644 --- a/dolphinscheduler-service/pom.xml +++ b/dolphinscheduler-service/pom.xml @@ -94,5 +94,11 @@ mockito-core test + + org.jacoco + org.jacoco.agent + runtime + test + diff --git a/dolphinscheduler-spi/pom.xml b/dolphinscheduler-spi/pom.xml index 0893abe86a..c3f746c21e 100644 --- a/dolphinscheduler-spi/pom.xml +++ b/dolphinscheduler-spi/pom.xml @@ -57,6 +57,12 @@ junit test + + org.jacoco + org.jacoco.agent + runtime + test + com.google.guava guava diff --git a/pom.xml b/pom.xml index 482488fba2..37524d1977 100644 --- a/pom.xml +++ b/pom.xml @@ -409,6 +409,14 @@ + + org.jacoco + org.jacoco.agent + ${jacoco.version} + runtime + test + + mysql mysql-connector-java @@ -826,6 +834,9 @@ maven-surefire-plugin ${maven-surefire-plugin.version} + + ${project.build.directory}/jacoco.exec + **/plugin/registry/zookeeper/ZookeeperRegistryTest.java @@ -1092,19 +1103,23 @@ jacoco-maven-plugin ${jacoco.version} - target/jacoco.exec - target/jacoco.exec + ${project.build.directory}/jacoco.exec - jacoco-initialize + default-instrument + + instrument + + + + default-restore-instrumented-classes - prepare-agent + restore-instrumented-classes - jacoco-site - test + default-report report