Closed avkonst closed 2 years ago
Thanks, this is a good idea. And thanks for providing the working sample.
What's probably the best thing to do here is integrate this with the CI so that a new image is built each time a release is tagged. I'll need to do some investigation to make that happen.
I've started experimenting with this and I have it basically working, but the interaction is a bit weird.
If you provide the yaml on stdin it can work fine:
$ docker run -i gabbi:latest < /tmp/tests.yaml
... ✓ gabbi-runner.input_get
----------------------------------------------------------------------
Ran 1 test in 0.085s
OK
But if you are used to providing filenames on the arg list it can be a bit more complicated. Do you always use STDIN?
You need to mount the directory with test files. (Also suggest to add --rm
flag to let docker cleanup the containers when finished).
docker run -it --rm -v /tmp:/proj gabbi:latest -- /proj/tests.yaml
If your test files are in the current directory, it can be mounted to a working directory in the container:
docker run -it --rm -v ./:/wdir -w /wdir gabbi:latest -- tests.yaml
That's kind of what I assumed but it feels...clumsy.
I guess if it was scripted it would be no big deal. I'll keep playing with it. Should have something within a few days.
Be aware that deployment with docker is not for the purpose to replace native installation on a development host. It is for the purpose to automate CI tests and simplify trials of a tool without asking people to install python, etc... We use gitlab pipelines. Each job in the pipeline needs a container to run. If we use gabbi for a test job, it has to be an image with gabbi inside of it.
Just so you know, I haven't forgotten about this.
Great tool. I keep using it more and more. Currently I build my own docker image with gabbi-run. It would be great if there was an official gabbi-run image provided.
Here is the sample Dockerfile:
Here is how to build it: