1
0

test_master.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. """
  2. Simple Smoke Tests for Connected SSH minions
  3. """
  4. from tests.support.case import SSHCase
  5. from tests.support.helpers import requires_system_grains, skip_if_not_root, slowTest
  6. class SSHMasterTestCase(SSHCase):
  7. """
  8. Test ssh master functionality
  9. """
  10. @slowTest
  11. def test_can_it_ping(self):
  12. """
  13. Ensure the proxy can ping
  14. """
  15. ret = self.run_function("test.ping")
  16. self.assertEqual(ret, True)
  17. @requires_system_grains
  18. @skip_if_not_root
  19. @slowTest
  20. def test_service(self, grains):
  21. service = "cron"
  22. os_family = grains["os_family"]
  23. os_release = grains["osrelease"]
  24. if os_family == "RedHat":
  25. service = "crond"
  26. elif os_family == "Arch":
  27. service = "sshd"
  28. elif os_family == "MacOS":
  29. service = "org.ntp.ntpd"
  30. if int(os_release.split(".")[1]) >= 13:
  31. service = "com.apple.AirPlayXPCHelper"
  32. self.run_function("service.enable", [service])
  33. ret = self.run_function("service.get_all")
  34. self.assertIn(service, ret)
  35. self.run_function("service.stop", [service])
  36. ret = self.run_function("service.status", [service])
  37. self.assertFalse(ret)
  38. self.run_function("service.start", [service])
  39. ret = self.run_function("service.status", [service])
  40. self.assertTrue(ret)
  41. @slowTest
  42. def test_state_apply(self):
  43. ret = self.run_function("state.apply", ["core"])
  44. for key, value in ret.items():
  45. self.assertTrue(value["result"])
  46. @slowTest
  47. def test_state_highstate(self):
  48. ret = self.run_function("state.highstate")
  49. for key, value in ret.items():
  50. self.assertTrue(value["result"])