mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Use the salt release images from the salt-ci-containers repository
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
836cd87e08
commit
31f50159a6
1 changed files with 95 additions and 29 deletions
|
@ -5,6 +5,8 @@ import time
|
|||
|
||||
import pytest
|
||||
|
||||
from tests.conftest import CODE_DIR
|
||||
|
||||
docker = pytest.importorskip("docker")
|
||||
|
||||
|
||||
|
@ -70,10 +72,19 @@ def syndic_network():
|
|||
network.remove()
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
@pytest.fixture(scope="module")
|
||||
def source_path():
|
||||
x = pathlib.Path(__file__).parent.parent.parent.parent.parent / "salt"
|
||||
return str(x)
|
||||
return str(CODE_DIR / "salt")
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def container_image_name():
|
||||
return "ghcr.io/saltstack/salt-ci-containers/salt:3005"
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def container_python_version():
|
||||
return "3.7"
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
|
@ -187,11 +198,18 @@ external_auth:
|
|||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def docker_master(salt_factories, syndic_network, config, source_path):
|
||||
def docker_master(
|
||||
salt_factories,
|
||||
syndic_network,
|
||||
config,
|
||||
source_path,
|
||||
container_image_name,
|
||||
container_python_version,
|
||||
):
|
||||
config_dir = str(config["master_dir"])
|
||||
container = salt_factories.get_container(
|
||||
"master",
|
||||
image_name="saltstack/salt:3005",
|
||||
image_name=container_image_name,
|
||||
container_run_kwargs={
|
||||
# "entrypoint": "salt-master -ldebug",
|
||||
"entrypoint": "python -m http.server",
|
||||
|
@ -199,7 +217,7 @@ def docker_master(salt_factories, syndic_network, config, source_path):
|
|||
"volumes": {
|
||||
config_dir: {"bind": "/etc/salt", "mode": "z"},
|
||||
source_path: {
|
||||
"bind": "/usr/local/lib/python3.7/site-packages/salt/",
|
||||
"bind": f"/usr/local/lib/python{container_python_version}/site-packages/salt/",
|
||||
"mode": "z",
|
||||
},
|
||||
},
|
||||
|
@ -211,18 +229,24 @@ def docker_master(salt_factories, syndic_network, config, source_path):
|
|||
# container.container_start_check(confirm_container_started, container)
|
||||
with container.started() as factory:
|
||||
for user in ("bob", "fnord"):
|
||||
container.run(f"adduser -D {user}")
|
||||
container.run(f"adduser {user}")
|
||||
container.run(f"passwd -d {user}")
|
||||
container.run("apk add linux-pam-dev")
|
||||
yield factory
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def docker_minion(salt_factories, syndic_network, config, source_path):
|
||||
def docker_minion(
|
||||
salt_factories,
|
||||
syndic_network,
|
||||
config,
|
||||
source_path,
|
||||
container_image_name,
|
||||
container_python_version,
|
||||
):
|
||||
config_dir = str(config["minion_dir"])
|
||||
container = salt_factories.get_container(
|
||||
"minion",
|
||||
image_name="saltstack/salt:3005",
|
||||
image_name=container_image_name,
|
||||
container_run_kwargs={
|
||||
# "entrypoint": "salt-minion",
|
||||
"entrypoint": "python -m http.server",
|
||||
|
@ -230,7 +254,7 @@ def docker_minion(salt_factories, syndic_network, config, source_path):
|
|||
"volumes": {
|
||||
config_dir: {"bind": "/etc/salt", "mode": "z"},
|
||||
source_path: {
|
||||
"bind": "/usr/local/lib/python3.7/site-packages/salt/",
|
||||
"bind": f"/usr/local/lib/python{container_python_version}/site-packages/salt/",
|
||||
"mode": "z",
|
||||
},
|
||||
},
|
||||
|
@ -245,11 +269,18 @@ def docker_minion(salt_factories, syndic_network, config, source_path):
|
|||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def docker_syndic_a(salt_factories, config, syndic_network, source_path):
|
||||
def docker_syndic_a(
|
||||
salt_factories,
|
||||
config,
|
||||
syndic_network,
|
||||
source_path,
|
||||
container_image_name,
|
||||
container_python_version,
|
||||
):
|
||||
config_dir = str(config["syndic_a_dir"])
|
||||
container = salt_factories.get_container(
|
||||
"syndic_a",
|
||||
image_name="saltstack/salt:3005",
|
||||
image_name=container_image_name,
|
||||
container_run_kwargs={
|
||||
# "entrypoint": "salt-master -ldebug",
|
||||
"entrypoint": "python -m http.server",
|
||||
|
@ -257,7 +288,7 @@ def docker_syndic_a(salt_factories, config, syndic_network, source_path):
|
|||
"volumes": {
|
||||
config_dir: {"bind": "/etc/salt", "mode": "z"},
|
||||
source_path: {
|
||||
"bind": "/usr/local/lib/python3.7/site-packages/salt/",
|
||||
"bind": f"/usr/local/lib/python{container_python_version}/site-packages/salt/",
|
||||
"mode": "z",
|
||||
},
|
||||
},
|
||||
|
@ -272,11 +303,18 @@ def docker_syndic_a(salt_factories, config, syndic_network, source_path):
|
|||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def docker_syndic_b(salt_factories, config, syndic_network, source_path):
|
||||
def docker_syndic_b(
|
||||
salt_factories,
|
||||
config,
|
||||
syndic_network,
|
||||
source_path,
|
||||
container_image_name,
|
||||
container_python_version,
|
||||
):
|
||||
config_dir = str(config["syndic_b_dir"])
|
||||
container = salt_factories.get_container(
|
||||
"syndic_b",
|
||||
image_name="saltstack/salt:3005",
|
||||
image_name=container_image_name,
|
||||
container_run_kwargs={
|
||||
# "entrypoint": "salt-master -ldebug",
|
||||
"entrypoint": "python -m http.server",
|
||||
|
@ -284,7 +322,7 @@ def docker_syndic_b(salt_factories, config, syndic_network, source_path):
|
|||
"volumes": {
|
||||
config_dir: {"bind": "/etc/salt", "mode": "z"},
|
||||
source_path: {
|
||||
"bind": "/usr/local/lib/python3.7/site-packages/salt/",
|
||||
"bind": f"/usr/local/lib/python{container_python_version}/site-packages/salt/",
|
||||
"mode": "z",
|
||||
},
|
||||
},
|
||||
|
@ -299,11 +337,18 @@ def docker_syndic_b(salt_factories, config, syndic_network, source_path):
|
|||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def docker_minion_a1(salt_factories, config, syndic_network, source_path):
|
||||
def docker_minion_a1(
|
||||
salt_factories,
|
||||
config,
|
||||
syndic_network,
|
||||
source_path,
|
||||
container_image_name,
|
||||
container_python_version,
|
||||
):
|
||||
config_dir = str(config["minion_a1_dir"])
|
||||
container = salt_factories.get_container(
|
||||
"minion_a1",
|
||||
image_name="saltstack/salt:3005",
|
||||
image_name=container_image_name,
|
||||
container_run_kwargs={
|
||||
"network": syndic_network,
|
||||
# "entrypoint": "salt-minion -ldebug",
|
||||
|
@ -311,7 +356,7 @@ def docker_minion_a1(salt_factories, config, syndic_network, source_path):
|
|||
"volumes": {
|
||||
config_dir: {"bind": "/etc/salt", "mode": "z"},
|
||||
source_path: {
|
||||
"bind": "/usr/local/lib/python3.7/site-packages/salt/",
|
||||
"bind": f"/usr/local/lib/python{container_python_version}/site-packages/salt/",
|
||||
"mode": "z",
|
||||
},
|
||||
},
|
||||
|
@ -326,11 +371,18 @@ def docker_minion_a1(salt_factories, config, syndic_network, source_path):
|
|||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def docker_minion_a2(salt_factories, config, syndic_network, source_path):
|
||||
def docker_minion_a2(
|
||||
salt_factories,
|
||||
config,
|
||||
syndic_network,
|
||||
source_path,
|
||||
container_image_name,
|
||||
container_python_version,
|
||||
):
|
||||
config_dir = str(config["minion_a2_dir"])
|
||||
container = salt_factories.get_container(
|
||||
"minion_a2",
|
||||
image_name="saltstack/salt:3005",
|
||||
image_name=container_image_name,
|
||||
container_run_kwargs={
|
||||
"network": syndic_network,
|
||||
# "entrypoint": "salt-minion",
|
||||
|
@ -338,7 +390,7 @@ def docker_minion_a2(salt_factories, config, syndic_network, source_path):
|
|||
"volumes": {
|
||||
config_dir: {"bind": "/etc/salt", "mode": "z"},
|
||||
source_path: {
|
||||
"bind": "/usr/local/lib/python3.7/site-packages/salt/",
|
||||
"bind": f"/usr/local/lib/python{container_python_version}/site-packages/salt/",
|
||||
"mode": "z",
|
||||
},
|
||||
},
|
||||
|
@ -353,11 +405,18 @@ def docker_minion_a2(salt_factories, config, syndic_network, source_path):
|
|||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def docker_minion_b1(salt_factories, config, syndic_network, source_path):
|
||||
def docker_minion_b1(
|
||||
salt_factories,
|
||||
config,
|
||||
syndic_network,
|
||||
source_path,
|
||||
container_image_name,
|
||||
container_python_version,
|
||||
):
|
||||
config_dir = str(config["minion_b1_dir"])
|
||||
container = salt_factories.get_container(
|
||||
"minion_b1",
|
||||
image_name="saltstack/salt:3005",
|
||||
image_name=container_image_name,
|
||||
container_run_kwargs={
|
||||
"network": syndic_network,
|
||||
# "entrypoint": "salt-minion",
|
||||
|
@ -365,7 +424,7 @@ def docker_minion_b1(salt_factories, config, syndic_network, source_path):
|
|||
"volumes": {
|
||||
config_dir: {"bind": "/etc/salt", "mode": "z"},
|
||||
source_path: {
|
||||
"bind": "/usr/local/lib/python3.7/site-packages/salt/",
|
||||
"bind": f"/usr/local/lib/python{container_python_version}/site-packages/salt/",
|
||||
"mode": "z",
|
||||
},
|
||||
},
|
||||
|
@ -380,11 +439,18 @@ def docker_minion_b1(salt_factories, config, syndic_network, source_path):
|
|||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def docker_minion_b2(salt_factories, config, syndic_network, source_path):
|
||||
def docker_minion_b2(
|
||||
salt_factories,
|
||||
config,
|
||||
syndic_network,
|
||||
source_path,
|
||||
container_image_name,
|
||||
container_python_version,
|
||||
):
|
||||
config_dir = str(config["minion_b2_dir"])
|
||||
container = salt_factories.get_container(
|
||||
"minion_b2",
|
||||
image_name="saltstack/salt:3005",
|
||||
image_name=container_image_name,
|
||||
container_run_kwargs={
|
||||
"network": syndic_network,
|
||||
# "entrypoint": "salt-minion",
|
||||
|
@ -392,7 +458,7 @@ def docker_minion_b2(salt_factories, config, syndic_network, source_path):
|
|||
"volumes": {
|
||||
config_dir: {"bind": "/etc/salt", "mode": "z"},
|
||||
source_path: {
|
||||
"bind": "/usr/local/lib/python3.7/site-packages/salt/",
|
||||
"bind": f"/usr/local/lib/python{container_python_version}/site-packages/salt/",
|
||||
"mode": "z",
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue