From 30943b834c617d61133a1e8ce43141d44611057d Mon Sep 17 00:00:00 2001 From: Shoham Elias Date: Thu, 8 Aug 2024 12:19:49 +0000 Subject: [PATCH] fix version check Signed-off-by: Shoham Elias --- python/python/tests/test_async_client.py | 5 ++++- python/python/tests/utils/utils.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/python/python/tests/test_async_client.py b/python/python/tests/test_async_client.py index 1355791016..28de53683e 100644 --- a/python/python/tests/test_async_client.py +++ b/python/python/tests/test_async_client.py @@ -413,7 +413,10 @@ async def test_info_server_replication(self, glide_client: TGlideClient): info_res = get_first_result(await glide_client.info([InfoSection.SERVER])) info = info_res.decode() assert "# Server" in info - cluster_mode = parse_info_response(info_res)["redis_mode"] + if not await check_if_server_version_lt(glide_client, "7.9.0"): + cluster_mode = parse_info_response(info_res)["server_mode"] + else: + cluster_mode = parse_info_response(info_res)["redis_mode"] expected_cluster_mode = isinstance(glide_client, GlideClusterClient) assert cluster_mode == "cluster" if expected_cluster_mode else "standalone" info = get_first_result( diff --git a/python/python/tests/utils/utils.py b/python/python/tests/utils/utils.py index 96f08a7b5a..faad71bc87 100644 --- a/python/python/tests/utils/utils.py +++ b/python/python/tests/utils/utils.py @@ -79,6 +79,9 @@ def get_random_string(length): async def check_if_server_version_lt(client: TGlideClient, min_version: str) -> bool: # TODO: change it to pytest fixture after we'll implement a sync client info_str = await client.info([InfoSection.SERVER]) + valkey_version = parse_info_response(info_str).get("server_version") + if valkey_version: + return version.parse(valkey_version) < version.parse(min_version) server_version = parse_info_response(info_str).get("redis_version") assert server_version is not None return version.parse(server_version) < version.parse(min_version)