test_reactor.py 923 B

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