Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
kostasrim committed Sep 1, 2023
1 parent eade57e commit 12ff002
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/dragonfly/acl_family_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from redis import asyncio as aioredis
from . import DflyInstanceFactory
from .utility import disconnect_clients
import asyncio


@pytest.mark.asyncio
Expand Down Expand Up @@ -216,3 +217,33 @@ async def test_acl_deluser(df_server):
await client.execute_command("EXEC")

await admin_client.close()


script = """
for i = 1, 10000 do
redis.call('SET', 'key', i)
redis.call('SET', 'key1', i)
redis.call('SET', 'key2', i)
redis.call('SET', 'key3', i)
end
"""


@pytest.mark.asyncio
async def test_acl_del_user_while_running_lua_script(df_server):
client = aioredis.Redis(port=df_server.port)
await client.execute_command("ACL SETUSER kostas ON >kk +@string +@scripting")
await client.execute_command("AUTH kostas kk")
admin_client = aioredis.Redis(port=df_server.port)

with pytest.raises(redis.exceptions.ConnectionError):
await asyncio.gather(
client.eval(script, 4, "key", "key1", "key2", "key3"),
admin_client.execute_command("ACL DELUSER kostas"),
)

for i in range(1, 4):
res = await admin_client.get(f"key{i}")
assert res == b"10000"

await admin_client.close()

0 comments on commit 12ff002

Please sign in to comment.