tox-dev / tox-docker

A tox plugin to run one or more Docker containers during tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow to execute arbitrary commands in containers

d9pouces opened this issue · comments

Could you add a command parameter in the container configuration?

This command could just be passed to the docker.containers.run call.

What's your use case here? I suspect this is better handled by a Dockerfile rather than by adding complexity to tox-docker...

In fact, the goal is to avoid the overall complexity added by multiple Dockerfiles in the project structure and the need of building images (requiring a command outside tox) before running them with tox, just for one command.
But maybe you're right and I could process differently.

I'm also not sure how the lifetime of the command would interact the start of the test run. The command to run could be long-lived (or infinite), which would cause obvious problems.

If you really want to avoid custom images, you could probably do something with https://github.com/docker/docker-py directly from within your test suite, or hack something with a custom health check command; but these all feel really brittle and unobvious, IMO.