test_deploy.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # -*- coding: utf-8 -*-
  2. """
  3. salt-ssh testing
  4. """
  5. # Import Python libs
  6. from __future__ import absolute_import, print_function, unicode_literals
  7. import os
  8. import shutil
  9. # Import salt testing libs
  10. from tests.support.case import SSHCase
  11. from tests.support.runtests import RUNTIME_VARS
  12. from tests.support.unit import skipIf
  13. class SSHTest(SSHCase):
  14. """
  15. Test general salt-ssh functionality
  16. """
  17. @skipIf(True, "SLOWTEST skip")
  18. def test_ping(self):
  19. """
  20. Test a simple ping
  21. """
  22. ret = self.run_function("test.ping")
  23. self.assertTrue(ret, "Ping did not return true")
  24. @skipIf(True, "SLOWTEST skip")
  25. def test_thin_dir(self):
  26. """
  27. test to make sure thin_dir is created
  28. and salt-call file is included
  29. """
  30. thin_dir = self.run_function("config.get", ["thin_dir"], wipe=False)
  31. os.path.isdir(thin_dir)
  32. os.path.exists(os.path.join(thin_dir, "salt-call"))
  33. os.path.exists(os.path.join(thin_dir, "running_data"))
  34. def test_set_path(self):
  35. """
  36. test setting the path env variable
  37. """
  38. path = "/pathdoesnotexist/"
  39. roster = os.path.join(RUNTIME_VARS.TMP, "roster-set-path")
  40. self.custom_roster(
  41. roster, data={"set_path": "$PATH:/usr/local/bin/:{0}".format(path)}
  42. )
  43. ret = self.run_function("environ.get", ["PATH"], roster_file=roster)
  44. assert path in ret
  45. def tearDown(self):
  46. """
  47. make sure to clean up any old ssh directories
  48. """
  49. salt_dir = self.run_function("config.get", ["thin_dir"], wipe=False)
  50. if os.path.exists(salt_dir):
  51. shutil.rmtree(salt_dir)