Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.2.20]

* **fix: Prevent weaviate cloud precheck from passing with invalid config**

## [1.2.19]

* **fix: Pinned aibotocore to skip version that's incompatible with recent botocore version**
Expand Down
24 changes: 22 additions & 2 deletions test/integration/connectors/weaviate/test_cloud.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import pytest

from test.integration.connectors.utils.constants import DESTINATION_TAG, VECTOR_DB_TAG
from unstructured_ingest.error import ValueError
from unstructured_ingest.error import DestinationConnectionError
from unstructured_ingest.error import ValueError as IngestValueError
from unstructured_ingest.processes.connectors.weaviate.cloud import (
CONNECTOR_TYPE,
CloudWeaviateAccessConfig,
CloudWeaviateConnectionConfig,
CloudWeaviateUploader,
CloudWeaviateUploaderConfig,
)


@pytest.mark.tags(CONNECTOR_TYPE, DESTINATION_TAG, VECTOR_DB_TAG)
def test_weaviate_failing_connection_config():
with pytest.raises(ValueError):
with pytest.raises(IngestValueError):
CloudWeaviateConnectionConfig(
access_config=CloudWeaviateAccessConfig(api_key="my key", password="password"),
username="username",
Expand All @@ -37,3 +40,20 @@ def test_weaviate_connection_config_anonymous():
anonymous=True,
cluster_url="clusterurl",
)


@pytest.mark.tags(CONNECTOR_TYPE, DESTINATION_TAG, VECTOR_DB_TAG)
def test_weaviate_precheck_invalid_credentials():
"""Test that precheck properly validates connection with invalid credentials."""
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring states 'invalid credentials', but the test includes an invalid cluster_url as well. Update the docstring to reflect the scenario (e.g., 'invalid configuration or unreachable cluster') or modify the test to isolate invalid-credential behavior.

Suggested change
"""Test that precheck properly validates connection with invalid credentials."""
"""Test that precheck properly validates connection failures due to invalid configuration or unreachable cluster."""

Copilot uses AI. Check for mistakes.

connection_config = CloudWeaviateConnectionConfig(
access_config=CloudWeaviateAccessConfig(api_key="invalid-test-key-12345"),
cluster_url="https://invalid-test-cluster.weaviate.cloud",
anonymous=False,
)
upload_config = CloudWeaviateUploaderConfig(collection=None)
uploader = CloudWeaviateUploader(
connection_config=connection_config,
upload_config=upload_config,
)
with pytest.raises(DestinationConnectionError):
uploader.precheck()
2 changes: 1 addition & 1 deletion unstructured_ingest/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.2.19" # pragma: no cover
__version__ = "1.2.20" # pragma: no cover
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ def _collection_exists(self, collection_name: Optional[str] = None):

def precheck(self) -> None:
try:
self.connection_config.get_client()
with self.connection_config.get_client():
# Connection test successful - client is available but not needed
pass

# only if collection name populated should we check that it exists
if self.upload_config.collection and not self._collection_exists():
raise DestinationConnectionError(
Expand Down
Loading