test_deploy.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. """
  2. salt-ssh testing
  3. """
  4. import os
  5. import shutil
  6. from tests.support.case import SSHCase
  7. from tests.support.helpers import slowTest
  8. from tests.support.runtests import RUNTIME_VARS
  9. class SSHTest(SSHCase):
  10. """
  11. Test general salt-ssh functionality
  12. """
  13. def setUp(self):
  14. thin_dir = self.run_function("config.get", ["thin_dir"], wipe=False)
  15. self.addCleanup(shutil.rmtree, thin_dir, ignore_errors=True)
  16. @slowTest
  17. def test_ping(self):
  18. """
  19. Test a simple ping
  20. """
  21. ret = self.run_function("test.ping")
  22. self.assertTrue(ret, "Ping did not return true")
  23. @slowTest
  24. def test_thin_dir(self):
  25. """
  26. test to make sure thin_dir is created
  27. and salt-call file is included
  28. """
  29. thin_dir = self.run_function("config.get", ["thin_dir"], wipe=False)
  30. os.path.isdir(thin_dir)
  31. os.path.exists(os.path.join(thin_dir, "salt-call"))
  32. os.path.exists(os.path.join(thin_dir, "running_data"))
  33. def test_set_path(self):
  34. """
  35. test setting the path env variable
  36. """
  37. path = "/pathdoesnotexist/"
  38. roster = os.path.join(RUNTIME_VARS.TMP, "roster-set-path")
  39. self.custom_roster(
  40. roster, data={"set_path": "$PATH:/usr/local/bin/:{}".format(path)}
  41. )
  42. ret = self.run_function("environ.get", ["PATH"], roster_file=roster)
  43. assert path in ret