Files
lancedb/ci/tests/test_extract_sdk_doc_links.py
T
George KhananaevandXuanwo ec230318f6 fix: point the compaction warning at the current docs page (#4913)
Refs #4371

The link checker flags
`https://docs.lancedb.com/performance#compaction-and-cleanup` because
that section no longer exists. Compaction has its own page now, and its
"When to run it" section (`#when`) covers the warning this link is
attached to: tables with many small fragments.

This points `DocLink::Compaction` at `/maintenance/compaction#when` and
updates the two tests that hard-code the URL. The anchor exists on the
published site and in `docs/web/maintenance/compaction.mdx`, so
`test_all_doc_links_resolve_in_repo_docs` still holds.

Tests: `python -m unittest ci.tests.test_extract_sdk_doc_links` and
`cargo test -p lancedb --lib docs::tests::` pass locally.

Co-authored-by: Xuanwo <github@xuanwo.io>
2026-12-01 22:09:04 +08:00

48 lines
1.4 KiB
Python

# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright The LanceDB Authors
from pathlib import Path
import sys
from tempfile import TemporaryDirectory
import unittest
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
from ci.extract_sdk_doc_links import extract_doc_links, main
class TestExtractSdkDocLinks(unittest.TestCase):
def test_extracts_all_links_from_repo_docs_rs(self) -> None:
urls = extract_doc_links()
self.assertIn(
"https://docs.lancedb.com/maintenance/compaction#when",
urls,
)
self.assertIn(
"https://docs.lancedb.com/indexing/reindexing#incremental-reindexing",
urls,
)
self.assertIn(
"https://docs.lancedb.com/search/sql",
urls,
)
self.assertIn(
"https://docs.lancedb.com/basics/embedded-vs-enterprise",
urls,
)
def test_cli_writes_markdown(self) -> None:
with TemporaryDirectory() as tmp:
out = Path(tmp) / "sdk-links.md"
rc = main(["--output", str(out)])
self.assertEqual(rc, 0)
content = out.read_text(encoding="utf-8")
self.assertIn(
"<https://docs.lancedb.com/maintenance/compaction#when>",
content,
)
if __name__ == "__main__":
unittest.main()