2016-05-19 19:41:23 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
'''
|
|
|
|
|
|
|
|
integration.reactor.reactor
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Test Salt's reactor system
|
|
|
|
'''
|
|
|
|
|
|
|
|
# Import Python libs
|
|
|
|
from __future__ import absolute_import
|
|
|
|
|
|
|
|
# Import Salt testing libs
|
2017-02-27 15:59:04 +00:00
|
|
|
import tests.integration as integration
|
2017-03-30 16:42:26 +00:00
|
|
|
from tests.support.helpers import flaky
|
2016-05-19 19:41:23 +00:00
|
|
|
|
|
|
|
# Import Salt libs
|
|
|
|
import salt.utils.event
|
|
|
|
|
|
|
|
|
2017-04-02 15:21:06 +00:00
|
|
|
class ReactorTest(integration.ModuleCase, integration.SaltMinionEventAssertsMixin):
|
2016-05-19 19:41:23 +00:00
|
|
|
'''
|
|
|
|
Test Salt's reactor system
|
|
|
|
'''
|
|
|
|
|
2017-03-30 16:42:26 +00:00
|
|
|
@flaky()
|
2016-05-19 19:41:23 +00:00
|
|
|
def test_ping_reaction(self):
|
|
|
|
'''
|
|
|
|
Fire an event on the master and ensure
|
|
|
|
that it pings the minion
|
|
|
|
'''
|
|
|
|
# Create event bus connection
|
|
|
|
e = salt.utils.event.get_event('minion', sock_dir=self.minion_opts['sock_dir'], opts=self.minion_opts)
|
|
|
|
|
|
|
|
e.fire_event({'a': 'b'}, '/test_event')
|
|
|
|
|
|
|
|
self.assertMinionEventReceived({'a': 'b'})
|