You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enable Command Execution Across Containers/Network #103
At the moment, our support is limited to operations on a single machine. At this time, we do not have plans to introduce this feature. We will keep issue open to see interest.
Jakub Chocholowicz (@jakubch1) Is there an alternative approach how to retrieve the code coverage after I ran my test agast the running session integration-tests as hmiguel mentioned?
I thought is easily possible as described here, so I have the following:
Azure Pipeline:
Starting an app in a K8s pod by an ENTRYPOINT: dotnet-coverage collect --session-id my-tests-session -f xml -o coverage.xml dotnet App.dll
which runs fine.
Running tests from the pipeline (obviously from the Azure pipeline build agent and NOT within the same pod) by: dotnet test --logger "trx;LogFileName=App.Tests.trx" App.Tests.dll
Get the snapshot coverage after the tests are executed by: dotnet-coverage snapshot --output coverage-after-tests.xml my-tests-session
Copy that file coverage-after-tests.xml via kubectl cp from the pod to the pipeline and see the results.
=> empty coverage xml file.
I cannot do server shutdown and get the final coverage as well as hmiguel stated, since the pod/container gets terminated, and I cannot just copy then the coverage file to the outside, and retrieve it from the build agent, I mean I could but it would be non-trivial thing.
But in my case, the snapshot (which I thought is just the coverage of the app in time, after you performed something and the app is doing some stuff due to the test execution from step
Is that server shutdown needed? Should that snapshot not contain already the coverage I needed?
I just need the code coverage of the server/App side.
Again I followed this approach here, as you see. But I get an empty coverage result. What can be the reason for that?
Because I did that in the pipeline, and this coverage-after-tests.xmlis just an empty coverage xml file.
Would be great if you could support here.
P.S. The test results (App.Tests.trx) looks good, and works, that I get successfully from the dotnet test command, but I guess this has nothing to do with the coverage and is a different thing.
Your scenario looks good and should be supported. My guess is that k8s pod is missing some coverage dependencies or pdbs are not available. Could you please collect logs in step 1. ?
Yes, here are the logs from step 1 in Verbose mode. logs-app.txt
How can I check, if pdbs are not available? I do not have any special configuration like in the docs here.
UPDATE (issue solved):
Actually I fixed the issue by installing the missing dependency libxml2 on the Alpine Linux where the App is running.
Thanks to your supported-os documentation 😊.
Hi again,
Now, after we refactored the Dockerfile to contain again a USER instruction for security reasons, to be non-root.
The code-coverage snapshot returns with the error: "Invalid message tag."
What does that mean? Does it miss some privileges?
Thanks in advance.
Thanks for the response.
We fixed it again, sorry. It turned out, that the file could not be written, due to permission issues on the Docker container.
Activity
jakubch1 commentedon Feb 20, 2024
At the moment, our support is limited to operations on a single machine. At this time, we do not have plans to introduce this feature. We will keep issue open to see interest.
sahinM commentedon Jun 19, 2024
Jakub Chocholowicz (@jakubch1) Is there an alternative approach how to retrieve the code coverage after I ran my test agast the running session
integration-testsas hmiguel mentioned?I thought is easily possible as described here, so I have the following:
Azure Pipeline:
dotnet-coverage collect --session-id my-tests-session -f xml -o coverage.xml dotnet App.dllwhich runs fine.
dotnet test --logger "trx;LogFileName=App.Tests.trx" App.Tests.dlldotnet-coverage snapshot --output coverage-after-tests.xml my-tests-sessioncoverage-after-tests.xmlviakubectl cpfrom the pod to the pipeline and see the results.=> empty coverage xml file.
But in my case, the snapshot (which I thought is just the coverage of the app in time, after you performed something and the app is doing some stuff due to the test execution from step
Is that server shutdown needed? Should that snapshot not contain already the coverage I needed?
I just need the code coverage of the server/App side.
Again I followed this approach here, as you see. But I get an empty coverage result. What can be the reason for that?
Because I did that in the pipeline, and this
coverage-after-tests.xmlis just an empty coverage xml file.Would be great if you could support here.
P.S. The test results (
App.Tests.trx) looks good, and works, that I get successfully from the dotnet test command, but I guess this has nothing to do with the coverage and is a different thing.jakubch1 commentedon Jun 20, 2024
Your scenario looks good and should be supported. My guess is that k8s pod is missing some coverage dependencies or pdbs are not available. Could you please collect logs in step 1. ?
sahinM commentedon Jun 20, 2024
Yes, here are the logs from step 1 in Verbose mode.
logs-app.txt
How can I check, if pdbs are not available? I do not have any special configuration like in the docs here.
UPDATE (issue solved):
Actually I fixed the issue by installing the missing dependency
libxml2on the Alpine Linux where the App is running.Thanks to your supported-os documentation 😊.
sahinM commentedon Jun 21, 2024
Hi again,
Now, after we refactored the Dockerfile to contain again a USER instruction for security reasons, to be non-root.
The
code-coverage snapshotreturns with the error: "Invalid message tag."What does that mean? Does it miss some privileges?
Thanks in advance.
fhnaseer commentedon Jun 21, 2024
It seems like coverage file is corrupt. Can you please share what command lines you are executing? And the coverage file?
sahinM commentedon Jun 21, 2024
Thanks for the response.
We fixed it again, sorry. It turned out, that the file could not be written, due to permission issues on the Docker container.
carlos2martinize commentedon Oct 4, 2024
What is private system firewall defender App's for