Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HUDI-7596] Enable Jacoco code coverage report across multiple modules #11073

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

danny0405
Copy link
Contributor

Change Logs

Enable the Jacoco code coverage for Azure CI.

Impact

none

Risk level (write none, low medium or high below)

none

Documentation Update

none

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

@github-actions github-actions bot added the size:S PR with lines of changes in (10, 100] label Apr 23, 2024
@danny0405 danny0405 force-pushed the HUDI-7596 branch 2 times, most recently from e205ecd to ca7d93e Compare April 23, 2024 08:58
@github-actions github-actions bot added size:M PR with lines of changes in (100, 300] and removed size:S PR with lines of changes in (10, 100] labels Apr 23, 2024
@danny0405 danny0405 force-pushed the HUDI-7596 branch 3 times, most recently from acdbe5f to dda40c2 Compare April 24, 2024 00:49
@danny0405
Copy link
Contributor Author

@hudi-bot run azure

@github-actions github-actions bot added size:S PR with lines of changes in (10, 100] and removed size:M PR with lines of changes in (100, 300] labels Apr 24, 2024
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we try adding report-aggregate goal somewhere to report the coverage across modules? Right now it does not seem like the report is aggregated across modules.

                        <execution>
                            <id>report</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>report-aggregate</goal>
                            </goals>
                        </execution>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that and it reports nothing, probably because we use the v2 reportage plugin which is recommended, let me tweak and have a try again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it is very tricky to make the report-aggregate work, based on these links:

Basically if we wanna to make the aggrerator work, we should have a separate module named hudi-reporter that adds the correspendent denpendencies for the multiple moldules that we want to report, otherwise, we always got empty report files.

But some modules are actually dinamically loaded based on the active maven compile profile, which makes the issue even more complicated.

Copy link
Contributor Author

@danny0405 danny0405 Apr 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took several attempts like let each sub-module have a report-aggregate gole, but that still reports 0 coverage. So revert the code back to the non-aggregate version.

Based on this doc https://github.com/jacoco/jacoco/wiki/MavenMultiModule, we should choose the third strategy that create a delegate module with all the dependencies, and here is a demo project: https://github.com/jacoco/jacoco/tree/master/jacoco-maven-plugin.test/it/it-report-aggregate, I followed the instructions step by step but still got nothing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if the goal should be verify, i.e., mvn clean verify for report-aggregate to work. Have you tried the exact repo from https://github.com/jacoco/jacoco/blob/master/jacoco-maven-plugin.test/it/it-report-aggregate and see if it works locally with maven?

For the issue of dynamic loaded modules, maybe we can first try excluding such modules like hudi-spark and run for hudi-spark-client for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out to be that we must run the mvn test in the root dir of the project and we can not specify specific modules with -pl option. This is a limination for our Azure CI becase we split the modules into 6 separate job.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One idea is that we can aggregate the report for a particular module and run the mvn test from that module directory. If that works, we can run tests in different modules in a different way without -pl as a compromise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like I said, execute mvn test under module dir does not work.

@danny0405 danny0405 force-pushed the HUDI-7596 branch 2 times, most recently from bcd9ef9 to 37cf758 Compare April 25, 2024 03:25
@github-actions github-actions bot added size:L PR with lines of changes in (300, 1000] and removed size:S PR with lines of changes in (10, 100] labels Apr 25, 2024
@github-actions github-actions bot added size:S PR with lines of changes in (10, 100] and removed size:L PR with lines of changes in (300, 1000] labels Apr 25, 2024
@github-actions github-actions bot added size:L PR with lines of changes in (300, 1000] and removed size:S PR with lines of changes in (10, 100] labels Apr 25, 2024
@github-actions github-actions bot added size:S PR with lines of changes in (10, 100] and removed size:L PR with lines of changes in (300, 1000] labels Apr 25, 2024
@hudi-bot
Copy link

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@vinothchandar
Copy link
Member

I notice that the azure CI results are now grouped by folders? and could we show an example to illustrate that cross module FT coverage is now factored in?

Could we fix these before landing?

@danny0405
Copy link
Contributor Author

I notice that the azure CI results are now grouped by folders? and could we show an example to illustrate that cross module FT coverage is now factored in?

Could we fix these before landing?

In order to make the cross module FT coverage work, we need to:

  1. add a new separate module that including dependencies of all the modules that we want to report;
  2. run all the module tests in one shot and there is no way to run specific module with -pl option;

Our CI tests are split into 6 jobs with each covering different modules, which is not suitable for the jacoco report-aggregate goal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project-build size:S PR with lines of changes in (10, 100]
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

None yet

4 participants