Fix netapi tests

This commit is contained in:
Daniel A. Wozniak 2023-08-21 15:36:44 -07:00 committed by Gareth J. Greenaway
parent af2c268347
commit de45a7bed0
3 changed files with 14 additions and 3 deletions

View file

@ -752,7 +752,9 @@ class Master(SMaster):
SMaster.secrets["aes"] = {
"secret": multiprocessing.Array(
ctypes.c_char,
salt.utils.stringutils.to_bytes(salt.crypt.Crypticle.generate_key_string()),
salt.utils.stringutils.to_bytes(
salt.crypt.Crypticle.generate_key_string()
),
),
"serial": multiprocessing.Value(
ctypes.c_longlong, lock=False # We'll use the lock from 'secret'

View file

@ -435,7 +435,15 @@ class TCPPubClient(salt.transport.base.PublishClient):
while True:
msg = await self.recv()
if msg:
await callback(msg)
try:
# XXX This is handled better in the websocket transport work
await callback(msg)
except Exception:
log.error(
"Unhandled exception while running callback %r",
self,
exc_info=True,
)
def on_recv(self, callback):
"""

View file

@ -1,5 +1,6 @@
from functools import partial
import asyncio
import pytest
import tornado.gen
@ -45,6 +46,6 @@ async def test_get(http_client, io_loop, app):
)
while len(events_fired) < 5:
await tornado.gen.sleep(1)
await asyncio.sleep(1)
assert len(events_fired) >= 5