Skip to content
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

Enable Command Execution Across Containers/Network #103

Open
hmiguel opened this issue Feb 19, 2024 · 8 comments
Open

Enable Command Execution Across Containers/Network #103

hmiguel opened this issue Feb 19, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@hmiguel
Copy link

hmiguel commented Feb 19, 2024

Hi!

This is probably an enhancement request, but my current issue is:

Consider a CI/CD pipeline @integration-tests stage.

container-a:
-./dotnet-coverage collect "Service.Api" --session-id integration-tests

container-b:
-dotnet tests IntegrationTests ... (against container A)
-dotnet-coverage shutdown integration-tests (unable to do it)

I want to be able to execute a gracefull shutdown (or snapshot) of container-a via container-b. How to do it?

A possible enhancement could involve setting something like --address container-a-hostname

Thanks in advance

@jakubch1 jakubch1 added the enhancement New feature or request label Feb 20, 2024
@jakubch1
Copy link
Member

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
Copy link
Contributor

sahinM commented Jun 19, 2024

@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:

  1. 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.
  2. 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
  3. Get the snapshot coverage after the tests are executed by:
    dotnet-coverage snapshot --output coverage-after-tests.xml my-tests-session
  4. Copy that file coverage-after-tests.xml via kubectl cp from the pod to the pipeline and see the results.
    => empty coverage xml file.
  5. 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.

@jakubch1
Copy link
Member

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
Copy link
Contributor

sahinM commented 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 libxml2 on the Alpine Linux where the App is running.
Thanks to your supported-os documentation 😊.

@sahinM
Copy link
Contributor

sahinM commented 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 snapshot returns with the error: "Invalid message tag."
What does that mean? Does it miss some privileges?
Thanks in advance.

@fhnaseer
Copy link
Member

It seems like coverage file is corrupt. Can you please share what command lines you are executing? And the coverage file?

@sahinM
Copy link
Contributor

sahinM commented 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
Copy link

What is private system firewall defender App's for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants