-
Notifications
You must be signed in to change notification settings - Fork 54
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
chore: add aggregate test coverage collection of gax within the showcase and gax modules #1430
Conversation
graalvm downstream check is resulting in |
gax-java/pom.xml
Outdated
@@ -222,6 +222,7 @@ | |||
<artifactId>maven-jar-plugin</artifactId> | |||
<executions> | |||
<execution> | |||
<phase>test</phase> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! This line helps resolve the compilation error we see when running mvn test
at the root. The PR description goes over this briefly but upon comparing the mvn test
with mvn install
, I noticed that the jar:test-jar
step which creates the testlib
JAR that gapic-generator-java depends on was being executed when mvn install
was called but after thesurefire:test
step. On the other hand, it was not being invoked at all when mvn test
was executed. This change forces the maven-jar-plugin of GAX to be executed at the test
phase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -95,8 +95,86 @@ | |||
</plugins> | |||
</build> | |||
</profile> | |||
|
|||
<profile> | |||
<id>test-coverage</id> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description does a great job clarifying how this is meant to be used, but that may get lost in obscurity once the PR is merged. Could you add some information in an appropriate .md
to explain the different expected workflows + report options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, done. I've added a README to the coverage-report
module.
pom.xml
Outdated
@@ -21,6 +21,8 @@ | |||
<module>java-common-protos</module> | |||
<module>java-iam</module> | |||
<module>gapic-generator-java-bom</module> | |||
<module>showcase</module> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding these two modules to the root pom here may have impact to our release, that they might be released automatically. @suztomo Do you have any concerns here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mpeddada1 To address the concern of accidental releases, can we define a profile so that the showcase module is part of the root project only when the profile is enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Done.
Awesome! Thank you. It works without the workaround:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you add a check in .github/workflows (either existing one or new file) to run the two commands for unit tests and integration tests.
coverage-report/README.md
Outdated
@@ -0,0 +1,16 @@ | |||
## Coverage Report | |||
|
|||
This module is meant to gather aggregate jacoco test coverage metrics across the `gax-java` and `showcase` modules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module is meant to gather aggregate jacoco test coverage metrics across the `gax-java` and `showcase` modules. | |
This module gathers aggregated jacoco test coverage metrics across the `gax-java` and `showcase` modules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thank you!
coverage-report/README.md
Outdated
In order to view aggregate unit test coverage of GAX in both `gax-java` and `showcase`: | ||
|
||
1. At the root of the repository, run `mvn clean test -DenableTestCoverage`. | ||
2. The metrics can be found at `${HOME}/gapic-generator-java/coverage-report/target/site/jacoco-aggregate/index.html` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the home directory is irrelevant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, starting with gapic-generator-java
should be sufficient.
Yup! I modified the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant a check to ensure “ -DenableTestCoverage” works fine. Does it exist already via SonarCloud?
[gapic-generator-java-root] Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
…ase and gax modules (#1430) * chore: add aggregate test coverage collection for showcase and gax
Coverage
In order to get test coverage of gax within the showcase and gax modules, a new module
coverage-report
needed to be created. The coverage module declares gapic-showcase (with a test scope), gax, gax-grpc, gax-httpjson as dependencies and relies onjacoco:report-aggregate
to collect aggregate metrics.Unit test coverage
Gathering just unit test metrics requires
mvn clean test -DenableTestCoverage
to be called.Integration test coverage
Gathering just integration test metrics requires
mvn clean verify -DskipUnitTests -DenableTestCoverage -Penable-integration-tests
to be called. TheDskipUnitTests
is needed skip the maven-surefire-plugin.