|
21 | 21 |
|
22 | 22 | collection_st = st.shared(strategies.collections(with_hnsw_params=True), key="coll")
|
23 | 23 |
|
| 24 | +@given( |
| 25 | + collection=collection_st, |
| 26 | + record_set=strategies.recordsets(collection_st, min_size=1, max_size=5), |
| 27 | +) |
| 28 | +@settings( |
| 29 | + deadline=None, |
| 30 | + parent=override_hypothesis_profile( |
| 31 | + normal=hypothesis.settings(max_examples=500), |
| 32 | + fast=hypothesis.settings(max_examples=200), |
| 33 | + ), |
| 34 | + max_examples=2 |
| 35 | +) |
| 36 | +def test_add_miniscule( |
| 37 | + client: ClientAPI, |
| 38 | + collection: strategies.Collection, |
| 39 | + record_set: strategies.RecordSet, |
| 40 | +) -> None: |
| 41 | + if ( |
| 42 | + client.get_settings().chroma_api_impl |
| 43 | + == "chromadb.api.async_fastapi.AsyncFastAPI" |
| 44 | + ): |
| 45 | + pytest.skip( |
| 46 | + "TODO @jai, come back and debug why CI runners fail with async + sync" |
| 47 | + ) |
| 48 | + _test_add(client, collection, record_set, True, always_compact=True) |
| 49 | + |
24 | 50 |
|
25 | 51 | # Hypothesis tends to generate smaller values so we explicitly segregate the
|
26 | 52 | # the tests into tiers, Small, Medium. Hypothesis struggles to generate large
|
@@ -104,6 +130,7 @@ def _test_add(
|
104 | 130 | record_set: strategies.RecordSet,
|
105 | 131 | should_compact: bool,
|
106 | 132 | batch_ann_accuracy: bool = False,
|
| 133 | + always_compact: bool = False, |
107 | 134 | ) -> None:
|
108 | 135 | create_isolated_database(client)
|
109 | 136 |
|
@@ -132,7 +159,7 @@ def _test_add(
|
132 | 159 | if (
|
133 | 160 | not NOT_CLUSTER_ONLY
|
134 | 161 | and should_compact
|
135 |
| - and len(normalized_record_set["ids"]) > 10 |
| 162 | + and (len(normalized_record_set["ids"]) > 10 or always_compact) |
136 | 163 | ):
|
137 | 164 | # Wait for the model to be updated
|
138 | 165 | wait_for_version_increase(client, collection.name, initial_version)
|
|
0 commit comments