test_reactor.py 926 B

1234567891011121314151617181920212223242526272829303132333435363738
  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.helpers import flaky
  12. from tests.support.mixins import SaltMinionEventAssertsMixin
  13. # Import Salt libs
  14. import salt.utils.event
  15. class ReactorTest(ModuleCase, SaltMinionEventAssertsMixin):
  16. '''
  17. Test Salt's reactor system
  18. '''
  19. @flaky
  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)