Unable to import coverage folder from docker

Hello, Community

  • Version: SonarQube 9.9 LTS Developer Edition
  • Scanner: SonarScanner for MSBuild 5.13
  • Tool: Dotcover for Unit Test
  • How is SonarQube deployed: Docker
  • What are you trying to achieve

Scenario:
The coverage is generated inside a docker and then copied to the root of the solution that we scanned. This is so that developers can generate their tests however they want as long as they leave them in a specific folder to be imported.
The problem is that the scan detects and parses all the contents of the coverage folder, but then it doesn’t import it to SonarQube.
However, if the coverage folder is generated on the same computer, it is imported correctly.

  • What have you tried so far to achieve this

I have tried to parse the contents of the docker generated coverage folder against the local generated folder but I didn’t see any differences except for the local time and the files that don’t have the same name but I doubt it’s because of that.

However when comparing the output of the sonar end I can see the following line is missing when the coverage folder comes from the docker.

INFO: Coverage Report Statistics: 89 files, 45 main files, 45 main files with coverage, 44 test files, 0 project excluded files, 0 other language files.

That is the only difference that I can notice in both, since the files in the folder are parsed correctly because in both output the same amount of files parsed:

INFO: Parsing the dotCover report /home/runner/work/xxxxxxxxxx/xxxxxxxxxx/./coverage/AppCoverageReport/src/2_68.html



INFO: Parsing the dotCover report /home/runner/work/xxxxxxxxxx/xxxxxxxxxx/./coverage/AppCoverageReport/src/3_68.html

There’s some kind of metadata that the scanner takes into account so it doesn’t import files from another computer?

Is there any way to solve it?

Thanks a lot

Hello

The Sonar Scanner will “index” the files that are to be pushed to SonarQube, using the local file system paths.

If you generate the coverage on a different machine, the file paths inside the coverage file might differ from the file paths which are “indexed” by the Sonar Scanner on the machine which does the build and analysis.

You can read this thread where they had a similar problem.

Our recommendation is to:

1 Like

Thank you so much Andrei :smiley:

This thread can be close now.

Thank you.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.