elastic / elastic-agent

Elastic Agent - single, unified way to add monitoring for logs, metrics, and other types of data to a host.
Other
110 stars 126 forks source link

Add coverage reporting to integration testing framework #4772

Open blakerouse opened 1 month ago

blakerouse commented 1 month ago

It is possible to build a golang binary with coverage reporting enabled [1]. That will allow the integration tests to run the actual elastic-agent binary and have it report its coverage report. The coverage report should then be copied back to the developer or CI machine.

This would really help provide true coverage of the Elastic Agent repository with both unit and integration tests.

[1] https://go.dev/doc/build-cover

elasticmachine commented 1 month ago

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

ycombinator commented 1 month ago

I believe if these reports land in the following folder/files, SonarQube should start picking them up and reporting more accurate stats for code that gets integration-tested but not unit-tested:

https://github.com/elastic/elastic-agent/blob/c5e9707328c49220b5aae41e58ce00ede3bff8f1/sonar-project.properties#L13

Related: https://go.dev/doc/build-cover#converting-to-legacy-text-format