fix: test_acl_cat_commands_multi_exec_squash (#4492)

* add sleep in test

Signed-off-by: kostas <kostas@dragonflydb.io>
This commit is contained in:
Kostas Kyrimis 2025-01-22 11:15:25 +02:00 committed by GitHub
parent 4b8fa90a67
commit d44eec2285
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -190,12 +190,18 @@ async def test_acl_cat_commands_multi_exec_squash(df_factory):
res = await admin_client.execute_command("ACL SETUSER kk -@string")
assert res == "OK"
# We need to sleep because within dragonfly, we first reply to the client with
# "OK" and then we stream the update to proactor threads. The reason for this,
# are some connections might need to be evicted, so we first need to reply before
# we actually do that. Between those steps, there is a small window that the
# EXEC below might succeed.
await asyncio.sleep(1)
res = await client.execute_command("EXEC")
# TODO(we need to fix this, basiscally SQUASHED/MULTI transaction commands
# return multiple errors for each command failed. Since the nature of the error
# is the same, that a rule has changed we should squash those error messages into
# one.
logging.debug(f"Result is: {res}")
assert res[0].args[0] == "kk ACL rules changed between the MULTI and EXEC", res
await admin_client.aclose()