test(spanner): add location router finder golden tests and centralize textproto test utils - #6482
test(spanner): add location router finder golden tests and centralize textproto test utils#6482olavloite wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request consolidates and refactors the textproto parsing utilities for Spanner golden tests into a shared helper module (textproto_test_utils.rs), removing duplicate parsing code from key_range_cache/golden_tests.rs and key_recipe/golden_tests.rs. It also introduces a new set of golden conformance tests for the location router (location_router/golden_tests.rs). The review feedback suggests improving null value handling in the newly introduced parsing helpers: specifically, adding support for null_value: NULL_VALUE in parse_constant_value and allowing serde_json::Value::Null in query_params_to_target_range to prevent premature termination of key encoding.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6482 +/- ##
==========================================
+ Coverage 96.37% 96.39% +0.01%
==========================================
Files 297 297
Lines 84017 85828 +1811
==========================================
+ Hits 80971 82731 +1760
- Misses 3046 3097 +51 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
… textproto test utils - Add golden conformance test suite for `finder_test.textproto` (36 test cases, 203 request events) validating query key encoding, range cache lookups, server selection, and routing hints. - Centralize all golden test fixtures and parsers (`recipe_test`, `cache_test`, `finder_test`) into `textproto_test_utils.rs`. - Add `unescape_bytes` support for hex `\xHH` sequences and standard C escapes. - Introduce reusable `skip_block` helper and decouple nested list value parsing. - Tighten golden routing hint assertions with strict struct equality, verifying `skipped_tablet_uid` and per-event unhealthy server isolation matching Java and Go reference implementations.
b98507a to
bc7b235
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request consolidates textproto parsing logic from multiple golden test files into a shared utility module, textproto_test_utils.rs, while adding support for hex escape sequences and comprehensive unit tests. It also introduces a new golden conformance test suite for the location router. The review feedback highlights opportunities to optimize performance by avoiding unnecessary vector clones in location_router/golden_tests.rs and suggests enhancing parse_constant_value in textproto_test_utils.rs to support parsing float values.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request consolidates and refactors the textproto parsing logic for Spanner golden tests into a shared utility module (textproto_test_utils.rs), eliminating duplicated parsing code across key_range_cache and key_recipe tests. It also introduces a new suite of golden conformance tests for the location_router finder. Feedback on the new tests highlights several robustness issues: encode_single_value_part should parse string values into their correct types (like Bool or Float64) based on the part's type code to prevent encoding failures, and multiple instances of encode_into have ignored Result values which violates the style guide rule against swallowing errors.
845e8c0 to
edffc1d
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request consolidates and refactors textproto parsing utilities for Spanner golden tests into a shared textproto_test_utils module, reducing code duplication across test suites. It also introduces golden conformance tests for the LocationRouter. Feedback on the changes highlights that the query_params_to_target_range helper in the new location router tests does not support STRUCT parameters, which are represented as JSON arrays, and provides a code suggestion to resolve nested struct fields using part.struct_identifiers.
edffc1d to
7884306
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the Spanner routing golden tests by consolidating duplicate textproto parsing logic from key_range_cache/golden_tests.rs and key_recipe/golden_tests.rs into a centralized helper module textproto_test_utils.rs. It also introduces a new suite of golden conformance tests for the LocationRouter under location_router/golden_tests.rs using a TestFinder harness. I have no feedback to provide as there are no review comments.
finder_test.textproto(36 test cases, 203 request events) validating query key encoding, range cache lookups, server selection, and routing hints.recipe_test,cache_test,finder_test) intotextproto_test_utils.rs.unescape_bytessupport for hex\xHHsequences and standard C escapes.skip_blockhelper and decouple nested list value parsing.skipped_tablet_uidand per-event unhealthy server isolation matching Java and Go reference implementations.