Skip to content

Commit

Permalink
fix version check
Browse files Browse the repository at this point in the history
Signed-off-by: Shoham Elias <shohame@amazon.com>
  • Loading branch information
shohamazon committed Aug 8, 2024
1 parent 3a93966 commit 1713afa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/python/tests/test_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions python/python/tests/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("valkey_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)
Expand Down

0 comments on commit 1713afa

Please sign in to comment.