1
0

conftest.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. """
  2. tests.integration.conftest
  3. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. Integration tests PyTest configuration/fixtures
  5. """
  6. import logging
  7. import pytest
  8. log = logging.getLogger(__name__)
  9. @pytest.fixture(scope="package", autouse=True)
  10. def salt_master(salt_master_factory):
  11. """
  12. A running salt-master fixture
  13. """
  14. with salt_master_factory.started():
  15. yield salt_master_factory
  16. @pytest.fixture(scope="package", autouse=True)
  17. def salt_minion(salt_minion_factory):
  18. """
  19. A running salt-minion fixture
  20. """
  21. with salt_minion_factory.started():
  22. # Sync All
  23. salt_call_cli = salt_minion_factory.get_salt_call_cli()
  24. ret = salt_call_cli.run("saltutil.sync_all", _timeout=120)
  25. assert ret.exitcode == 0, ret
  26. yield salt_minion_factory
  27. @pytest.fixture(scope="module")
  28. def salt_sub_minion(salt_sub_minion_factory):
  29. """
  30. A second running salt-minion fixture
  31. """
  32. with salt_sub_minion_factory.started():
  33. # Sync All
  34. salt_call_cli = salt_sub_minion_factory.get_salt_call_cli()
  35. ret = salt_call_cli.run("saltutil.sync_all", _timeout=120)
  36. assert ret.exitcode == 0, ret
  37. yield salt_sub_minion_factory