mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Syndic's async request channel is actually async
This commit is contained in:
parent
ed9d866b62
commit
771abcb739
4 changed files with 29 additions and 1 deletions
1
changelog/64552.fixed.md
Normal file
1
changelog/64552.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Syndic's async_req_channel uses the asynchornous version of request channel
|
|
@ -3399,7 +3399,7 @@ class Syndic(Minion):
|
|||
# add handler to subscriber
|
||||
self.pub_channel.on_recv(self._process_cmd_socket)
|
||||
self.req_channel = salt.channel.client.ReqChannel.factory(self.opts)
|
||||
self.async_req_channel = salt.channel.client.ReqChannel.factory(self.opts)
|
||||
self.async_req_channel = salt.channel.client.AsyncReqChannel.factory(self.opts)
|
||||
|
||||
def _process_cmd_socket(self, payload):
|
||||
if payload is not None and payload["enc"] == "aes":
|
||||
|
|
|
@ -35,3 +35,21 @@ def master_opts(tmp_path):
|
|||
opts[name] = str(dirpath)
|
||||
opts["log_file"] = "logs/master.log"
|
||||
return opts
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def syndic_opts(tmp_path):
|
||||
"""
|
||||
Default master configuration with relative temporary paths to not require root permissions.
|
||||
"""
|
||||
root_dir = tmp_path / "syndic"
|
||||
opts = salt.config.DEFAULT_MINION_OPTS.copy()
|
||||
opts["syndic_master"] = "127.0.0.1"
|
||||
opts["__role"] = "minion"
|
||||
opts["root_dir"] = str(root_dir)
|
||||
for name in ("cachedir", "pki_dir", "sock_dir", "conf_dir"):
|
||||
dirpath = root_dir / name
|
||||
dirpath.mkdir(parents=True)
|
||||
opts[name] = str(dirpath)
|
||||
opts["log_file"] = "logs/syndic.log"
|
||||
return opts
|
||||
|
|
|
@ -1100,3 +1100,12 @@ async def test_master_type_disable(minion_opts):
|
|||
assert minion.connected is False
|
||||
finally:
|
||||
minion.destroy()
|
||||
|
||||
|
||||
async def test_syndic_async_req_channel(syndic_opts):
|
||||
syndic_opts["_minion_conf_file"] = ""
|
||||
syndic_opts["master_uri"] = "tcp://127.0.0.1:4506"
|
||||
syndic = salt.minion.Syndic(syndic_opts)
|
||||
syndic.pub_channel = MagicMock()
|
||||
syndic.tune_in_no_block()
|
||||
assert isinstance(syndic.async_req_channel, salt.channel.client.AsyncReqChannel)
|
||||
|
|
Loading…
Add table
Reference in a new issue