mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add scenario test for syndic
This commit is contained in:
parent
feca5c8476
commit
2240c08406
3 changed files with 91 additions and 0 deletions
0
tests/pytests/scenarios/syndic/__init__.py
Normal file
0
tests/pytests/scenarios/syndic/__init__.py
Normal file
85
tests/pytests/scenarios/syndic/conftest.py
Normal file
85
tests/pytests/scenarios/syndic/conftest.py
Normal file
|
@ -0,0 +1,85 @@
|
|||
import logging
|
||||
|
||||
import pytest
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.fixture(scope="package")
|
||||
def master(request, salt_factories):
|
||||
config_defaults = {
|
||||
"transport": request.config.getoption("--transport"),
|
||||
}
|
||||
config_overrides = {
|
||||
"interface": "127.0.0.1",
|
||||
"auto_accept": True,
|
||||
"order_masters": True,
|
||||
}
|
||||
factory = salt_factories.salt_master_daemon(
|
||||
"master",
|
||||
defaults=config_defaults,
|
||||
overrides=config_overrides,
|
||||
extra_cli_arguments_after_first_start_failure=["--log-level=info"],
|
||||
)
|
||||
with factory.started(start_timeout=180):
|
||||
yield factory
|
||||
|
||||
|
||||
@pytest.fixture(scope="package")
|
||||
def salt_cli(master):
|
||||
return master.salt_cli(timeout=180)
|
||||
|
||||
|
||||
@pytest.fixture(scope="package")
|
||||
def syndic(master, salt_factories):
|
||||
|
||||
ret_port = master.config["ret_port"]
|
||||
port = master.config["publish_port"]
|
||||
addr = master.config["interface"]
|
||||
|
||||
# Force both master's publish port to be the same, this is a drawback of
|
||||
# the current syndic design.
|
||||
config_defaults = {
|
||||
"transport": master.config["transport"],
|
||||
"interface": "127.0.0.2",
|
||||
"publish_port": f"{port}",
|
||||
}
|
||||
master_overrides = {
|
||||
"interface": "127.0.0.2",
|
||||
"auto_accept": True,
|
||||
"syndic_master": f"{addr}",
|
||||
"syndic_master_port": f"{ret_port}",
|
||||
}
|
||||
minion_overrides = {
|
||||
"master": "127.0.0.2",
|
||||
"publish_port": f"{port}",
|
||||
}
|
||||
factory = master.salt_syndic_daemon(
|
||||
"syndic",
|
||||
defaults=config_defaults,
|
||||
master_overrides=master_overrides,
|
||||
minion_overrides=minion_overrides,
|
||||
extra_cli_arguments_after_first_start_failure=["--log-level=info"],
|
||||
)
|
||||
with factory.started(start_timeout=180):
|
||||
yield factory
|
||||
|
||||
|
||||
@pytest.fixture(scope="package")
|
||||
def minion(syndic, salt_factories):
|
||||
config_defaults = {
|
||||
"transport": syndic.config["transport"],
|
||||
}
|
||||
port = syndic.master.config["ret_port"]
|
||||
addr = syndic.master.config["interface"]
|
||||
config_overrides = {
|
||||
"master": f"{addr}:{port}",
|
||||
}
|
||||
factory = syndic.master.salt_minion_daemon(
|
||||
"minion",
|
||||
defaults=config_defaults,
|
||||
overrides=config_overrides,
|
||||
extra_cli_arguments_after_first_start_failure=["--log-level=info"],
|
||||
)
|
||||
with factory.started(start_timeout=180):
|
||||
yield factory
|
6
tests/pytests/scenarios/syndic/test_syndic.py
Normal file
6
tests/pytests/scenarios/syndic/test_syndic.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
def test_syndic(salt_cli, minion):
|
||||
ret = salt_cli.run("test.ping", minion_tgt="*", _timeout=15)
|
||||
assert ret.data == {
|
||||
"syndic": True,
|
||||
"minion": True,
|
||||
}
|
Loading…
Add table
Reference in a new issue