123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734 |
- # -*- coding: utf-8 -*-
- '''
- tests.multimaster.conftest
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
- Multimaster PyTest prep routines
- '''
- from __future__ import absolute_import, print_function, unicode_literals
- import os
- import shutil
- import logging
- from collections import OrderedDict
- import pytest
- import psutil
- import salt.utils.files
- from salt.serializers import yaml
- from salt.utils.immutabletypes import freeze
- from tests.support.runtests import RUNTIME_VARS
- from pytestsalt.fixtures.ports import get_unused_localhost_port
- from pytestsalt.fixtures.config import apply_master_config, apply_minion_config
- from pytestsalt.fixtures.daemons import SaltMaster, SaltMinion, start_daemon
- log = logging.getLogger(__name__)
- SESSION_ROOT_DIR = 'sess-mm-root'
- SESSION_SECONDARY_ROOT_DIR = 'sess-sec-mm-root'
- @pytest.fixture(scope='session')
- def session_mm_root_dir(tempdir):
- '''
- Return the session scoped salt root dir
- '''
- return tempdir.mkdir(SESSION_ROOT_DIR)
- @pytest.fixture(scope='session')
- def session_mm_conf_dir(session_mm_root_dir):
- '''
- Return the session scoped salt root dir
- '''
- return session_mm_root_dir.join('conf').ensure(dir=True)
- # ----- Master Fixtures --------------------------------------------------------------------------------------------->
- @pytest.fixture(scope='session')
- def session_mm_master_id():
- '''
- Returns the session scoped master id
- '''
- return 'mm-master'
- @pytest.fixture(scope='session')
- def session_mm_master_publish_port():
- '''
- Returns an unused localhost port for the master publish interface
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_master_return_port():
- '''
- Returns an unused localhost port for the master return interface
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_master_engine_port():
- '''
- Returns an unused localhost port for the pytest session salt master engine
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_master_tcp_master_pub_port():
- '''
- Returns an unused localhost port
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_master_tcp_master_pull_port():
- '''
- Returns an unused localhost port
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_master_tcp_master_publish_pull():
- '''
- Returns an unused localhost port
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_master_tcp_master_workers():
- '''
- Returns an unused localhost port
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_master_log_prefix(session_mm_master_id):
- return 'salt-master/{}'.format(session_mm_master_id)
- @pytest.fixture(scope='session')
- def session_mm_master_config_file(session_mm_conf_dir):
- '''
- Returns the path to the salt master configuration file
- '''
- return session_mm_conf_dir.join('master').realpath().strpath
- @pytest.fixture(scope='session')
- def session_mm_master_default_options(session_master_default_options):
- with salt.utils.files.fopen(os.path.join(RUNTIME_VARS.CONF_DIR, 'mm_master')) as rfh:
- config_file_opts = yaml.deserialize(rfh.read())
- opts = session_master_default_options.copy()
- if config_file_opts:
- opts.update(config_file_opts)
- return opts
- @pytest.fixture(scope='session')
- def session_mm_master_config_overrides(session_master_config_overrides,
- session_mm_root_dir):
- overrides = session_master_config_overrides.copy()
- pytest_stop_sending_events_file = session_mm_root_dir.join('pytest_mm_stop_sending_events_file').strpath
- with salt.utils.files.fopen(pytest_stop_sending_events_file, 'w') as wfh:
- wfh.write('')
- overrides['pytest_stop_sending_events_file'] = pytest_stop_sending_events_file
- return overrides
- @pytest.fixture(scope='session')
- def session_mm_master_config(session_mm_root_dir,
- session_mm_master_default_options,
- session_mm_master_config_file,
- session_mm_master_publish_port,
- session_mm_master_return_port,
- session_mm_master_engine_port,
- session_mm_master_config_overrides,
- session_mm_master_id,
- session_base_env_state_tree_root_dir,
- session_prod_env_state_tree_root_dir,
- session_base_env_pillar_tree_root_dir,
- session_prod_env_pillar_tree_root_dir,
- running_username,
- log_server_port,
- log_server_level,
- engines_dir,
- log_handlers_dir,
- session_mm_master_log_prefix,
- session_mm_master_tcp_master_pub_port,
- session_mm_master_tcp_master_pull_port,
- session_mm_master_tcp_master_publish_pull,
- session_mm_master_tcp_master_workers):
- '''
- This fixture will return the salt master configuration options after being
- overridden with any options passed from ``session_master_config_overrides``
- '''
- return apply_master_config(session_mm_master_default_options,
- session_mm_root_dir,
- session_mm_master_config_file,
- session_mm_master_publish_port,
- session_mm_master_return_port,
- session_mm_master_engine_port,
- session_mm_master_config_overrides,
- session_mm_master_id,
- [session_base_env_state_tree_root_dir.strpath],
- [session_prod_env_state_tree_root_dir.strpath],
- [session_base_env_pillar_tree_root_dir.strpath],
- [session_prod_env_pillar_tree_root_dir.strpath],
- running_username,
- log_server_port,
- log_server_level,
- engines_dir,
- log_handlers_dir,
- session_mm_master_log_prefix,
- session_mm_master_tcp_master_pub_port,
- session_mm_master_tcp_master_pull_port,
- session_mm_master_tcp_master_publish_pull,
- session_mm_master_tcp_master_workers)
- @pytest.fixture(scope='session')
- def session_mm_salt_master(request,
- session_mm_conf_dir,
- session_mm_master_id,
- session_mm_master_config,
- log_server, # pylint: disable=unused-argument
- session_mm_master_log_prefix,
- cli_master_script_name,
- _cli_bin_dir,
- _salt_fail_hard,
- ):
- '''
- Returns a running salt-master
- '''
- return start_daemon(request,
- daemon_name='salt-master',
- daemon_id=session_mm_master_id,
- daemon_log_prefix=session_mm_master_log_prefix,
- daemon_cli_script_name=cli_master_script_name,
- daemon_config=session_mm_master_config,
- daemon_config_dir=session_mm_conf_dir,
- daemon_class=SaltMaster,
- bin_dir_path=_cli_bin_dir,
- fail_hard=_salt_fail_hard,
- event_listener_config_dir=session_mm_conf_dir,
- start_timeout=120)
- # <---- Master Fixtures ----------------------------------------------------------------------------------------------
- @pytest.fixture(scope='session')
- def session_mm_secondary_root_dir(tempdir):
- '''
- Return the session scoped salt secondary root dir
- '''
- return tempdir.mkdir(SESSION_SECONDARY_ROOT_DIR)
- @pytest.fixture(scope='session')
- def session_mm_secondary_conf_dir(session_mm_secondary_root_dir):
- '''
- Return the session scoped salt root dir
- '''
- return session_mm_secondary_root_dir.join('conf').ensure(dir=True)
- # ----- Sub Master Fixtures ----------------------------------------------------------------------------------------->
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_id():
- '''
- Returns the session scoped master id
- '''
- return 'mm-sub-master'
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_publish_port():
- '''
- Returns an unused localhost port for the master publish interface
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_return_port():
- '''
- Returns an unused localhost port for the master return interface
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_engine_port():
- '''
- Returns an unused localhost port for the pytest session salt master engine
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_tcp_master_pub_port():
- '''
- Returns an unused localhost port
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_tcp_master_pull_port():
- '''
- Returns an unused localhost port
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_tcp_master_publish_pull():
- '''
- Returns an unused localhost port
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_tcp_master_workers():
- '''
- Returns an unused localhost port
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_log_prefix(session_mm_secondary_master_id):
- return 'salt-master/{}'.format(session_mm_secondary_master_id)
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_config_file(session_mm_secondary_conf_dir):
- '''
- Returns the path to the salt master configuration file
- '''
- return session_mm_secondary_conf_dir.join('master').realpath().strpath
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_default_options(session_master_default_options):
- opts = session_master_default_options.copy()
- with salt.utils.files.fopen(os.path.join(RUNTIME_VARS.CONF_DIR, 'mm_sub_master')) as rfh:
- opts.update(yaml.deserialize(rfh.read()))
- return opts
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_config_overrides(session_master_config_overrides,
- session_mm_secondary_root_dir):
- overrides = session_master_config_overrides.copy()
- pytest_stop_sending_events_file = session_mm_secondary_root_dir.join('pytest_mm_stop_sending_events_file').strpath
- with salt.utils.files.fopen(pytest_stop_sending_events_file, 'w') as wfh:
- wfh.write('')
- overrides['pytest_stop_sending_events_file'] = pytest_stop_sending_events_file
- return overrides
- @pytest.fixture(scope='session')
- def session_mm_secondary_master_config(session_mm_secondary_root_dir,
- session_mm_secondary_master_default_options,
- session_mm_secondary_master_config_file,
- session_mm_secondary_master_publish_port,
- session_mm_secondary_master_return_port,
- session_mm_secondary_master_engine_port,
- session_mm_secondary_master_config_overrides,
- session_mm_secondary_master_id,
- session_base_env_state_tree_root_dir,
- session_prod_env_state_tree_root_dir,
- session_base_env_pillar_tree_root_dir,
- session_prod_env_pillar_tree_root_dir,
- running_username,
- log_server_port,
- log_server_level,
- engines_dir,
- log_handlers_dir,
- session_mm_secondary_master_log_prefix,
- session_mm_secondary_master_tcp_master_pub_port,
- session_mm_secondary_master_tcp_master_pull_port,
- session_mm_secondary_master_tcp_master_publish_pull,
- session_mm_secondary_master_tcp_master_workers):
- '''
- This fixture will return the salt master configuration options after being
- overridden with any options passed from ``session_master_config_overrides``
- '''
- return apply_master_config(session_mm_secondary_master_default_options,
- session_mm_secondary_root_dir,
- session_mm_secondary_master_config_file,
- session_mm_secondary_master_publish_port,
- session_mm_secondary_master_return_port,
- session_mm_secondary_master_engine_port,
- session_mm_secondary_master_config_overrides,
- session_mm_secondary_master_id,
- [session_base_env_state_tree_root_dir.strpath],
- [session_prod_env_state_tree_root_dir.strpath],
- [session_base_env_pillar_tree_root_dir.strpath],
- [session_prod_env_pillar_tree_root_dir.strpath],
- running_username,
- log_server_port,
- log_server_level,
- engines_dir,
- log_handlers_dir,
- session_mm_secondary_master_log_prefix,
- session_mm_secondary_master_tcp_master_pub_port,
- session_mm_secondary_master_tcp_master_pull_port,
- session_mm_secondary_master_tcp_master_publish_pull,
- session_mm_secondary_master_tcp_master_workers)
- @pytest.fixture(scope='session')
- def session_mm_secondary_salt_master(request,
- session_mm_secondary_conf_dir,
- session_mm_secondary_master_id,
- session_mm_secondary_master_config,
- log_server, # pylint: disable=unused-argument
- session_mm_secondary_master_log_prefix,
- cli_master_script_name,
- _cli_bin_dir,
- _salt_fail_hard,
- session_mm_master_config,
- session_mm_salt_master
- ):
- '''
- Returns a running salt-master
- '''
- # The secondary salt master depends on the primarily salt master fixture
- # because we need to clone the keys
- for keyfile in ('master.pem', 'master.pub'):
- shutil.copyfile(
- os.path.join(session_mm_master_config['pki_dir'], keyfile),
- os.path.join(session_mm_secondary_master_config['pki_dir'], keyfile)
- )
- return start_daemon(request,
- daemon_name='salt-master',
- daemon_id=session_mm_secondary_master_id,
- daemon_log_prefix=session_mm_secondary_master_log_prefix,
- daemon_cli_script_name=cli_master_script_name,
- daemon_config=session_mm_secondary_master_config,
- daemon_config_dir=session_mm_secondary_conf_dir,
- daemon_class=SaltMaster,
- bin_dir_path=_cli_bin_dir,
- fail_hard=_salt_fail_hard,
- event_listener_config_dir=session_mm_secondary_conf_dir,
- start_timeout=120)
- # <---- Sub Master Fixtures ------------------------------------------------------------------------------------------
- # ----- Sub Minion Fixtures --------------------------------------------------------------------------------------------->
- @pytest.fixture(scope='session')
- def session_mm_secondary_minion_id():
- '''
- Returns the session scoped minion id
- '''
- return 'mm-sub-minion'
- @pytest.fixture(scope='session')
- def session_mm_secondary_minion_tcp_pub_port():
- '''
- Returns an unused localhost port
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_secondary_minion_tcp_pull_port():
- '''
- Returns an unused localhost port
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_secondary_minion_log_prefix(session_mm_secondary_minion_id):
- return 'salt-minion/{}'.format(session_mm_secondary_minion_id)
- @pytest.fixture(scope='session')
- def session_mm_secondary_minion_config_file(session_mm_secondary_conf_dir):
- '''
- Returns the path to the salt minion configuration file
- '''
- return session_mm_secondary_conf_dir.join('minion').realpath().strpath
- @pytest.fixture(scope='session')
- def session_mm_secondary_minion_default_options(session_secondary_minion_default_options):
- opts = session_secondary_minion_default_options.copy()
- with salt.utils.files.fopen(os.path.join(RUNTIME_VARS.CONF_DIR, 'mm_sub_minion')) as rfh:
- opts.update(yaml.deserialize(rfh.read()))
- return opts
- @pytest.fixture(scope='session')
- def session_mm_secondary_minion_config_overrides(session_secondary_minion_config_overrides,
- session_mm_master_return_port,
- session_mm_secondary_master_return_port):
- if session_secondary_minion_config_overrides:
- opts = session_secondary_minion_config_overrides.copy()
- else:
- opts = {}
- opts['master_port'] = None
- opts['master'] = [
- 'localhost:{}'.format(session_mm_master_return_port),
- 'localhost:{}'.format(session_mm_secondary_master_return_port)
- ]
- return opts
- @pytest.fixture(scope='session')
- def session_mm_secondary_minion_config(session_mm_secondary_root_dir,
- session_mm_secondary_minion_config_file,
- session_mm_secondary_master_return_port,
- session_mm_secondary_minion_default_options,
- session_mm_secondary_minion_config_overrides,
- session_mm_secondary_minion_id,
- running_username,
- log_server_port,
- log_server_level,
- log_handlers_dir,
- session_mm_secondary_minion_log_prefix,
- session_mm_secondary_minion_tcp_pub_port,
- session_mm_secondary_minion_tcp_pull_port):
- '''
- This fixture will return the session salt minion configuration options after being
- overrided with any options passed from ``session_secondary_minion_config_overrides``
- '''
- return apply_minion_config(session_mm_secondary_minion_default_options,
- session_mm_secondary_root_dir,
- session_mm_secondary_minion_config_file,
- session_mm_secondary_master_return_port,
- session_mm_secondary_minion_config_overrides,
- session_mm_secondary_minion_id,
- running_username,
- log_server_port,
- log_server_level,
- log_handlers_dir,
- session_mm_secondary_minion_log_prefix,
- session_mm_secondary_minion_tcp_pub_port,
- session_mm_secondary_minion_tcp_pull_port)
- @pytest.fixture(scope='session')
- def session_mm_secondary_salt_minion(request,
- session_mm_salt_master,
- session_mm_secondary_salt_master,
- session_mm_secondary_minion_id,
- session_mm_secondary_minion_config,
- session_mm_secondary_minion_log_prefix,
- cli_minion_script_name,
- log_server,
- _cli_bin_dir,
- _salt_fail_hard,
- session_mm_secondary_conf_dir):
- '''
- Returns a running salt-minion
- '''
- return start_daemon(request,
- daemon_name='salt-minion',
- daemon_id=session_mm_secondary_minion_id,
- daemon_log_prefix=session_mm_secondary_minion_log_prefix,
- daemon_cli_script_name=cli_minion_script_name,
- daemon_config=session_mm_secondary_minion_config,
- daemon_config_dir=session_mm_secondary_conf_dir,
- daemon_class=SaltMinion,
- bin_dir_path=_cli_bin_dir,
- fail_hard=_salt_fail_hard,
- event_listener_config_dir=session_mm_secondary_conf_dir,
- start_timeout=120)
- # <---- Minion Fixtures ----------------------------------------------------------------------------------------------
- # ----- Minion Fixtures ----------------------------------------------------------------------------------------->
- @pytest.fixture(scope='session')
- def session_mm_minion_id():
- '''
- Returns the session scoped minion id
- '''
- return 'mm-minion'
- @pytest.fixture(scope='session')
- def session_mm_minion_tcp_pub_port():
- '''
- Returns an unused localhost port
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_minion_tcp_pull_port():
- '''
- Returns an unused localhost port
- '''
- return get_unused_localhost_port()
- @pytest.fixture(scope='session')
- def session_mm_minion_log_prefix(session_mm_minion_id):
- return 'salt-minion/{}'.format(session_mm_minion_id)
- @pytest.fixture(scope='session')
- def session_mm_minion_config_file(session_mm_conf_dir):
- '''
- Returns the path to the salt minion configuration file
- '''
- return session_mm_conf_dir.join('minion').realpath().strpath
- @pytest.fixture(scope='session')
- def session_mm_minion_default_options(session_minion_default_options):
- opts = session_minion_default_options.copy()
- with salt.utils.files.fopen(os.path.join(RUNTIME_VARS.CONF_DIR, 'mm_sub_minion')) as rfh:
- opts.update(yaml.deserialize(rfh.read()))
- return opts
- @pytest.fixture(scope='session')
- def session_mm_minion_config_overrides(session_minion_config_overrides,
- session_mm_master_return_port,
- session_mm_secondary_master_return_port):
- if session_minion_config_overrides:
- opts = session_minion_config_overrides.copy()
- else:
- opts = {}
- opts['master_port'] = None
- opts['master'] = [
- 'localhost:{}'.format(session_mm_master_return_port),
- 'localhost:{}'.format(session_mm_secondary_master_return_port)
- ]
- return opts
- @pytest.fixture(scope='session')
- def session_mm_minion_config(session_mm_root_dir,
- session_mm_minion_config_file,
- session_mm_master_return_port,
- session_mm_minion_default_options,
- session_mm_minion_config_overrides,
- session_mm_minion_id,
- running_username,
- log_server_port,
- log_server_level,
- log_handlers_dir,
- session_mm_minion_log_prefix,
- session_mm_minion_tcp_pub_port,
- session_mm_minion_tcp_pull_port):
- '''
- This fixture will return the session salt minion configuration options after being
- overrided with any options passed from ``session_minion_config_overrides``
- '''
- return apply_minion_config(session_mm_minion_default_options,
- session_mm_root_dir,
- session_mm_minion_config_file,
- session_mm_master_return_port,
- session_mm_minion_config_overrides,
- session_mm_minion_id,
- running_username,
- log_server_port,
- log_server_level,
- log_handlers_dir,
- session_mm_minion_log_prefix,
- session_mm_minion_tcp_pub_port,
- session_mm_minion_tcp_pull_port)
- @pytest.fixture(scope='session')
- def session_mm_salt_minion(request,
- session_mm_salt_master,
- session_mm_secondary_salt_master,
- session_mm_minion_id,
- session_mm_minion_config,
- session_mm_minion_log_prefix,
- cli_minion_script_name,
- log_server,
- _cli_bin_dir,
- _salt_fail_hard,
- session_mm_conf_dir):
- '''
- Returns a running salt-minion
- '''
- return start_daemon(request,
- daemon_name='salt-minion',
- daemon_id=session_mm_minion_id,
- daemon_log_prefix=session_mm_minion_log_prefix,
- daemon_cli_script_name=cli_minion_script_name,
- daemon_config=session_mm_minion_config,
- daemon_config_dir=session_mm_conf_dir,
- daemon_class=SaltMinion,
- bin_dir_path=_cli_bin_dir,
- fail_hard=_salt_fail_hard,
- event_listener_config_dir=session_mm_conf_dir,
- start_timeout=120)
- # <---- Sub Minion Fixtures ------------------------------------------------------------------------------------------
- @pytest.fixture(scope='session')
- def default_session_daemons(request,
- log_server,
- session_mm_salt_master,
- session_mm_secondary_salt_master,
- session_mm_salt_minion,
- session_mm_secondary_salt_minion,
- ):
- request.session.stats_processes.update(OrderedDict((
- ('Salt MM Master', psutil.Process(session_mm_salt_master.pid)),
- ('Salt MM Minion', psutil.Process(session_mm_salt_minion.pid)),
- ('Salt MM Sub Master', psutil.Process(session_mm_secondary_salt_master.pid)),
- ('Salt MM Sub Minion', psutil.Process(session_mm_secondary_salt_minion.pid)),
- )).items())
- # Run tests
- yield
- # Stop daemons now(they would be stopped at the end of the test run session
- for daemon in (session_mm_secondary_salt_minion,
- session_mm_secondary_salt_master,
- session_mm_salt_minion,
- session_mm_salt_master
- ):
- try:
- daemon.terminate()
- except Exception as exc: # pylint: disable=broad-except
- log.warning('Failed to terminate daemon: %s', daemon.__class__.__name__)
- @pytest.fixture(scope='session', autouse=True)
- def mm_bridge_pytest_and_runtests(reap_stray_processes,
- session_mm_conf_dir,
- session_mm_secondary_conf_dir,
- session_base_env_pillar_tree_root_dir,
- session_base_env_state_tree_root_dir,
- session_prod_env_state_tree_root_dir,
- session_mm_master_config,
- session_mm_minion_config,
- session_mm_secondary_master_config,
- session_mm_secondary_minion_config,
- default_session_daemons):
- # Make sure unittest2 classes know their paths
- RUNTIME_VARS.TMP_MM_CONF_DIR = session_mm_conf_dir.realpath().strpath
- RUNTIME_VARS.TMP_MM_SUB_CONF_DIR = session_mm_secondary_conf_dir.realpath().strpath
- RUNTIME_VARS.TMP_SUB_MINION_CONF_DIR = session_mm_secondary_conf_dir.realpath().strpath
- RUNTIME_VARS.TMP_PILLAR_TREE = session_base_env_pillar_tree_root_dir.realpath().strpath
- RUNTIME_VARS.TMP_STATE_TREE = session_base_env_state_tree_root_dir.realpath().strpath
- RUNTIME_VARS.TMP_PRODENV_STATE_TREE = session_prod_env_state_tree_root_dir.realpath().strpath
- # Make sure unittest2 uses the pytest generated configuration
- RUNTIME_VARS.RUNTIME_CONFIGS['mm_master'] = freeze(session_mm_master_config)
- RUNTIME_VARS.RUNTIME_CONFIGS['mm_minion'] = freeze(session_mm_minion_config)
- RUNTIME_VARS.RUNTIME_CONFIGS['mm_sub_master'] = freeze(session_mm_secondary_master_config)
- RUNTIME_VARS.RUNTIME_CONFIGS['mm_sub_minion'] = freeze(session_mm_secondary_minion_config)
|