1
0

test_reactor.py 875 B

123456789101112131415161718192021222324252627282930313233343536
  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. class ReactorTest(SaltMinionEventAssertsMixin, ModuleCase):
  15. '''
  16. Test Salt's reactor system
  17. '''
  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('minion', sock_dir=self.minion_opts['sock_dir'], opts=self.minion_opts)
  25. e.fire_event({'a': 'b'}, '/test_event')
  26. self.assertMinionEventReceived({'a': 'b'}, timeout=30)