|
12 | 12 | import pytest
|
13 | 13 |
|
14 | 14 | # qdrant-Lite; See: https://qdrant.io/docs/qdrant_lite.md
|
15 |
| -from qdrant_client import QdrantClient |
| 15 | +from qdrant_client import QdrantClient, models |
16 | 16 |
|
17 | 17 | from wurzel.exceptions import StepFailed
|
18 | 18 | from wurzel.step_executor import BaseStepExecutor
|
@@ -95,6 +95,46 @@ def test_qdrant_collection_retirement(
|
95 | 95 | )
|
96 | 96 |
|
97 | 97 |
|
| 98 | +def test_qdrant_get_collections_with_ephemerals( |
| 99 | + input_output_folder: Tuple[Path, Path], env, dummy_collection |
| 100 | +): |
| 101 | + input_path, output_path = input_output_folder |
| 102 | + HIST_LEN = 3 |
| 103 | + env.set("COLLECTION_HISTORY_LEN", str(HIST_LEN)) |
| 104 | + env.set("COLLECTION", "tenant1-dev") |
| 105 | + input_file = input_path / "qdrant_at.csv" |
| 106 | + shutil.copy("./tests/data/embedded.csv", input_file) |
| 107 | + client = QdrantClient(location=":memory:") |
| 108 | + { |
| 109 | + client.create_collection( |
| 110 | + coll, |
| 111 | + vectors_config=models.VectorParams( |
| 112 | + size=100, distance=models.Distance.COSINE |
| 113 | + ), |
| 114 | + ) |
| 115 | + for coll in [ |
| 116 | + "tenant1-dev_v1", |
| 117 | + "tenant1-dev_v2", |
| 118 | + "tenant1-dev_v3", |
| 119 | + "tenant1-dev-feature-abc_v1", |
| 120 | + ] |
| 121 | + } |
| 122 | + |
| 123 | + client.close = print |
| 124 | + with unittest.mock.patch("wurzel.steps.qdrant.step.QdrantClient") as mock: |
| 125 | + mock.return_value = client |
| 126 | + step = QdrantConnectorStep() |
| 127 | + result = step._get_collection_versions() |
| 128 | + assert len(result) == 3 |
| 129 | + assert set(result.keys()) == {1, 2, 3} |
| 130 | + |
| 131 | + env.set("COLLECTION", "tenant1-dev-feature-abc") |
| 132 | + step = QdrantConnectorStep() |
| 133 | + result = step._get_collection_versions() |
| 134 | + assert len(result) == 1 |
| 135 | + assert set(result.keys()) == {1} |
| 136 | + |
| 137 | + |
98 | 138 | def test_qdrant_connector_csv_partially_not_same_shape(
|
99 | 139 | input_output_folder: Tuple[Path, Path],
|
100 | 140 | ):
|
|
0 commit comments