diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 365349409..d5fc6d084 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -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) diff --git a/src/server/acl/test/ok.acl b/src/server/acl/test/ok.acl deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/server/acl/test/wrong.acl b/src/server/acl/test/wrong.acl deleted file mode 100644 index 812bbc38d..000000000 --- a/src/server/acl/test/wrong.acl +++ /dev/null @@ -1 +0,0 @@ -ACL SETUSER kostas ON >mypass +@WRONG diff --git a/tests/dragonfly/acl_family_test.py b/tests/dragonfly/acl_family_test.py index 649aeb42d..797de4836 100644 --- a/tests/dragonfly/acl_family_test.py +++ b/tests/dragonfly/acl_family_test.py @@ -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()