elastic / elastic-agent

Elastic Agent - single, unified way to add monitoring for logs, metrics, and other types of data to a host.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add coverage reporting to integration testing framework

blakerouse opened this issue · comments

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

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

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:

sonar.go.coverage.reportPaths=**/build/TEST-*.cov

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