diff --git a/tests/Makefile b/tests/Makefile index 7208313..0e51fdb 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -18,6 +18,7 @@ build: check-in-container: sudo podman run --rm \ -v $(CURDIR):/src \ + --net host \ -w /src \ -v /var/run/docker.sock:/var/run/docker.sock \ $(TESTS_IMAGE) \ diff --git a/tests/tests.yml b/tests/tests.yml index ea4b523..266ff96 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -1,16 +1,25 @@ - name: Run the tests vars: req_services: [] # don't name this required_services, it would be endless loop + req_pkgs: + - python-docker-tests + - python3-mock + - python3-pytest + - python3-docker hosts: all tasks: - name: check if we are running in a container command: systemctl register: in_host ignore_errors: true - - name: add docker to req_services if we are not in a dkr cont + - name: add docker to req_services if we are not in a container set_fact: req_services: ["docker"] when: in_host.rc == 0 + - name: add docker to req_pkgs if we are not in a container + set_fact: + req_pkgs: '{{ req_pkgs }} + [ "docker" ]' + when: in_host.rc == 0 - name: run them tests include_role: name: standard-test-basic @@ -22,10 +31,5 @@ run: pytest-3 -v /usr/libexec/installed-tests/python-docker/tests/unit/ - integration: run: pytest-3 -v /usr/libexec/installed-tests/python-docker/tests/integration/ - required_packages: - - python-docker-tests - - python3-mock - - python3-pytest - - python3-docker - - docker # TODO: dont install when in a container + required_packages: '{{ req_pkgs }}' required_services: '{{ req_services }}'