Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Fix cross version persistence tests after 0.5.4 release #2501

Merged
merged 1 commit into from
Jul 11, 2024
Merged
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
13 changes: 11 additions & 2 deletions chromadb/test/property/test_cross_version_persist.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
from chromadb.config import Settings
from chromadb.api.client import Client as ClientCreator

MINIMUM_VERSION = "0.4.1"
# Minimum persisted version we support, and other substantial change versions
# 0.4.1 is the first version with persistence
# 0.5.3 is the first version with the new API where the serverapi and client api return types and arguments differ
BASELINE_VERSIONS = ["0.4.1", "0.5.3"]
version_re = re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+$")

# Some modules do not work across versions, since we upgrade our support for them, and should be explicitly reimported in the subprocess
Expand All @@ -36,7 +39,7 @@ def versions() -> List[str]:
# Older versions on pypi contain "devXYZ" suffixes
versions = [v for v in versions if version_re.match(v)]
versions.sort(key=packaging_version.Version)
return [MINIMUM_VERSION, versions[-1]]
return BASELINE_VERSIONS + [versions[-1]]


def _bool_to_int(metadata: Dict[str, Any]) -> Dict[str, Any]:
Expand Down Expand Up @@ -234,6 +237,12 @@ def persist_generated_data_with_old_version(
system.start()

api.reset()
# In 0.5.4 we changed the API of the server api level to
# deal with collection models instead of collections
# in order to work with this we need to wrap the api in a client
# for versions greater than or equal to 0.5.4
if packaging_version.Version(version) >= packaging_version.Version("0.5.4"):
api = old_module.api.client.Client.from_system(system)
coll = api.create_collection(
name=collection_strategy.name,
metadata=collection_strategy.metadata,
Expand Down
Loading