Skip to content

Commit 98192be

Browse files
cleanup: some minor changes to the testing/jacoco config (#3822)
* cleanup: some minor changes to the testing/jacoco config * Ln/minor and common cov tweaks (#3823) * Add jacoco to common * Add common to reporting * Update java-build-push-test.yaml * Update java-build-push-test.yaml * Update test_backend.sh * Update pom.xml * Update pom.xml * Update .github/workflows/java-build-push-test.yaml * more config adjustments * chore: test jacoco includes (#3824) * chore: test jacoco includes * Update backend/common/pom.xml * Update pom.xml * Update pom.xml * Update pom.xml * couple last minor tweaks --------- Co-authored-by: Liam Newman <[email protected]>
1 parent ecf1981 commit 98192be

File tree

10 files changed

+103
-98
lines changed

10 files changed

+103
-98
lines changed

.github/workflows/java-build-push-test.yaml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,25 +127,42 @@ jobs:
127127
run: JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 ./test_backend.sh
128128

129129
- name: Upload Report
130-
uses: 'actions/upload-artifact@v2'
130+
uses: 'actions/upload-artifact@v3'
131131
with:
132-
name: report.xml
133-
path: ${{ github.workspace }}/backend/server/target/site/jacoco/jacoco.xml
132+
name: jacoco-reports
133+
path: |
134+
${{ github.workspace }}/backend/common/target/site/jacoco/jacoco.xml
135+
${{ github.workspace }}/backend/server/target/site/jacoco/jacoco.xml
134136
135-
- name: Jacoco Report to PR
136-
id: jacoco
137+
- name: Jacoco Report Common to PR
138+
id: jacoco-common
139+
uses: madrapps/[email protected]
140+
with:
141+
paths: ${{ github.workspace }}/backend/common/target/site/jacoco/jacoco.xml
142+
token: ${{ secrets.GITHUB_TOKEN }}
143+
min-coverage-overall: 10
144+
min-coverage-changed-files: 70
145+
debug-mode: false
146+
title: Common Code Coverage
147+
148+
- name: Jacoco Report Server to PR
149+
id: jacoco-server
137150
uses: madrapps/[email protected]
138151
with:
139152
paths: ${{ github.workspace }}/backend/server/target/site/jacoco/jacoco.xml
140153
token: ${{ secrets.GITHUB_TOKEN }}
141-
min-coverage-overall: 35
154+
min-coverage-overall: 34
142155
min-coverage-changed-files: 70
143156
debug-mode: false
157+
title: Backend Code Coverage
144158

145159
- name: Get the Coverage info
146160
run: |
147-
echo "Total coverage ${{ steps.jacoco.outputs.coverage-overall }}"
148-
echo "Changed Files coverage ${{ steps.jacoco.outputs.coverage-changed-files }}"
161+
echo "Total coverage (common): ${{ steps.jacoco-common.outputs.coverage-overall }}"
162+
echo "Changed Files coverage (common): coverage ${{ steps.jacoco-common.outputs.coverage-changed-files }}"
163+
echo "Total coverage (server): ${{ steps.jacoco-server.outputs.coverage-overall }}"
164+
echo "Changed Files coverage (server): ${{ steps.jacoco-server.outputs.coverage-changed-files }}"
165+
149166
150167
- name: Comment Docker tag
151168
if: "(github.event_name == 'pull_request' && github.event.pull_request)"

backend/common/pom.xml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,66 @@
265265
<groupId>org.apache.maven.plugins</groupId>
266266
<artifactId>maven-compiler-plugin</artifactId>
267267
</plugin>
268+
<plugin>
269+
<groupId>org.apache.maven.plugins</groupId>
270+
<artifactId>maven-surefire-plugin</artifactId>
271+
<version>3.1.0</version>
272+
<configuration>
273+
<!-- Sets the VM argument line used when unit tests are run. -->
274+
<argLine>${surefireArgLine}</argLine>
275+
</configuration>
276+
</plugin>
277+
<plugin>
278+
<!-- Use for generating code coverage report using jacoco plugin -->
279+
<groupId>org.jacoco</groupId>
280+
<artifactId>jacoco-maven-plugin</artifactId>
281+
<executions>
282+
<!-- Prepares the property pointing to the JaCoCo runtime agent which
283+
is passed as VM argument when Maven the Surefire plugin is executed. -->
284+
<execution>
285+
<id>pre-unit-test</id>
286+
<goals>
287+
<goal>prepare-agent</goal>
288+
</goals>
289+
<configuration>
290+
<!-- Sets the name of the property containing the settings for JaCoCo
291+
runtime agent. -->
292+
<propertyName>surefireArgLine</propertyName>
293+
<includes>
294+
<include>ai/verta/modeldb/common/**</include>
295+
</includes>
296+
</configuration>
297+
</execution>
298+
<execution>
299+
<id>post-unit-test</id>
300+
<phase>test</phase>
301+
<goals>
302+
<goal>report</goal>
303+
</goals>
304+
<configuration>
305+
<!-- Sets the path to the file which contains the execution data. -->
306+
<dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
307+
<!-- Sets the output directory for the code coverage report. -->
308+
<outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
309+
<includes>
310+
<include>ai/verta/modeldb/common/**</include>
311+
</includes>
312+
</configuration>
313+
</execution>
314+
<execution>
315+
<id>report</id>
316+
<phase>verify</phase>
317+
<goals>
318+
<goal>report</goal>
319+
</goals>
320+
<configuration>
321+
<includes>
322+
<include>ai/verta/modeldb/common/**</include>
323+
</includes>
324+
</configuration>
325+
</execution>
326+
</executions>
327+
</plugin>
268328
</plugins>
269329
</build>
270330
</project>

backend/common/src/main/java/ai/verta/modeldb/common/CommonDBUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ protected static Connection getDBConnection(RdbConfig rdb) throws SQLException {
5454
}
5555

5656
protected static boolean checkDBConnection(RdbConfig rdb, Integer timeout) {
57-
LOGGER.info("Checking DB connection with timeout [{}]...", timeout);
57+
LOGGER.debug("Checking DB connection with timeout [{}]...", timeout);
5858
try (var con = getDBConnection(rdb)) {
5959
LOGGER.debug("Got connection: {}", con);
6060
boolean valid = con.isValid(timeout);
61-
LOGGER.info("DB Connection valid? : {}", valid);
61+
LOGGER.debug("DB Connection valid? : {}", valid);
6262
return valid;
6363
} catch (Exception ex) {
6464
LOGGER.error("JdbiUtil checkDBConnection() got error ", ex);

backend/server/pom.xml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,6 @@
282282
<artifactId>maven-surefire-plugin</artifactId>
283283
<version>3.1.0</version>
284284
<configuration>
285-
<includes>
286-
<include>**/TestSequenceSuite.java</include>
287-
</includes>
288285
<!-- Sets the VM argument line used when unit tests are run. -->
289286
<argLine>${surefireArgLine}</argLine>
290287
</configuration>
@@ -295,14 +292,6 @@
295292
<artifactId>jacoco-maven-plugin</artifactId>
296293
<configuration>
297294
<append>true</append>
298-
<excludes>
299-
<exclude>/ai/verta/uac/**</exclude>
300-
<exclude>/ai/verta/common/**</exclude>
301-
<exclude>/ai/verta/events/**</exclude>
302-
<exclude>/ai/verta/deployment/**</exclude>
303-
<exclude>/ai/verta/client/**</exclude>
304-
<exclude>/ai/verta/artifactstore/**</exclude>
305-
</excludes>
306295
</configuration>
307296
<executions>
308297
<!-- Prepares the property pointing to the JaCoCo runtime agent which
@@ -318,6 +307,9 @@
318307
<!-- Sets the name of the property containing the settings for JaCoCo
319308
runtime agent. -->
320309
<propertyName>surefireArgLine</propertyName>
310+
<includes>
311+
<include>ai/verta/modeldb/**</include>
312+
</includes>
321313
</configuration>
322314
</execution>
323315
<!-- Ensures that the code coverage report for unit tests is created
@@ -333,6 +325,9 @@
333325
<dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
334326
<!-- Sets the output directory for the code coverage report. -->
335327
<outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
328+
<includes>
329+
<include>ai/verta/modeldb/**</include>
330+
</includes>
336331
</configuration>
337332
</execution>
338333
<execution>
@@ -344,6 +339,12 @@
344339
<configuration>
345340
<!-- Sets the path to the file which contains the execution data. -->
346341
<dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
342+
<includes>
343+
<include>ai/verta/modeldb/**</include>
344+
</includes>
345+
<excludes>
346+
<exclude>ai/verta/modeldb/versioning/autogenerated/**</exclude>
347+
</excludes>
347348
</configuration>
348349
</execution>
349350
</executions>

backend/server/src/main/java/ai/verta/modeldb/utils/CommonHibernateUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public SessionFactory createOrGetSessionFactory(DatabaseConfig config) throws Mo
100100
metaDataSrc.addAnnotatedClass(entity);
101101
}
102102

103-
LOGGER.info("Checking DB Connection");
103+
LOGGER.debug("Checking DB Connection");
104104
boolean dbConnectionStatus = checkDBConnection(rdb, config.getTimeout());
105105
if (!dbConnectionStatus) {
106106
checkDBConnectionInLoop(config, true);

backend/server/src/test/java/ai/verta/modeldb/PublicTestSequenceSuite.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

backend/server/src/test/java/ai/verta/modeldb/PullRequestSuite.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
import org.junit.platform.suite.api.Suite;
66

77
@Suite
8-
@ExcludeClassNamePatterns({
9-
"ai.verta.modeldb.metadata.MetadataTest",
10-
".*TestSequenceSuite",
11-
})
8+
@ExcludeClassNamePatterns({"ai.verta.modeldb.metadata.MetadataTest"})
129
@SelectPackages({"ai.verta.modeldb"})
1310
public class PullRequestSuite {}

backend/server/src/test/java/ai/verta/modeldb/TestSequenceSuite.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

integration_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ export RUN_LIQUIBASE_SEPARATE=false
44
export LOG4J_FORMAT_MSG_NO_LOOKUPS=true
55
export VERTA_MODELDB_TEST_CONFIG=itconfig/config-test-h2.yaml
66
#mvn -B verify -Dtest=PullRequestSuite -Dmaven.compiler.useIncrementalCompilation=false -Dsurefire.rerunFailingTestsCount=2
7-
mvn -B verify -Dtest=PullRequestSuite -Dsurefire.rerunFailingTestsCount=2
7+
mvn -B verify -Dtest=PullRequestSuite -Dsurefire.rerunFailingTestsCount=2 jacoco:report

test_backend.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
set -eo pipefail
44

5-
mvn -Dtest=PullRequestSuite -Dsurefire.rerunFailingTestsCount=2 -B verify jacoco:report
5+
mvn -Dtest=PullRequestSuite -Dsurefire.rerunFailingTestsCount=2 -B verify

0 commit comments

Comments
 (0)