pytest-docker-db icon indicating copy to clipboard operation
pytest-docker-db copied to clipboard

Support for Multiple Containers

Open zacharymostowsky opened this issue 4 years ago • 4 comments

Hi, thanks for this library. Looks super useful for me. My api relies on two db (postgres and neo4j). Do you plan to support multiple db creation? I will take a look at the source and see if it is something I could assist with.

Thanks, Zach

zacharymostowsky avatar Apr 13 '21 02:04 zacharymostowsky

I admittedly did not think about supporting multiple DBs but I can totally understand the use case. I would be open to a PR supporting it but I will also take a look at implementing it myself.

I wonder if simply supporting docker-compose files would achieve this same goal? That would cover even more possible use cases.

kprestel avatar Apr 16 '21 12:04 kprestel

Thanks for getting back. I will take a look this week to see if something I can help with. I like the docker compose idea. Can essentially use that as the config file. I was also thinking being able to run docker in docker may be a potential use case for myself and others but I know there are all sorts of headaches that come with that.

zacharymostowsky avatar Apr 16 '21 19:04 zacharymostowsky

I am all for running docker inside docker but as you know it comes with headaches at times. I am not interested in supporting all possible edge cases/issues that come with running docker inside docker but will do whatever I can to allow/support it.

After a quick search, it seems like there is not a python API for docker-compose but we can use subprocess module to support it.

It is slightly less elegant but I would imagine that most people would prefer to simply use their docker-compose file to stand up whatever they need for testing.

Supporting multiple containers via pytest config also seems like a viable option but I don't think they are mutually exclusive.

kprestel avatar Apr 18 '21 14:04 kprestel