diff --git a/tests/pytests/integration/modules/test_virt.py b/tests/pytests/integration/modules/test_virt.py index c39851305bca..2fd47767158a 100644 --- a/tests/pytests/integration/modules/test_virt.py +++ b/tests/pytests/integration/modules/test_virt.py @@ -7,7 +7,6 @@ import pytest -import salt.version from tests.support.virt import SaltVirtMinionContainerFactory docker = pytest.importorskip("docker") @@ -20,19 +19,6 @@ ] -def _install_salt_dependencies(container): - dependencies = [] - for package, version in salt.version.dependency_information(): - if package.lower() not in ("tornado", "packaging", "looseversion"): - # These are newer base dependencies which the container might not - # yet have - continue - dependencies.append(f"{package.lower()}=={version}") - if dependencies: - ret = container.run("python3", "-m", "pip", "install", *dependencies) - log.debug("Install missing dependecies ret: %s", ret) - - @pytest.fixture(scope="module") def virt_minion_0_id(): return "virt-minion-0" @@ -73,7 +59,6 @@ def virt_minion_0( skip_on_pull_failure=True, skip_if_docker_client_not_connectable=True, ) - factory.before_start(_install_salt_dependencies, factory) factory.after_terminate( pytest.helpers.remove_stale_minion_key, salt_master, factory.id ) @@ -111,7 +96,6 @@ def virt_minion_1( skip_on_pull_failure=True, skip_if_docker_client_not_connectable=True, ) - factory.before_start(_install_salt_dependencies, factory) factory.after_terminate( pytest.helpers.remove_stale_minion_key, salt_master, factory.id ) diff --git a/tests/support/virt.py b/tests/support/virt.py index 0f2b946ace44..13498a9f6300 100644 --- a/tests/support/virt.py +++ b/tests/support/virt.py @@ -1,3 +1,4 @@ +import logging import time import uuid @@ -7,6 +8,13 @@ from tests.conftest import CODE_DIR +log = logging.getLogger(__name__) + + +def _install_salt_in_container(container): + ret = container.run("python3", "-m", "pip", "install", "/salt") + log.debug("Install Salt in the container: %s", ret) + @attr.s(kw_only=True, slots=True) class SaltVirtMinionContainerFactory(SaltMinion): @@ -64,6 +72,7 @@ def __attrs_post_init__(self): self.container_start_check(self._check_script_path_exists) for port in (self.sshd_port, self.libvirt_tcp_port, self.libvirt_tls_port): self.check_ports[port] = port + self.before_start(_install_salt_in_container, self, on_container=False) def _check_script_path_exists(self, timeout_at): while time.time() <= timeout_at: