mirror of
https://github.com/lancedb/lancedb.git
synced 2026-05-24 15:30:38 +00:00
test: ignore latest_version_hint.json in manifest dir assertions
Lance v7.0.0-rc.1 writes _versions/latest_version_hint.json on non-lexically-ordered stores (e.g. the local filesystem) to speed up latest-version lookup. The V2-manifest-path tests iterate the whole _versions directory and asserted every entry matches the manifest filename pattern; filter to *.manifest files so the hint file is ignored. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -450,6 +450,13 @@ async def test_create_exist_ok_async(tmp_db_async: lancedb.AsyncConnection):
|
||||
# await db.create_table("test", schema=bad_schema, exist_ok=True)
|
||||
|
||||
|
||||
def _manifest_files(versions_dir):
|
||||
# The `_versions` directory may also contain `latest_version_hint.json`,
|
||||
# which Lance writes on non-lexically-ordered stores (e.g. the local
|
||||
# filesystem) to speed up latest-version lookup. Only assert on manifests.
|
||||
return [f for f in os.listdir(versions_dir) if f.endswith(".manifest")]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_table_v2_manifest_paths_async(tmp_path):
|
||||
db_with_v2_paths = await lancedb.connect_async(
|
||||
@@ -465,7 +472,7 @@ async def test_create_table_v2_manifest_paths_async(tmp_path):
|
||||
)
|
||||
assert await tbl.uses_v2_manifest_paths()
|
||||
manifests_dir = tmp_path / "test_v2_manifest_paths.lance" / "_versions"
|
||||
for manifest in os.listdir(manifests_dir):
|
||||
for manifest in _manifest_files(manifests_dir):
|
||||
assert re.match(r"\d{20}\.manifest", manifest)
|
||||
|
||||
# Start a table in V1 mode then migrate
|
||||
@@ -475,13 +482,13 @@ async def test_create_table_v2_manifest_paths_async(tmp_path):
|
||||
)
|
||||
assert not await tbl.uses_v2_manifest_paths()
|
||||
manifests_dir = tmp_path / "test_v2_migration.lance" / "_versions"
|
||||
for manifest in os.listdir(manifests_dir):
|
||||
for manifest in _manifest_files(manifests_dir):
|
||||
assert re.match(r"\d\.manifest", manifest)
|
||||
|
||||
await tbl.migrate_manifest_paths_v2()
|
||||
assert await tbl.uses_v2_manifest_paths()
|
||||
|
||||
for manifest in os.listdir(manifests_dir):
|
||||
for manifest in _manifest_files(manifests_dir):
|
||||
assert re.match(r"\d{20}\.manifest", manifest)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user