Repository navigation
test: introduce jetCheck property-based testing - #284
Merged
Merged
Conversation
Long.parseLong let a NumberFormatException escape LibsqlUrlParser.parse for a non-numeric connectTimeout or busyTimeout. A property test found the empty-query-value case. Wrap the conversion so the JDBC boundary reports a SQLException with the parameter name and keeps the cause.
Pin org.jetbrains:jetCheck 0.3.0 and declare it test-scoped in the JDBC and Hrana codec modules. It stays out of runtime and shaded artifacts.
The USER_INFO pattern removed only the first user:pass@ segment, so a URL such as http://user:pass@user:pass@host kept a credential in the result of a second redaction. Consume through the last @ before the path, query or fragment instead. A property test found the case.
Cover the statement splitter, SQLite text conversions, URL parsing, metadata text, the two Hrana JSON codecs, and the connection transaction lifecycle. The lifecycle suite uses jetCheck's ImperativeCommand scenario support, so command generation, replay, shrinking and the failure log belong to the library. jetCheck has no 64-bit or array generator, so the suites compose a long from two ints and map lists to byte arrays. Text generators stay on BMP code points because jetCheck's string generator is char-based; supplementary text is covered by constants.
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.
Description
Introduce jetCheck 0.3.0 as the property-based testing library for the unit lanes. The pilot covers six seams that the recent refactors extracted:
ImperativeCommandscenario;jetCheck was chosen over QuickTheories because it has first-class stateful testing, an active release history (0.3.0, 2026), and
rechecking(...)reproduction tokens. The comparison and suite conventions are documented indocs/property-based-testing.md.The properties found two defects, both fixed here with named regression tests:
LibsqlUrlParserleaked aNumberFormatExceptionfor a non-numericconnectTimeoutorbusyTimeout.metadataUrlremoved only the firstuser:pass@segment, so repeated user info was not fully redacted and redaction was not idempotent.The malformed declared-precision case (
DECIMAL(abc)) is left unchanged becauseLibsqlResultSetMetaDataTestcurrently pins theNumberFormatException. The property generator is restricted to valid declared text, and the decision is recorded in the doc.No tracking issue; this is a testing-infrastructure spike rather than a feature.
Type of Change
Checklist
./mvnw spotless:check)../mvnw clean verify).Verification
DOCKER_CONFIG="$PWD/libsql-conformance/src/test/docker-config" ./mvnw clean verify— BUILD SUCCESS, including the unit, integration and conformance lanes../mvnw spotless:check— BUILD SUCCESS.Follow-ups
These are intentionally out of scope for this PR and recorded in the doc:
JdbcValueConverter;