There is 1 update, 1 comment.
 
 
XWiki Infrastructure / cid:jira-generated-image-avatar-145efba4-a782-4871-ae2a-422a27ce471b XINFRA-420 In Progress

Test coverage computed on Sonarcloud is not correct

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-dbca49ae-f0d8-430c-86b4-4cd6b48c90b7 Changes by Vincent Massol on 09/Sep/24 17:39
 
Description: The issue is that we execute the following for each GH repo:

{code}
        buildInternal(
          name: 'Quality',
          goals: 'clean install jacoco:report sonar:sonar',
          profiles: 'repository-snapshots,quality,legacy,coverage',
          properties: '-Dxwiki.jacoco.itDestFile=`pwd`/target/jacoco-it.exec'
        )
{code}

And this means that for each maven module, the goals "clean install jacoco:report sonar:sonar" are executed. This means that the coverage report for one module is generated BEFORE the following modules in the reactor have had a chance to contribute test results for the current module, leading to lower coverage than it should be.

To reproduce, go in xwiki-rendering (for ex), and run "mvn clean install jacoco:report -Dxwiki.jacoco.itDestFile=`pwd`/target/jacoco-it.exec -Plegacy,coverage -Dxwiki.revapi.skip=true", then open (for ex) xwiki-rendering-api/target/site/jacoco/index.html.

Then execute "mvn  jacoco:report -Dxwiki.jacoco.itDestFile=`pwd`/target/jacoco-it.exec -Plegacy,coverage -Dxwiki.revapi.skip=true" (this will regenerate the reports but from a full jacoco-it.exec file with all the module test executions in it). And reopen xwiki-rendering-api/target/site/jacoco/index.html, you'll see that the coverage is much larger (from 50+% to 80+%).

We either need to run 2 builds in our
CI pipeline (simple) or find a strategy to somehow use the jacoco:merge or jacoco:report-aggregate goals in a single reactor build. This will likely mean having a special module depending on all the other modules and gathering all the module sources to generate a full jacoco report.








 
 

1 comment

 
cid:jira-generated-image-avatar-dbca49ae-f0d8-430c-86b4-4cd6b48c90b7 Vincent Massol on 09/Sep/24 17:39
 

Testing the 2 step execution for the CI with https://github.com/xwiki/xwiki-rendering/commit/6ef338d3332fa9b2dbc4e7245587f0446152bedc