-
Notifications
You must be signed in to change notification settings - Fork 13
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
pymongo_inmemory doesn't work in docker container alpine #54
Comments
I tried to use the ubuntu:20.04 image and it worked as expected, but would be great if was possible to use the alpine since its lightweight |
Hi @trolliama, How do you set up the version in your docker image? The library itself doesn't do any compilation. It basically downloads a suitable version. See https://github.com/kaizendorks/pymongo_inmemory#available-mongodb-versions It looks like Apline linux is not supported by MongoDB itself. Probably then it's falling back to generic version. That being said, FileNotFound error looks fishy. I'll publisha fix recently merged to master. Maybe that would fix this problem too. |
Our test engine is configured by default to run tests in parallel. As I understand it, pymongo_inmemory downloads mongo on first access. If a test running in parallel with that first request attempts to access the database, it's no longer the first access, so rather than trying to download mongo, it attempts to run the query. But mongo isn't installed yet. Is there a way to pre-load mongo so that on first access, the query can just go ahead and run? |
Hey @sebastus this is a very interesting use case. To summarise what I understood
I am in the middle of refactoring how this download and running business works. I will try to incorporate that as well. But in the mean time I think there is a workaround. With #65 you should be able to point to a "local" That being said, I think there is still not a good way to provide that path. So that's something I should add to that refactor. |
Describe the bug
I am having troubles in running my tests inside my docker alpine container. I installed the pymongo_inmemory properly and started the tests and this was returned to me:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/src/venv/lib/python3.9/site-packages/pymongo_inmemory/downloader/../.cache/extract/mongodb-linux-x86_64-4.0.23-tgz/mongodb-linux-x86_64-4.0.23/bin/mongod'
I verified it and the mongod binary is there. So i tried to run the
subprocess.Popen
to justls
the folders and indeed the error appeared.With a little bit of research I've found that using the
shell=True
option in thePopen()
class like this:subprocess.Popen(["ls path/to/bin"], shell=True)
worked, but when I tried to run the mongod with this command it gave me this error:/bin/sh: /usr/src/venv/lib/python3.9/site-packages/pymongo_inmemory/downloader/../.cache/extract/mongodb-linux-x86_64-4.0.23-tgz/mongodb-linux-x86_64-4.0.23/bin/mongod: not found
Obs: In my machine works if I don't use the docker container
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It's expected that the tests pass
Screenshots
Context:
The text was updated successfully, but these errors were encountered: