123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- """
- tests.pytests.integration.conftest
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PyTest fixtures
- """
- import pytest
- @pytest.fixture(scope="package")
- def salt_master(salt_master_factory):
- """
- A running salt-master fixture
- """
- with salt_master_factory.started():
- yield salt_master_factory
- @pytest.fixture(scope="package")
- def salt_minion(salt_master, salt_minion_factory):
- """
- A running salt-minion fixture
- """
- assert salt_master.is_running()
- with salt_minion_factory.started():
- # Sync All
- salt_call_cli = salt_minion_factory.get_salt_call_cli()
- ret = salt_call_cli.run("saltutil.sync_all", _timeout=120)
- assert ret.exitcode == 0, ret
- yield salt_minion_factory
- @pytest.fixture(scope="module")
- def salt_sub_minion(salt_master, salt_sub_minion_factory):
- """
- A second running salt-minion fixture
- """
- assert salt_master.is_running()
- with salt_sub_minion_factory.started():
- # Sync All
- salt_call_cli = salt_sub_minion_factory.get_salt_call_cli()
- ret = salt_call_cli.run("saltutil.sync_all", _timeout=120)
- assert ret.exitcode == 0, ret
- yield salt_sub_minion_factory
- @pytest.fixture(scope="package")
- def salt_proxy(salt_master, salt_proxy_factory):
- """
- A running salt-proxy fixture
- """
- assert salt_master.is_running()
- with salt_proxy_factory.started():
- yield salt_proxy_factory
- @pytest.fixture(scope="package")
- def salt_cli(salt_master):
- """
- The ``salt`` CLI as a fixture against the running master
- """
- assert salt_master.is_running()
- return salt_master.get_salt_cli()
- @pytest.fixture(scope="package")
- def salt_call_cli(salt_minion):
- """
- The ``salt-call`` CLI as a fixture against the running minion
- """
- assert salt_minion.is_running()
- return salt_minion.get_salt_call_cli()
- @pytest.fixture(scope="package")
- def salt_cp_cli(salt_master):
- """
- The ``salt-cp`` CLI as a fixture against the running master
- """
- assert salt_master.is_running()
- return salt_master.get_salt_cp_cli()
- @pytest.fixture(scope="package")
- def salt_key_cli(salt_master):
- """
- The ``salt-key`` CLI as a fixture against the running master
- """
- assert salt_master.is_running()
- return salt_master.get_salt_key_cli()
- @pytest.fixture(scope="package")
- def salt_run_cli(salt_master):
- """
- The ``salt-run`` CLI as a fixture against the running master
- """
- assert salt_master.is_running()
- return salt_master.get_salt_run_cli()
- @pytest.fixture(scope="package")
- def salt_ssh_cli(salt_master):
- """
- The ``salt-ssh`` CLI as a fixture against the running master
- """
- assert salt_master.is_running()
- return salt_master.get_salt_ssh_cli()
|