Must-share information (formatted with Markdown):
-
which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
Sonarqube version: 9.3
INFO: Scanner configuration file: /opt/homebrew/Cellar/sonar-scanner/5.0.1.3006/libexec/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 5.0.1.3006
INFO: Java 21.0.1 Homebrew (64-bit)
INFO: Mac OS X 13.4 aarch64 -
how is SonarQube deployed: zip, Docker, Helm
Deployed via Docker -
what are you trying to achieve
Want the integration test coverage data to be reported and shown in sonarqube dashboard. The project is based on Golang. -
what have you tried so far to achieve this
We have followed golang doc: Coverage profiling support for integration tests - The Go Programming Language to instrument the build and ran integration tests against it to get the coverage data. Also, we are able to run the sonar scanner in our codebase which runs fine. However, we could not find any relevant flag(s) for us to upload the coverage data on to the sonarqube server. We have found only two flags in the sonar documentation:
sonar.go.coverage.reportPaths
sonar.go.tests.reportPaths
and we have passed the flag as:
-Dsonar.sonar.go.coverage.reportPaths=<path to the merged coverage binaries directory>
However, we found this in the scanner logs:
ERROR: Test report can't be loaded, file not found: '/Users/sporel/monitoring-app/./report.json', ignoring this file.
ERROR: Coverage report can't be loaded, report file not found, ignoring this file ./coverage.out.
Upon further exploration, both of the errors look related to the unit test code coverage.
We want to know the correct way to pass the integration test code coverage data to sonar server to be shown in the dashboard for Golang.
Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!