mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix timeout test
This commit is contained in:
parent
529d27061e
commit
f6ad1a5f94
1 changed files with 6 additions and 17 deletions
|
@ -1480,20 +1480,9 @@ async def test_client_timeout_msg(minion_opts):
|
|||
client = salt.transport.zeromq.AsyncReqMessageClient(
|
||||
minion_opts, "tcp://127.0.0.1:4506"
|
||||
)
|
||||
assert hasattr(client, "_future")
|
||||
assert client._future is None
|
||||
future = salt.ext.tornado.concurrent.Future()
|
||||
client._future = future
|
||||
client.timeout_message(future)
|
||||
with pytest.raises(salt.exceptions.SaltReqTimeoutError):
|
||||
await future
|
||||
assert client._future is None
|
||||
|
||||
future_a = salt.ext.tornado.concurrent.Future()
|
||||
future_b = salt.ext.tornado.concurrent.Future()
|
||||
future_b.set_exception = MagicMock()
|
||||
client._future = future_a
|
||||
client.timeout_message(future_b)
|
||||
|
||||
assert client._future == future_a
|
||||
future_b.set_exception.assert_not_called()
|
||||
client.connect()
|
||||
try:
|
||||
with pytest.raises(salt.exceptions.SaltReqTimeoutError):
|
||||
await client.send({"meh": "bah"}, 1)
|
||||
finally:
|
||||
client.close()
|
||||
|
|
Loading…
Add table
Reference in a new issue