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

[full-ci] add docs for generating the coverage report and setting report coverage on sonarcloud #11081

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nirajacharya2
Copy link
Contributor

@nirajacharya2 nirajacharya2 commented Feb 28, 2025

Description

This PR adds docs for getting the coverage report form acceptance test and pushes the report to sonarcloud.
the coverage report will be viewable at https://sonarcloud.io/summary/new_code?id=owncloud-1_ocis_acceptance-tests after this pr is merged

output:

~/ocis$ go tool covdata percent -i=somedata

 github.com/owncloud/ocis/v2/ocis-pkg/account            coverage: 100.0% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/ast                coverage: 23.1% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/broker             coverage: 33.3% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/capabilities               coverage: 100.0% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/checks             coverage: 60.0% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/clihelper          coverage: 100.0% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/config             coverage: 88.5% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/config/configlog           coverage: 55.6% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/config/defaults            coverage: 54.5% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/config/envdecode           coverage: 42.4% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/config/parser              coverage: 86.2% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/conversions                coverage: 44.4% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/cors               coverage: 100.0% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/crypto             coverage: 58.2% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/generators         coverage: 77.8% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/handlers           coverage: 49.0% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/keycloak           coverage: 0.0% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/kql                coverage: 49.5% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/l10n               coverage: 17.0% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/ldap               coverage: 78.6% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/log                coverage: 65.8% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/middleware         coverage: 50.0% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/natsjsregistry             coverage: 65.2% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/oidc               coverage: 46.7% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/registry           coverage: 80.2% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/roles              coverage: 83.9% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/service/debug              coverage: 88.1% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/service/grpc               coverage: 62.2% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/service/grpc/handler/ratelimiter           coverage: 21.4% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/service/http               coverage: 86.4% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/shared             coverage: 47.4% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/structs            coverage: 100.0% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/sync               coverage: 35.7% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/tracing            coverage: 14.8% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/version            coverage: 72.7% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/x/io/fsx           coverage: 90.0% of statements
        github.com/owncloud/ocis/v2/ocis-pkg/x/path/filepathx           coverage: 100.0% of statements

or the webui view

image

Related Issue

Motivation and Context

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Copy link

update-docs bot commented Feb 28, 2025

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@nirajacharya2 nirajacharya2 force-pushed the code-coverage-from-acceptance-test branch 27 times, most recently from a90fdfc to c29e0ca Compare March 19, 2025 09:32
@nirajacharya2 nirajacharya2 force-pushed the code-coverage-from-acceptance-test branch 2 times, most recently from fd9023e to 670083f Compare April 2, 2025 06:43
@nirajacharya2 nirajacharya2 force-pushed the code-coverage-from-acceptance-test branch from 670083f to 9867d6c Compare April 2, 2025 10:37
@nirajacharya2 nirajacharya2 force-pushed the code-coverage-from-acceptance-test branch from 9867d6c to 0251257 Compare April 3, 2025 03:29
Copy link

sonarqubecloud bot commented Apr 3, 2025

@saw-jan
Copy link
Member

saw-jan commented Apr 3, 2025

Add information about how to generate, where the coverage will be, and how to access it if someone is interested.
Explaining these questions in the description would be helpful:

  1. What do you mean by coverage report?
  2. Coverage report based on which tests?
  3. How to generate the report?
  4. Where to access and view the report?

@nirajacharya2 nirajacharya2 force-pushed the code-coverage-from-acceptance-test branch from 0251257 to 499672a Compare April 4, 2025 09:41
@nirajacharya2 nirajacharya2 changed the title [full-ci][coverage] add docs for generating the coverage report and setting report coverage on sonarcloud [full-ci] add docs for generating the coverage report and setting report coverage on sonarcloud Apr 7, 2025
@nirajacharya2 nirajacharya2 force-pushed the code-coverage-from-acceptance-test branch 2 times, most recently from 7146acc to c846209 Compare April 7, 2025 07:40
@nirajacharya2 nirajacharya2 force-pushed the code-coverage-from-acceptance-test branch from c846209 to d5f2d4a Compare April 8, 2025 04:09
Comment on lines +40 to +46
# Ignore "Define a constant instead of duplicating this literal" rule for tests
sonar.issue.ignore.multicriteria.g1.ruleKey=go:S1192
sonar.issue.ignore.multicriteria.g1.resourceKey=**/*_test.go

# Ignore "Rename function XXX to match the regular expression ^(_|[a-zA-Z0-9]+)$" rule for tests
sonar.issue.ignore.multicriteria.g2.ruleKey=go:S100
sonar.issue.ignore.multicriteria.g2.resourceKey=**/*_test.go
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose that we need to ignore "code quality" errors because this Sonar run is only for gathering code coverage.
The "regular" Sonar run that goes with unit tests be the one that we care about for "code quality" feedback.

@nirajacharya2 nirajacharya2 force-pushed the code-coverage-from-acceptance-test branch from d5f2d4a to 732dd01 Compare April 9, 2025 11:01
Copy link

sonarqubecloud bot commented Apr 9, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants