Skip to content

test(jdbc): add Liquibase integration smoke tests - #257

Merged
magnusp merged 2 commits into
mainfrom
feat/liquibase-itests
Oct 30, 2026
Merged

magnusp merged 2 commits into
mainfrom
feat/liquibase-itests

Conversation

@magnusp

@magnusp magnusp commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Description

Adds Liquibase integration tests to libsql-jdbc, derived from a throwaway prototype and then pulled up into the module.

The tests drive the in-tree driver through Liquibase's update, validate, snapshot-driven table rebuild, rollback, changeLogSync and typed-insert paths against a real sqld container. They live under io.github.magnusp.libsql.jdbc.liquibase and run under Failsafe (*IT), so ./mvnw test stays Docker-free.

No tracking issue; this is the test half of a driver-compatibility probe.

Driver gaps the prototype found

  1. Product name prevents Liquibase from selecting its SQLite dialect. getDatabaseProductName() returns SQLite (libSQL), while SQLiteDatabase.isCorrectDatabaseImplementation requires exactly SQLite (equalsIgnoreCase). Liquibase falls back to UnsupportedDatabase and emits INT GENERATED BY DEFAULT AS IDENTITY ..., which sqld rejects. Returning exactly SQLite and keeping the libSQL identity in getDriverName() would close this. Pinned by databaseFactoryFallsBackToUnsupportedDatabase(); the working tests construct SQLiteDatabase explicitly until then.
  2. jdbc:libsql: is not resolvable through Liquibase's URL path. DatabaseFactory.openDatabase(...) cannot derive a driver class because Liquibase's SQLite handler only claims jdbc:sqlite:. Applications must set driver=io.github.magnusp.libsql.jdbc.LibsqlDriver or pass a DataSource. Pinned by databaseFactoryCannotResolveALibsqlUrlToADriver().

Separately, Liquibase 5.0.3's SQLite dropColumn is broken (the single-column form fails validation and the nested form rebuilds without dropping the column), so the changelogs avoid it.

What is covered

  • update + re-run idempotency and validate()
  • add column, rename column (Liquibase snapshot-driven table rebuild), unique and non-unique indexes
  • inline foreign key creation and getImportedKeys round-trip
  • rollback(N) in reverse order
  • typed inserts: boolean, decimal, double, bigint, timestamp, date, time, clob
  • changeLogSync

libsql-jdbc/pom.xml now copies the shared Docker config to target/docker-config and sets DOCKER_CONFIG for the Failsafe fork, so the sandbox workaround is part of the build rather than a shell preamble.

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to not work as expected)
  • Documentation update
  • Refactoring / tooling / CI improvement

Checklist

  • My code follows the code style of this project (./mvnw spotless:check).
  • I have added tests that prove my fix is effective or that my feature works.
  • All new and existing tests passed in the affected reactor (./mvnw -pl libsql-jdbc -am verify).
  • I have updated documentation where appropriate. (No user-facing behavior changed.)

Verification

./mvnw -B -pl libsql-jdbc -am verify -Dit.test=LiquibaseIT
  • LiquibaseIT: 8 tests, 0 failures
  • Affected reactor: 1511 unit tests + 8 ITs, 0 failures
  • ./mvnw spotless:check: passing

The integration tests start the pinned ghcr.io/tursodatabase/libsql-server image and do not require a pre-existing sqld.

Tracked gaps

Drive the driver through Liquibase update, validate, snapshot-based table rebuilds, rollback, changeLogSync and typed inserts against a real sqld container.

Pin two bootstrapping gaps discovered by the prototype: SQLiteDatabase.isCorrectDatabaseImplementation requires the product name to be exactly SQLite, and Liquibase cannot derive a driver class from a jdbc:libsql: URL.
@magnusp

magnusp commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

The two driver gaps this PR pins are now tracked as #261 (product name / dialect detection) and #262 (Liquibase URL bootstrap and documentation).

@magnusp
magnusp merged commit b9f06ac into main Oct 30, 2026
6 checks passed
@magnusp
magnusp deleted the feat/liquibase-itests branch October 30, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant