pytest-testinfra icon indicating copy to clipboard operation
pytest-testinfra copied to clipboard

docker-image backend

Open philpep opened this issue 5 years ago • 2 comments

I wonder if that would be useful to add a "docker-image" backend.

This backend would test images instead of containers.

For example:

testinfra_hosts = ['docker-image://python:2.7']

def test_version(host):
    asser host.check_output('python -V') == '2.7.16'

Under the hood, testinfra will execute all its command with docker run --rm -it <image> -- <cmd>

There will be not persistent state which might be non sense for some modules like "process" of "socket".

EDIT: The ":" separator for docker image tags will have to be urlencoded to be a valid testinfra host "url", unless we can make an exception here ?

philpep avatar May 19 '19 14:05 philpep

+1 any news ? :-)

MacFlurry avatar Feb 21 '20 18:02 MacFlurry

+1, any news?

BalintSzigeti avatar Apr 11 '22 19:04 BalintSzigeti