test_deploy.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. class SSHTest(SSHCase):
  12. '''
  13. Test general salt-ssh functionality
  14. '''
  15. def test_ping(self):
  16. '''
  17. Test a simple ping
  18. '''
  19. ret = self.run_function('test.ping')
  20. self.assertTrue(ret, 'Ping did not return true')
  21. def test_thin_dir(self):
  22. '''
  23. test to make sure thin_dir is created
  24. and salt-call file is included
  25. '''
  26. thin_dir = self.run_function('config.get', ['thin_dir'], wipe=False)
  27. os.path.isdir(thin_dir)
  28. os.path.exists(os.path.join(thin_dir, 'salt-call'))
  29. os.path.exists(os.path.join(thin_dir, 'running_data'))
  30. def tearDown(self):
  31. '''
  32. make sure to clean up any old ssh directories
  33. '''
  34. salt_dir = self.run_function('config.get', ['thin_dir'], wipe=False)
  35. if os.path.exists(salt_dir):
  36. shutil.rmtree(salt_dir)