Skip to content

Commit 507ba0e

Browse files
committed
test: test invalid client settings are ignored
1 parent 5da117e commit 507ba0e

2 files changed

Lines changed: 7 additions & 13 deletions

File tree

integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,7 @@ def _ensure_initialized(self):
114114
# Use dict to conditionally pass settings because Chroma doesn't accept settings=None
115115
client_kwargs: dict[str, Any] = {}
116116
if self._client_settings:
117-
try:
118-
client_kwargs["settings"] = Settings(**self._client_settings)
119-
except ValueError as e:
120-
msg = f"Invalid client_settings ({self._client_settings}): {e}"
121-
raise ValueError(msg) from e
117+
client_kwargs["settings"] = Settings(**self._client_settings)
122118

123119
if self._host and self._port is not None:
124120
# Remote connection via HTTP client
@@ -170,11 +166,7 @@ async def _ensure_initialized_async(self):
170166
# Use dict to conditionally pass settings because Chroma doesn't accept settings=None
171167
client_kwargs: dict[str, Any] = {}
172168
if self._client_settings:
173-
try:
174-
client_kwargs["settings"] = Settings(**self._client_settings)
175-
except ValueError as e:
176-
msg = f"Invalid client_settings ({self._client_settings}): {e}"
177-
raise ValueError(msg) from e
169+
client_kwargs["settings"] = Settings(**self._client_settings)
178170

179171
client = await chromadb.AsyncHttpClient(
180172
host=self._host,

integrations/chroma/tests/test_document_store.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,17 @@ def test_client_settings_applied(self, clear_chroma_system_cache):
124124
store._ensure_initialized()
125125
assert store._client.get_settings().anonymized_telemetry is False
126126

127-
def test_invalid_client_settings(self, clear_chroma_system_cache):
127+
def test_invalid_client_settings_are_ignored(self, clear_chroma_system_cache):
128128
store = ChromaDocumentStore(
129129
client_settings={
130130
"invalid_setting_name": "some_value",
131131
"another_fake_setting": 123,
132132
}
133133
)
134-
with pytest.raises(ValueError, match="Invalid client_settings"):
135-
store._ensure_initialized()
134+
store._ensure_initialized()
135+
settings = store._client.get_settings()
136+
assert not hasattr(settings, "invalid_setting_name")
137+
assert not hasattr(settings, "another_fake_setting")
136138

137139
def test_to_dict(self, request):
138140
ds = ChromaDocumentStore(

0 commit comments

Comments
 (0)