test_beacon.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # -*- coding: utf-8 -*-
  2. """
  3. Integration tests for the beacon states
  4. """
  5. from __future__ import absolute_import, print_function, unicode_literals
  6. # Import Salt Testing Libs
  7. from tests.support.case import ModuleCase
  8. from tests.support.mixins import SaltReturnAssertsMixin
  9. from tests.support.unit import skipIf
  10. class BeaconStateTestCase(ModuleCase, SaltReturnAssertsMixin):
  11. """
  12. Test beacon states
  13. """
  14. def setUp(self):
  15. """
  16. """
  17. self.run_function("beacons.reset", f_timeout=300)
  18. self.wait_for_all_jobs()
  19. def tearDown(self):
  20. self.run_function("beacons.reset", f_timeout=300)
  21. @skipIf(True, "SLOWTEST skip")
  22. def test_present_absent(self):
  23. kwargs = {"/": "38%", "interval": 5}
  24. ret = self.run_state(
  25. "beacon.present", name="diskusage", f_timeout=300, **kwargs
  26. )
  27. self.assertSaltTrueReturn(ret)
  28. ret = self.run_function("beacons.list", return_yaml=False, f_timeout=300)
  29. self.assertTrue("diskusage" in ret)
  30. self.assertTrue({"interval": 5} in ret["diskusage"])
  31. self.assertTrue({"/": "38%"} in ret["diskusage"])
  32. ret = self.run_state("beacon.absent", name="diskusage", f_timeout=300)
  33. self.assertSaltTrueReturn(ret)
  34. ret = self.run_function("beacons.list", return_yaml=False, f_timeout=300)
  35. self.assertEqual(ret, {"beacons": {}})