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:
Kostas Kyrimis 2023-09-12 09:38:58 +03:00 committed by GitHub
parent 9fac9a7ace
commit 684bf97ce6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 10 deletions

View file

@ -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)

View file

@ -1 +0,0 @@
ACL SETUSER kostas ON >mypass +@WRONG

View file

@ -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()