NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.89k stars 13.95k forks source link

Running heavy tests that want servers in checkPhase #57250

Open deliciouslytyped opened 5 years ago

deliciouslytyped commented 5 years ago

I'm currently working on packaging Cuckoo Sandbox and making a module for it ( https://github.com/NixOS/nixpkgs/issues/56975 ). It has an extensive test suite that's run by PyTest during checkPhase, part of which involves accessing some SQL databases, which can be seen being set up in https://github.com/cuckoosandbox/cuckoo/blob/c41c7c5cb09416b7cfc6159811792679e20762f2/.travis.yml

People have suggested to me to try using containers and things such as runc, but I haven't been able to find any existing examples. I'm probably looking for the wrong thing. I presume there might be issues with running in the nix sandbox.

Are there any recommended ways of implementing something like this?

infinisil commented 5 years ago

What might work is to look at what the mysql NixOS service does, and to replicate that in the Nix build. The only potential problem I see is that mysql might want to run as root.

deliciouslytyped commented 5 years ago

Well, for starters, for the PostgreSQL stuff I ended up just running the server normally, incidentally using ephemeralpg.

Edit: on a quick peek, mysql does something similar. I imagine the thought of immediately reaching for containers came up because the servers needed weren't the software under test.

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.