-
Notifications
You must be signed in to change notification settings - Fork 388
Running coverlet.msbuild inside docker with --no-build #1121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
hi @pankti11 sorry for the delay, very busy days, outside container does it work? |
Yes. but the only difference is the outside container I do a build. However, inside the container, I don't do-build. However, the bin folder (dlls are present from the build outside the container) is present in the container. So when I do dotnet test with --nobuild I expect it to generate the code coverage. Maybe I am missing something. |
Do you copy the source code into the docker container in addition to the binaries? Coverlet skips projects with PDBs but no local source files as a heuristic to filter out libraries that shouldn't be part of the coverage. (See https://github.com/coverlet-coverage/coverlet/blob/master/src/coverlet.core/Instrumentation/Instrumenter.cs#L88) |
It may also be an issue that the path name of the directory containing the code in the docker image is different to the path name outside it, which means that the source files cannot be found even if they are copied into the image. You can try to enable verbose logging (see https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/Troubleshooting.md) and see if it logs messages about not finding the source files. |
So inside the container there is source file as well as the binaries. From the logs I could decipher that the Build Task which is responsible to generate the CodeCoverage is never runs. Hence, I concluded that when I do dotnet test --no-build, dotnet is not aware of the coverlet because I did not run dotnet build. When I do dotnet build inside container and then do dotnet test --no-build then the coverage is created by coverlet without any issue. |
@petli We are running into similar issues. Actually we want to build and pack the binaries in one job and consume the nuget packages in multiple test jobs. Would be optimal if we wouldn't have to map the sources in the test job. Is that a requirement? Additionally we tried as a workaround to map the sources along with the test run, but even that doesn't work. The path to the sources is identically, but of course we didn't do a build in the test job. Is there some output expected relative to the sources which we need to transfer from our build job to the test jobs? (maybe some files in the obj folder? ) Can I somehow configure to instrument binaries with embedded pdbs, even if no sources for them are available? btw. we are using coverlet.collector |
This issue is stale because it has been open for 3 months with no activity. |
This issue was closed because it has been inactive for 9 months since being marked as stale. |
I am trying to run coverlet.msbuild with --no-build flag inside the docker container. And I am never able to generate the code coverage. I cannot run restore in the container. Hence, container does not have an access coverlet.msbuild nuget.
Logs:
Command:
dotnet test $startDir/$testPath/$testFile /p:CollectCoverage=true /p:CoverletOutputFormat=json /p:CoverletOutput=$outputFile /p:MergeWith=$mergeFile --verbosity diag --no-build
Expected Behaviour
The text was updated successfully, but these errors were encountered: