conftest.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import pytest
  2. @pytest.fixture(scope="package")
  3. def salt_master(request, salt_factories, salt_master_config):
  4. return salt_factories.spawn_master(request, "master")
  5. @pytest.fixture(scope="package")
  6. def salt_minion(request, salt_factories, salt_master, salt_minion_config):
  7. proc = salt_factories.spawn_minion(request, "minion", master_id="master")
  8. # Sync All
  9. salt_call_cli = salt_factories.get_salt_call_cli("minion")
  10. ret = salt_call_cli.run("saltutil.sync_all", _timeout=120)
  11. assert ret.exitcode == 0, ret
  12. return proc
  13. @pytest.fixture(scope="package")
  14. def salt_sub_minion(request, salt_factories, salt_master, salt_sub_minion_config):
  15. proc = salt_factories.spawn_minion(request, "sub_minion", master_id="master")
  16. # Sync All
  17. salt_call_cli = salt_factories.get_salt_call_cli("sub_minion")
  18. ret = salt_call_cli.run("saltutil.sync_all", _timeout=120)
  19. assert ret.exitcode == 0, ret
  20. return proc
  21. @pytest.fixture(scope="package")
  22. def salt_cli(salt_factories, salt_minion, salt_master):
  23. return salt_factories.get_salt_cli(salt_master.config["id"])
  24. @pytest.fixture(scope="package")
  25. def salt_cp_cli(salt_factories, salt_minion, salt_master):
  26. return salt_factories.get_salt_cp_cli(salt_master.config["id"])
  27. @pytest.fixture(scope="package")
  28. def salt_key_cli(salt_factories, salt_minion, salt_master):
  29. return salt_factories.get_salt_key_cli(salt_master.config["id"])
  30. @pytest.fixture(scope="package")
  31. def salt_run_cli(salt_factories, salt_minion, salt_master):
  32. return salt_factories.get_salt_run_cli(salt_master.config["id"])
  33. @pytest.fixture(scope="package")
  34. def salt_call_cli(salt_factories, salt_minion, salt_master):
  35. return salt_factories.get_salt_call_cli(salt_minion.config["id"])