def test_sock_path_len(self): """ This tests whether or not a larger hash causes the sock path to exceed the system's max sock path length. See the below link for more information. https://github.com/saltstack/salt/issues/12172#issuecomment-43903643 """ opts = { "id": "salt-testing", "hash_type": "sha512", "sock_dir": os.path.join(salt.syspaths.SOCK_DIR, "minion"), "extension_modules": "", } with patch.dict(self.opts, opts): try: event_publisher = event.AsyncEventPublisher(self.opts) result = True except ValueError: # There are rare cases where we operate a closed socket, especially in containers. # In this case, don't fail the test because we'll catch it down the road. result = True except SaltSystemExit: result = False self.assertTrue(result)
def setUp(self): super(TestAsyncEventPublisher, self).setUp() self.publisher = event.AsyncEventPublisher( {'sock_dir': SOCK_DIR}, self._handle_publish, self.io_loop, )
def setUp(self): super(TestAsyncEventPublisher, self).setUp() self.opts = {'sock_dir': SOCK_DIR} self.publisher = event.AsyncEventPublisher( self.opts, self.io_loop, ) self.event = event.get_event('minion', opts=self.opts, io_loop=self.io_loop) self.event.subscribe('') self.event.set_event_handler(self._handle_publish)
def test_sock_path_len(self): ''' This tests whether or not a larger hash causes the sock path to exceed the system's max sock path length. See the below link for more information. https://github.com/saltstack/salt/issues/12172#issuecomment-43903643 ''' opts = { 'id': 'salt-testing', 'hash_type': 'sha512', 'sock_dir': os.path.join(salt.syspaths.SOCK_DIR, 'minion'), 'extension_modules': '' } with patch.dict(__opts__, opts): try: event_publisher = event.AsyncEventPublisher(__opts__) result = True except SaltSystemExit: result = False self.assertTrue(result)