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

[1.x] Add support to generate code coverage report with JaCoCo #1236

Merged
merged 1 commit into from
Sep 20, 2021

Conversation

tlfeng
Copy link
Collaborator

@tlfeng tlfeng commented Sep 13, 2021

Description

Backport #971 and #1214 to 1.x branch

  • Apply JaCoCo Gradle plugin to the root project, and to all the sub-projects through BuildPlugin.
  • Add 3 Gradle tasks: codeCoverageReport, codeCoverageReportForUnitTest, codeCoverageReportForIntegrationTest to generate code coverage report for all the tests, unit tests, and integration tests correspondingly.
  • Attach Gradle codeCoverageReport task to check task.
  • Remove outdated code of giving JaCoCo files permission when Java security manager enabled

Usage of the new Gradle tasks:

  • Generate code coverage report after check task: run ./gradlew check -Dtests.coverage=true
  • Generate code coverage report
    for all the test: ./gradlew codeCoverageReport,
    for unit tests only: ./gradlew codeCoverageReportForUnitTest,
    for integration tests only: ./gradlew codeCoverageReportForIntegrationTest
  • The report will be in XML format only by default,
    to generate report in HTML format, add parameter -Dtests.coverage.report.html=true, for example ./gradlew codeCoverageReport -Dtests.coverage.report.html=true,
    to generate report in CSV format, add parameter -Dtests.coverage.report.csv=true,
    not generate report in XML format, add parameter -Dtests.coverage.report.xml=false,

Issues Resolved

#850

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

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.

@tlfeng tlfeng added enhancement Enhancement or improvement to existing feature or request CI CI related Build Libraries & Interfaces backport PRs or issues specific to backporting features or enhancments labels Sep 13, 2021
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success dbc23db

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed dbc23db

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success dbc23db

@tlfeng tlfeng changed the title (target on v1.2) [1.x] Add support to generate code coverage report with JaCoCo [1.x] Add support to generate code coverage report with JaCoCo Sep 14, 2021
@tlfeng tlfeng marked this pull request as ready for review September 14, 2021 16:46
@tlfeng
Copy link
Collaborator Author

tlfeng commented Sep 14, 2021

start gradle check

@tlfeng tlfeng added the v1.2.0 Issues related to version 1.2.0 label Sep 14, 2021
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success dbc23db
Log 522

Reports 522

Copy link
Member

@saratvemulapalli saratvemulapalli left a comment

Choose a reason for hiding this comment

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

Thanks @tlfeng for the change!

@tlfeng
Copy link
Collaborator Author

tlfeng commented Sep 17, 2021

Thanks @tlfeng for the change!

Thanks for your review of this PR and the previous one! 👍

@tlfeng tlfeng merged commit 7135eaf into opensearch-project:1.x Sep 20, 2021
@tlfeng tlfeng deleted the 1.x-jacoco-test branch September 20, 2021 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport PRs or issues specific to backporting features or enhancments Build Libraries & Interfaces CI CI related enhancement Enhancement or improvement to existing feature or request v1.2.0 Issues related to version 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants