Skip to content

Commit 9314e5f

Browse files
fix module version check for from_existing
1 parent f808b80 commit 9314e5f

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

redisvl/index/index.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,10 @@ def from_existing(
354354

355355
# Validate modules
356356
installed_modules = RedisConnectionFactory.get_modules(redis_client)
357-
validate_modules(installed_modules, [{"name": "search", "ver": 20810}])
357+
validate_modules(
358+
installed_modules,
359+
[{"name": "search", "ver": 20810}, {"name": "searchlight", "ver": 20810}]
360+
)
358361

359362
# Fetch index info and convert to schema
360363
index_info = cls._info(name, redis_client)
@@ -860,7 +863,10 @@ async def from_existing(
860863

861864
# Validate modules
862865
installed_modules = await RedisConnectionFactory.get_modules_async(redis_client)
863-
validate_modules(installed_modules, [{"name": "search", "ver": 20810}])
866+
validate_modules(
867+
installed_modules,
868+
[{"name": "search", "ver": 20810}, {"name": "searchlight", "ver": 20810}]
869+
)
864870

865871
# Fetch index info and convert to schema
866872
index_info = await cls._info(name, redis_client)

tests/integration/test_connection.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def test_convert_index_info_to_schema():
102102
assert schema.index.name == index_info["index_name"]
103103

104104

105-
def test_validate_modules_exist():
105+
def test_validate_modules_exist_search():
106106
validate_modules(
107107
installed_modules={"search": 20811},
108108
required_modules=[
@@ -112,6 +112,16 @@ def test_validate_modules_exist():
112112
)
113113

114114

115+
def test_validate_modules_exist_searchlight():
116+
validate_modules(
117+
installed_modules={"searchlight": 20819},
118+
required_modules=[
119+
{"name": "search", "ver": 20810},
120+
{"name": "searchlight", "ver": 20810},
121+
],
122+
)
123+
124+
115125
def test_validate_modules_not_exist():
116126
with pytest.raises(ValueError):
117127
validate_modules(

0 commit comments

Comments
 (0)