Skip to content

Conversation

pchila
Copy link
Member

@pchila pchila commented Sep 12, 2025

What does this PR do?

Add -coverpkg parameter to collect coverage data for any package under elastic-agent module.

Why is it important?

This allows for more correct coverage calculation when some code is tested via a test located in a different package.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added an entry in ./changelog/fragments using the changelog tool
  • [ ] I have added an integration test or an E2E test

Disruptive User Impact

How to test this PR locally

Related issues

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

@pchila pchila self-assigned this Sep 12, 2025
@pchila pchila requested a review from a team as a code owner September 12, 2025 12:40
@pchila pchila added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team chore Tasks that just need to be done, they are neither bug, nor enhancements backport-active-all Automated backport with mergify to all the active branches labels Sep 12, 2025
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @pchila

Copy link
Contributor

@pkoutsovasilis pkoutsovasilis left a comment

Choose a reason for hiding this comment

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

Ok I am surprised why we haven't observed until now (you did and thank you @pchila ) that the code under coverage is off, but I totally understand what coverpkg and I do believe we need it to be ./... so LGTM

@pchila pchila merged commit 7c3157b into elastic:main Sep 12, 2025
25 of 32 checks passed
Copy link
Contributor

@Mergifyio backport 8.18 8.19 9.0 9.1

Copy link
Contributor

mergify bot commented Sep 12, 2025

@pchila
Copy link
Member Author

pchila commented Sep 12, 2025

Ok I am surprised why we haven't observed until now (you did and thank you @pchila ) that the code under coverage is off, but I totally understand what coverpkg and I do believe we need it to be ./... so LGTM

@pkoutsovasilis
I realized that we were missing coverage when looking at results for #8767 that introduces some unit tests in internal/pkg/agent/cmd/watch_test.go that use code in internal/pkg/agent/application/upgrade package but the sonarqube analysis reported that the called function in upgrade package were not covered. It's a pretty specific situation but with the dependencies among different packages in elastic-agent I think it's not so unique.

pchila added a commit that referenced this pull request Sep 13, 2025
…oss packages (#9913) (#9915)

(cherry picked from commit 7c3157b)

Co-authored-by: Paolo Chilà <[email protected]>
pchila added a commit that referenced this pull request Sep 13, 2025
…oss packages (#9913) (#9916)

(cherry picked from commit 7c3157b)

Co-authored-by: Paolo Chilà <[email protected]>
pchila added a commit that referenced this pull request Sep 13, 2025
…oss packages (#9913) (#9917)

(cherry picked from commit 7c3157b)

Co-authored-by: Paolo Chilà <[email protected]>
pchila added a commit that referenced this pull request Sep 13, 2025
…oss packages (#9913) (#9914)

(cherry picked from commit 7c3157b)

Co-authored-by: Paolo Chilà <[email protected]>
v1v added a commit that referenced this pull request Sep 16, 2025
* upstream: (26 commits)
  fix: ensure EDOT subprocess shuts down gracefully on agent termination (#9886)
  [main][Automation] Update versions (#9976)
  Add Collector reference docs and automation (#9953)
  [beatreceivers] Integrate beatsauthextension (#9257)
  [main][Automation] Update versions (#9941)
  Update OTel components to v0.132.0/v1.38.0 (#9954)
  Enhancement/5235 wrap errors when marking upgrade (#9366)
  Mount Go build cache into crossbuild container (#9094)
  Liveness agent state (#9673)
  [main][Automation] Bump VM Image version to 1757725254 (#9942)
  Enhancement/5235 correctly wrap errors from copyActionDir and copyRunDirectory (#9349)
  [main][Automation] Update elastic/beats to afc53c0479ac (#9874)
  Add -coverpkg option when running unit test to calculate coverage across packages (#9913)
  Cache binaries downloaded for packaging locally (#9133)
  [main][Automation] Update versions (#9897)
  Disable flaky test TestBeatsReceiverLogs (#9891)
  Allow overriding AGENT_PACKAGE_VERSION and MANIFEST_URL when USE_PACKAGE_VERSION=true (#9864)
  add ingest-docs team as CODEOWNERS for release notes and docset.yml (#9865)
  fix: correct spelling of 'output' in various templates and monitoring code (#9827)
  k8s: Add comment around hostUsers for Universal Profiling deployments (#9847)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-active-all Automated backport with mergify to all the active branches chore Tasks that just need to be done, they are neither bug, nor enhancements skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants