1
0

test_reactor.py 949 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # -*- coding: utf-8 -*-
  2. """
  3. integration.reactor.reactor
  4. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. Test Salt's reactor system
  6. """
  7. from __future__ import absolute_import
  8. import pytest
  9. import salt.utils.event
  10. from tests.support.case import ModuleCase
  11. from tests.support.mixins import SaltMinionEventAssertsMixin
  12. @pytest.mark.windows_whitelisted
  13. class ReactorTest(SaltMinionEventAssertsMixin, ModuleCase):
  14. """
  15. Test Salt's reactor system
  16. """
  17. @pytest.mark.slow_test(seconds=1) # Test takes >0.1 and <=1 seconds
  18. def test_ping_reaction(self):
  19. """
  20. Fire an event on the master and ensure
  21. that it pings the minion
  22. """
  23. # Create event bus connection
  24. e = salt.utils.event.get_event(
  25. "minion", sock_dir=self.minion_opts["sock_dir"], opts=self.minion_opts
  26. )
  27. e.fire_event({"a": "b"}, "/test_event")
  28. self.assertMinionEventReceived({"a": "b"}, timeout=30)