mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
parent
40d24844cb
commit
4f49389e6d
1 changed files with 12 additions and 3 deletions
|
@ -2,6 +2,8 @@ import pytest
|
|||
import salt.ext.tornado.iostream
|
||||
import salt.transport.ipc
|
||||
import salt.utils.asynchronous
|
||||
import salt.utils.platform
|
||||
from saltfactories.utils.ports import get_unused_localhost_port
|
||||
|
||||
|
||||
def test_ipc_connect_in_async_methods():
|
||||
|
@ -9,14 +11,21 @@ def test_ipc_connect_in_async_methods():
|
|||
assert "connect" in salt.transport.ipc.IPCMessageSubscriber.async_methods
|
||||
|
||||
|
||||
def test_ipc_connect_sync_wrapped():
|
||||
async def test_ipc_connect_sync_wrapped(io_loop, tmp_path):
|
||||
"""
|
||||
Ensure IPCMessageSubscriber.connect gets wrapped by
|
||||
salt.utils.asynchronous.SyncWrapper.
|
||||
"""
|
||||
puburi = "/tmp/noexist.ipc"
|
||||
if salt.utils.platform.is_windows():
|
||||
socket_path = get_unused_localhost_port()
|
||||
else:
|
||||
socket_path = str(tmp_path / "noexist.ipc")
|
||||
subscriber = salt.utils.asynchronous.SyncWrapper(
|
||||
salt.transport.ipc.IPCMessageSubscriber, args=(puburi,), loop_kwarg="io_loop",
|
||||
salt.transport.ipc.IPCMessageSubscriber,
|
||||
args=(socket_path,),
|
||||
kwargs={"io_loop": io_loop},
|
||||
loop_kwarg="io_loop",
|
||||
)
|
||||
with pytest.raises(salt.ext.tornado.iostream.StreamClosedError):
|
||||
# Don't `await subscriber.connect()`, that's the purpose of the SyncWrapper
|
||||
subscriber.connect()
|
||||
|
|
Loading…
Add table
Reference in a new issue