test: add unit tests for utility classes#416
test: add unit tests for utility classes#416LuciferYang wants to merge 3 commits intolance-format:mainfrom
Conversation
hamersaw
left a comment
There was a problem hiding this comment.
It looks like the majority of these tests are essentially "x=10; assertTrue(isXTen(x))". It doesn't feel like there is a great deal of added value, the regressions would occur if upstream began setting X to something else, which we really can't test. I'm wondering if there's a better way to detect these kinds of issues.
Addresses review feedback on PR lance-format#416: positive-match tests that used the util's own constants on both sides ("x=KEY; assertTrue(isKey(x))") were pure tautologies. - Drop the `*Valid` tests from BlobUtilsTest and LargeVarCharUtilsTest; the `CaseInsensitive` tests already cover the positive path with a non-tautological literal input. - Replace constant references in test inputs with string literals (`"lance-encoding:blob"`, `"arrow:large-var-char"`, `"arrow.fixed-size-list.size"`) so a rename of the production constant breaks the test. - Fix `testCreateVectorSizePropertyKey` to use a hardcoded expected literal instead of concatenating the constant. Upstream-convention drift remains an integration-test concern (BaseBlobCreateTableTest, SchemaConverterTest, LanceArrowUtilsSuite), noted in the updated class javadocs.
|
@hamersaw Fair point — pushed 5b8bb14 trimming this:
58 tests total, all pass locally. Javadoc on each class now notes that upstream-convention drift is the integration layer's job — Let me know if this is the direction you had in mind, or if you'd rather drop the unit tests entirely and lean on the integration coverage. |
Addresses review feedback on PR lance-format#416: positive-match tests that used the util's own constants on both sides ("x=KEY; assertTrue(isKey(x))") were pure tautologies. - Drop the `*Valid` tests from BlobUtilsTest and LargeVarCharUtilsTest; the `CaseInsensitive` tests already cover the positive path with a non-tautological literal input. - Replace constant references in test inputs with string literals (`"lance-encoding:blob"`, `"arrow:large-var-char"`, `"arrow.fixed-size-list.size"`) so a rename of the production constant breaks the test. - Fix `testCreateVectorSizePropertyKey` to use a hardcoded expected literal instead of concatenating the constant. Upstream-convention drift remains an integration-test concern (BaseBlobCreateTableTest, SchemaConverterTest, LanceArrowUtilsSuite), noted in the updated class javadocs.
5b8bb14 to
75ec172
Compare
Summary
BlobUtils,LargeVarCharUtils,Utils, andVectorUtilscovering all reachable branches in both Spark and Arrow field-checking methodsUtilsTesthelper buildsZonedDateTimedirectly instead of re-implementing the production micros-to-Instant conversion, keeping test logic independent from source logicTest coverage details
BlobUtilsisBlobSparkField,isBlobArrowFieldLargeVarCharUtilsisLargeVarCharSparkField,isLargeVarCharArrowField,createPropertyKeyUtilsparseVersion,findVersionVectorUtilsisVectorField,getVectorDimension,isVectorArrowField,getVectorArrowDimension,shouldBeFixedSizeList,createVectorSizePropertyKeyTest plan
mvn test -pl lance-spark-base_2.12 -Dtest="org.lance.spark.utils.*Test"— 108 tests pass