Skip to content

Ability to run Code Coverage locally with Gradle #18509

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

Merged
merged 3 commits into from
Jun 13, 2025

Conversation

prudhvigodithi
Copy link
Member

Description

  • Ability to run code coverage locally.
  • Run code coverage for integrationTest, test and javaRestTest (coming from this Fips smoke test #18376 looks like javaRestTest is not added)
  • Run for specific Gradle module.
  • Run for specific test class and method.

Related Issues

While I'm working on this PR #18358, I noticed that GitHub reports code coverage only after the Gradle Check workflow passes. Being able to run coverage reports locally using Gradle can help test and improve coverage earlier in the development cycle. Although IntelliJ provides some insights, using Gradle with the JaCoCo plugin ensures consistency with the coverage reported by GitHub.

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Prudhvi Godithi <[email protected]>
@prudhvigodithi prudhvigodithi requested a review from a team as a code owner June 12, 2025 21:23
@prudhvigodithi
Copy link
Member Author

Adding @andrross @reta @cwperks @getsaurabh02

@cwperks
Copy link
Member

cwperks commented Jun 12, 2025

Run code coverage for integrationTest, test and javaRestTest (coming from this #18376 looks like javaRestTest is not added)

🙌 Thank you Prudvhi! CC: @beanuwave

@prudhvigodithi
Copy link
Member Author

Coming from https://github.com/opensearch-project/opensearch-build/blob/main/jenkins/gradle/gradle-check.jenkinsfile#L154 I'm also testing locally to see if ./gradlew check -Dtests.coverage=true continue to give the consolidated reports including javaRestTest.

@cwperks
Copy link
Member

cwperks commented Jun 12, 2025

Can we add a CHANGELOG entry? Even if this is a developer centric PR I think its worth noting in the release notes that jacoco reports can now be produced locally.

@prudhvigodithi
Copy link
Member Author

Can we add a CHANGELOG entry? Even if this is a developer centric PR I think its worth noting in the release notes that jacoco reports can now be produced locally.

Sure let me do that

Copy link
Contributor

❌ Gradle check result for 22bc43d: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 22bc43d: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@prudhvigodithi prudhvigodithi changed the title Optimize Local Code Coverage Execution with Gradle Ability to run Code Coverage locally with Gradle Jun 13, 2025
Signed-off-by: Prudhvi Godithi <[email protected]>
Copy link
Contributor

❌ Gradle check result for 1903747: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 1903747: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: Prudhvi Godithi <[email protected]>
Copy link
Contributor

❌ Gradle check result for 3b58396: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 3b58396: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

✅ Gradle check result for 3b58396: SUCCESS

Copy link

codecov bot commented Jun 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.80%. Comparing base (3078649) to head (3b58396).
Report is 16 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #18509      +/-   ##
============================================
+ Coverage     72.64%   72.80%   +0.16%     
- Complexity    68070    68171     +101     
============================================
  Files          5537     5537              
  Lines        313404   313404              
  Branches      45476    45476              
============================================
+ Hits         227658   228165     +507     
+ Misses        67241    66728     -513     
- Partials      18505    18511       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Performance Roadmap Jun 13, 2025
@cwperks cwperks merged commit bc3778a into opensearch-project:main Jun 13, 2025
32 of 36 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Performance Roadmap Jun 13, 2025
@github-project-automation github-project-automation bot moved this from 👀 In Review to ✅ Done in Engineering Effectiveness Board Jun 13, 2025
@prudhvigodithi
Copy link
Member Author

Coming from https://app.codecov.io/gh/opensearch-project/OpenSearch/tree/main/qa%2Fdie-with-dignity%2Fsrc%2Fmain%2Fjava%2Forg%2Fopensearch I can no see some coverage of yamlRestTest for :qa:die-with-dignity. CC @cwperks

abhita pushed a commit to abhita/OpenSearch that referenced this pull request Jun 17, 2025
…18509)

* Project Code Coverage

Signed-off-by: Prudhvi Godithi <[email protected]>

* Project Code Coverage

Signed-off-by: Prudhvi Godithi <[email protected]>

* Update gradle logic

Signed-off-by: Prudhvi Godithi <[email protected]>

---------

Signed-off-by: Prudhvi Godithi <[email protected]>
neuenfeldttj pushed a commit to neuenfeldttj/OpenSearch that referenced this pull request Jun 26, 2025
…18509)

* Project Code Coverage

Signed-off-by: Prudhvi Godithi <[email protected]>

* Project Code Coverage

Signed-off-by: Prudhvi Godithi <[email protected]>

* Update gradle logic

Signed-off-by: Prudhvi Godithi <[email protected]>

---------

Signed-off-by: Prudhvi Godithi <[email protected]>Signed-off-by: TJ Neuenfeldt <[email protected]>
neuenfeldttj pushed a commit to neuenfeldttj/OpenSearch that referenced this pull request Jun 26, 2025
…18509)

* Project Code Coverage

Signed-off-by: Prudhvi Godithi <[email protected]>

* Project Code Coverage

Signed-off-by: Prudhvi Godithi <[email protected]>

* Update gradle logic

Signed-off-by: Prudhvi Godithi <[email protected]>

---------

Signed-off-by: Prudhvi Godithi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Done
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants