mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Install Salt in the container before starting any of Salt's daemons
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
e0bc1bd255
commit
b213670518
2 changed files with 9 additions and 16 deletions
|
@ -7,7 +7,6 @@ from xml.etree import ElementTree
|
|||
|
||||
import pytest
|
||||
|
||||
import salt.version
|
||||
from tests.support.virt import SaltVirtMinionContainerFactory
|
||||
|
||||
docker = pytest.importorskip("docker")
|
||||
|
@ -20,19 +19,6 @@ pytestmark = [
|
|||
]
|
||||
|
||||
|
||||
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
|
||||
)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import logging
|
||||
import time
|
||||
import uuid
|
||||
|
||||
|
@ -7,6 +8,13 @@ from saltfactories.daemons.container import SaltMinion
|
|||
|
||||
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 @@ class SaltVirtMinionContainerFactory(SaltMinion):
|
|||
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:
|
||||
|
|
Loading…
Add table
Reference in a new issue