mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
minion_opts
fixture is now available for all tests under tests/pytests/unit
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
413a6ef633
commit
c1558ae7e7
3 changed files with 28 additions and 13 deletions
|
@ -42,8 +42,8 @@ def minion_config_defaults():
|
|||
@pytest.fixture(scope="module")
|
||||
def minion_config_overrides():
|
||||
"""
|
||||
Functional test modules can provide this fixture to tweak the configuration overrides dictionary
|
||||
passed to the minion factory
|
||||
Functional test modules can provide this fixture to tweak the configuration
|
||||
overrides dictionary passed to the minion factory
|
||||
"""
|
||||
return {}
|
||||
|
||||
|
@ -60,7 +60,14 @@ def minion_opts(
|
|||
minion_config_overrides.update(
|
||||
{
|
||||
"file_client": "local",
|
||||
"file_roots": {"base": [str(state_tree)], "prod": [str(state_tree_prod)]},
|
||||
"file_roots": {
|
||||
"base": [
|
||||
str(state_tree),
|
||||
],
|
||||
"prod": [
|
||||
str(state_tree_prod),
|
||||
],
|
||||
},
|
||||
}
|
||||
)
|
||||
factory = salt_factories.salt_minion_daemon(
|
||||
|
|
18
tests/pytests/unit/conftest.py
Normal file
18
tests/pytests/unit/conftest.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import pytest
|
||||
|
||||
import salt.config
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def minion_opts(tmp_path):
|
||||
"""
|
||||
Default minion configuration with relative temporary paths to not require root permissions.
|
||||
"""
|
||||
opts = salt.config.DEFAULT_MINION_OPTS.copy()
|
||||
opts["root_dir"] = str(tmp_path)
|
||||
for name in ("cachedir", "pki_dir", "sock_dir", "conf_dir"):
|
||||
dirpath = tmp_path / name
|
||||
dirpath.mkdir()
|
||||
opts[name] = str(dirpath)
|
||||
opts["log_file"] = "logs/minion.log"
|
||||
return opts
|
|
@ -21,16 +21,6 @@ from tests.support.mock import MagicMock, patch
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def minion_opts(temp_salt_minion, tmp_path):
|
||||
opts = salt.config.DEFAULT_MINION_OPTS.copy()
|
||||
opts["root_dir"] = str(tmp_path)
|
||||
for name in ("cachedir", "pki_dir", "sock_dir", "conf_dir"):
|
||||
opts[name] = str(tmp_path / name)
|
||||
opts["log_file"] = "logs/minion.log"
|
||||
return opts
|
||||
|
||||
|
||||
def test_minion_load_grains_false():
|
||||
"""
|
||||
Minion does not generate grains when load_grains is False
|
||||
|
|
Loading…
Add table
Reference in a new issue