Repository navigation
test(jdbc): pin attached schema, date time, and savepoint edges - #215
Merged
Merged
Conversation
Characterization tests for the four unpinned behaviors in the JDBC refactor Wave 0: - attached-schema table metadata through pragma_database_list - date/time text tails (offset, Z, bare time) and BLOB rejection - duplicate savepoint names and releasing the outermost savepoint of an auto-commit-started transaction - executeBatch racing statement close Tests only; no production code, pom or dependency change.
Owner
Author
|
Root verdict: PASS at 4df54b1. Independent verifier re-ran the gates on a clean worktree: 383 tests, 0 failures, spotless green, the concurrency class 7 times with no flake, and two mutation probes that bit and were reverted. Diff is 235 insertions across four test files, no production change, no existing assertion edited. CI is green and the PR is CLEAN. One note carried forward: the duplicate-savepoint test name promises more than observable behavior can distinguish. Its mutation does bite the truncation path, so it stays as written. Countersign: root, 4df54b1. |
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.
What
Tests only, for the four behaviors Wave 0 of #195 names. No production code,
pom.xml, or dependency change; no existing assertion edited.LibsqlResultSetMetaDataTest).SELECT id, name FROM aux.Peopledrivespragma_database_listand the per-schema lookup, sofindSchemaandloadAttachedTableInforun. The stub answers a differentPeopleinmain(nullable, no autoincrement) and in the attached schemaAux(NOT NULL,INTEGER PRIMARY KEY AUTOINCREMENT), so the assertions ongetTableName/isNullable/isAutoIncrementonly pass when the attached catalogue wins. A second test queriesghost.Peoplewithghostabsent from the database list and asserts no table metadata.LibsqlResultSetTest).+02:00suffix,Zsuffix, bare10:30:45defaulting to2000-01-01, and BLOB rejection with"Bad value for type LocalDate"/LocalTime/LocalDateTime(exact target-type spelling from the code).LibsqlSavepointTest). Two savepoints nameddup: releasing the later one must keep the earlier active, so the next statement runs on the same stream with noBEGIN, androllbackto the earlier one still works. Releasing the only savepoint of a transaction started in auto-commit ends the transaction, so the followingcommit()sends nothing and exactly one stream close is issued.close()(LibsqlStatementConcurrencyTest). A batch is held inside the connection round trip with the existingPauseseam whileclose()lands on the statement, so the interleaving is deterministic;executeBatchthen fails withStatement is closed.Mutation probe
Each new test was run alone against a scratch break of the behavior it pins, then the break was reverted with
git checkout -- <file>. All nine bite; none stayed green.Probe lane:
./mvnw -pl libsql-jdbc -am -Dtest='<Class>#<method>' -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false testLibsqlResultSetMetaDataTest#resolvesAttachedTableMetadataThroughPragmaDatabaseListfindSchema:name.equalsIgnoreCase(schema)→name.equals(schema):65expected"People"but was""LibsqlResultSetMetaDataTest#reportsNoTableMetadataForASchemaMissingFromPragmaDatabaseListfindSchema:return null→return schemawhen no database matches:81Expecting empty but was:"People"LibsqlResultSetTest#textDateTimeWithAnOffsetSuffixIsConvertedToTheSystemZoneparseSqliteDateTime: guardif (sign > 9)→if (false && sign > 9):290SQLException: Bad value for type LocalDateTime: 2024-03-15 10:30:00+02:00LibsqlResultSetTest#textDateTimeWithAZSuffixIsReadAsUtcparseSqliteDateTime: skip theZbranch (if (false && ...)):305SQLException: Bad value for type LocalDateTime: 2024-03-15T10:30:00ZLibsqlResultSetTest#bareTimeTextGetsTheYear2000DefaultDateLocalDate.of(2000, 1, 1)→LocalDate.of(1970, 1, 1):316expected2000-01-01T10:30:45but was1970-01-01T10:30:45LibsqlResultSetTest#blobRejectsDateAndTimeGettersWithTheTargetTypeName"Cannot read " + targetType + " from a BLOB":328Expecting message"Bad value for type LocalDate"LibsqlSavepointTest#releasingTheLaterOfTwoSavepointsWithTheSameNameKeepsTheEarlierOneActivereleaseSavepoint:savepointNames.lastIndexOf→indexOf:225actual statements contain aBEGINbefore the firstINSERT(the transaction was ended early)LibsqlSavepointTest#releasingTheOnlySavepointOfAnAutoCommitTransactionLeavesCommitWithNothingToSendreleaseSavepoint: dropcloseStreamQuietly()in the outermost branch:250actual statements end with"COMMIT"(unexpected)LibsqlStatementConcurrencyTest#executeBatchThatLosesTheRaceToCloseFailsWithStatementClosedexecuteBatchfinally:clearBatch()→batchStatements.clear():200Expecting code to raise a throwableLanes
./mvnw -pl libsql-jdbc -am testEXIT=0, 383 tests, 0 failures, 0 errors (baseline 374 + 9 new)./mvnw spotless:apply./mvnw spotless:checkBUILD SUCCESSEXIT=1, production file reverted after every runDiscovery
executeBatch'sfinally { clearBatch(); }callscheckClosed()throughclearBatch. When a statementclose()lands while the batch round trip is in flight, a batch whose steps all succeeded reportsSQLException("Statement is closed")instead of the update counts. Pinned as the current behavior and not fixed here, since a fix changes behavior under a race; it sits next to the#197update-count snapshot and#211close-path work, so the root can decide.The
socketTimeoutURL case from the wave list is deliberately absent: #196 owns it.Fixes #195