test: AlloyDB - increase unit tests coverage - #3799
Draft
julian-risch wants to merge 1 commit into
Draft
Conversation
Contributor
Coverage report (alloydb)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||
Cover the code paths that were only reachable through the integration-marked tests, which the unit coverage badge excludes. Twelve SQL builders had no test reference at all, even though they return psycopg Composed objects and need no database. They are now asserted on the SQL they render, using the _render helper the filter tests already use: - table creation, HNSW index creation for every vector function and its build parameters, and the insert statement for every DuplicatePolicy - the count, count-distinct, min/max and unique-values queries, including pagination, the ILIKE search term, and why the unique-values query uses -> rather than ->> so numbers sort numerically - the keyword and embedding retrieval queries, including the score operator each vector function uses, and the three rejections in _check_and_build_embedding_retrieval_query of which only one was covered - the result post-processors and the metadata type inference filters.py gains the scalar comparison operators: >, >=, <, <= with their ISO date handling and type rejections, in/not in, and like/not like. The not-in test pins the IS NULL clause that keeps rows missing the field. The database-facing methods run against a mocked connection and cursor, asserting the SQL and parameters handed to execute. A second fixture patches only _ensure_db_setup, so _initialize_table, delete_table and _handle_hnsw — which the shared mock_store fixture patches away — are exercised too, including the warning when an HNSW index already exists. Both retrievers' run methods and AlloyDBKeywordRetriever.from_dict, which had no test, are covered with a mocked store. _ensure_db_setup is deliberately left to the integration tests. Unit coverage: 42% -> 91%. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
julian-risch
force-pushed
the
test/alloydb-unit-coverage
branch
from
August 18, 2026 09:26
98d569f to
467d6d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Proposed Changes:
filters.py(>,>=,<,<=,in,not in,like,not like) andAlloyDBKeywordRetriever.from_dict, which had no test._ensure_db_setup, so_initialize_table,delete_tableand_handle_hnsw— which the sharedmock_storefixture patches away — are exercised too.How did you test it?
Notes for the reviewer
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.