mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
fix(AclFamily): move acl test files to pytest (#1843)
* Fixes broken release build * Moves acl test files to acl pytest
This commit is contained in:
parent
9fac9a7ace
commit
684bf97ce6
4 changed files with 14 additions and 10 deletions
|
@ -89,6 +89,3 @@ add_dependencies(check_dfly dragonfly_test json_family_test list_family_test
|
|||
redis_parser_test snapshot_test stream_family_test string_family_test
|
||||
bitops_family_test set_family_test zset_family_test hll_family_test
|
||||
cluster_config_test cluster_family_test user_registry_test)
|
||||
|
||||
configure_file(acl/test/wrong.acl ${CMAKE_BINARY_DIR}/wrong.acl COPYONLY)
|
||||
configure_file(acl/test/ok.acl ${CMAKE_BINARY_DIR}/ok.acl COPYONLY)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
ACL SETUSER kostas ON >mypass +@WRONG
|
|
@ -3,6 +3,7 @@ import redis
|
|||
from redis import asyncio as aioredis
|
||||
from . import DflyInstanceFactory
|
||||
from .utility import disconnect_clients
|
||||
import tempfile
|
||||
import asyncio
|
||||
import os
|
||||
from . import dfly_args
|
||||
|
@ -229,11 +230,19 @@ async def test_acl_with_long_running_script(df_server):
|
|||
await admin_client.close()
|
||||
|
||||
|
||||
def create_temp_file(content, tmp_dir):
|
||||
file = tempfile.NamedTemporaryFile(mode="w", dir=tmp_dir, delete=False)
|
||||
acl = os.path.join(tmp_dir, file.name)
|
||||
file.write(content)
|
||||
file.flush()
|
||||
return acl
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@dfly_args({"port": 1111})
|
||||
async def test_bad_acl_file(df_local_factory):
|
||||
path = df_local_factory.params.path
|
||||
acl = os.path.join(os.path.dirname(path), "wrong.acl")
|
||||
async def test_bad_acl_file(df_local_factory, tmp_dir):
|
||||
acl = create_temp_file("ACL SETUSER kostas ON >mypass +@WRONG", tmp_dir)
|
||||
|
||||
df = df_local_factory.create(aclfile=acl)
|
||||
|
||||
df.start()
|
||||
|
@ -248,9 +257,8 @@ async def test_bad_acl_file(df_local_factory):
|
|||
|
||||
@pytest.mark.asyncio
|
||||
@dfly_args({"port": 1111})
|
||||
async def test_good_acl_file(df_local_factory):
|
||||
path = df_local_factory.params.path
|
||||
acl = os.path.join(os.path.dirname(path), "ok.acl")
|
||||
async def test_good_acl_file(df_local_factory, tmp_dir):
|
||||
acl = create_temp_file("", tmp_dir)
|
||||
df = df_local_factory.create(aclfile=acl)
|
||||
|
||||
df.start()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue