|
48 | 48 | WeaviateUnsupportedFeatureError, |
49 | 49 | ) |
50 | 50 | from integration.conftest import retry_on_http_error |
| 51 | +from weaviate.util import _ServerVersion |
| 52 | + |
| 53 | + |
| 54 | +def _expected_async_enabled(version: _ServerVersion, factor: int) -> bool: |
| 55 | + """Whether the server reports async replication as enabled for a collection. |
| 56 | +
|
| 57 | + Up to 1.38 the server stores whatever `async_enabled` the collection was created with. From |
| 58 | + 1.39 it ignores that and derives the field as `factor > 1 and not globally disabled` instead, |
| 59 | + so a collection with a single replica always reports `False`. |
| 60 | + """ |
| 61 | + if version.is_at_least(1, 39, 0): |
| 62 | + return factor > 1 |
| 63 | + return version.is_at_least(1, 26, 0) |
51 | 64 |
|
52 | 65 |
|
53 | 66 | @pytest.fixture(scope="module") |
@@ -353,10 +366,9 @@ def test_collection_config_full(collection_factory: CollectionFactory) -> None: |
353 | 366 | assert config.multi_tenancy_config.auto_tenant_creation is False |
354 | 367 |
|
355 | 368 | assert config.replication_config.factor == 1 |
356 | | - if collection._connection._weaviate_version.is_at_least(1, 26, 0): |
357 | | - assert config.replication_config.async_enabled is True |
358 | | - else: |
359 | | - assert config.replication_config.async_enabled is False |
| 369 | + assert config.replication_config.async_enabled is _expected_async_enabled( |
| 370 | + collection._connection._weaviate_version, factor=1 |
| 371 | + ) |
360 | 372 |
|
361 | 373 | if collection._connection._weaviate_version.is_at_least(1, 24, 25): |
362 | 374 | assert ( |
@@ -1605,7 +1617,9 @@ def test_replication_config_with_async_config(collection_factory: CollectionFact |
1605 | 1617 | ) |
1606 | 1618 | config = collection.config.get() |
1607 | 1619 | assert config.replication_config.factor == 1 |
1608 | | - assert config.replication_config.async_enabled is True |
| 1620 | + assert config.replication_config.async_enabled is _expected_async_enabled( |
| 1621 | + collection._connection._weaviate_version, factor=1 |
| 1622 | + ) |
1609 | 1623 | assert config.replication_config.async_config is not None |
1610 | 1624 | ac = config.replication_config.async_config |
1611 | 1625 | assert ac.propagation_concurrency == 4 |
@@ -1672,7 +1686,9 @@ def test_replication_config_remove_async_config(collection_factory: CollectionFa |
1672 | 1686 | ), |
1673 | 1687 | ) |
1674 | 1688 | config = collection.config.get() |
1675 | | - assert config.replication_config.async_enabled is True |
| 1689 | + assert config.replication_config.async_enabled is _expected_async_enabled( |
| 1690 | + collection._connection._weaviate_version, factor=1 |
| 1691 | + ) |
1676 | 1692 | assert config.replication_config.async_config is None |
1677 | 1693 | assert config.replication_config.factor == 1 |
1678 | 1694 |
|
|
0 commit comments