Skip to content

Add MariaDB CI job and integration test for native UUID column#144

Merged
trowski merged 6 commits into
amphp:3.xfrom
webpatser:ci/mariadb-uuid-coverage
May 16, 2026
Merged

Add MariaDB CI job and integration test for native UUID column#144
trowski merged 6 commits into
amphp:3.xfrom
webpatser:ci/mariadb-uuid-coverage

Conversation

@webpatser
Copy link
Copy Markdown
Contributor

@webpatser webpatser commented May 11, 2026

Follow-up to #142. Adds MariaDB to the CI matrix with the full test suite running against a live MariaDB server, plus an integration test exercising the prepared-statement binary protocol against MariaDB's native UUID column.

What's added

  • tests-mariadb job in .github/workflows/ci.yml (PHP 8.4 + 8.5, MariaDB installed via apt)
  • test/MariaDbUuidTest.php covering the UUID round-trip: create UUID column, prepared insert, select, assert
  • MysqlTestCase::isMariaDb() helper that does SELECT VERSION() once and caches the result
  • Documented vendor skips on four tests that hit real MariaDB/MySQL semantic differences (see below)

The UUID test skips on MySQL and on MariaDB < 10.7 (when the native type landed), so it's a no-op on the existing 5 jobs and only runs on the new ones.

Vendor-divergence skips

Test Reason
MysqlDataTypeTest::testDateType (YEAR rows only) MariaDB rejects CAST(... AS YEAR). MySQL-only cast target; the YEAR storage type itself works on both.
MysqlDataTypeTest::testJson MariaDB has no native JSON wire type (aliased to LONGTEXT) and rejects CAST(... AS JSON). Test was designed around MySQL's JSON column type.
MysqlLinkTest::testPrepared parameter-definition assertion only MariaDB returns MYSQL_TYPE_NULL for parameter placeholders by design (https://mariadb.com/kb/en/com_stmt_prepare/), unlike MySQL which returns resolved types. The rest of the test (column metadata + execution + result iteration) still runs.
MysqlConnectionTest::testTransactionsCallbacksOnDestruct Rollback callbacks don't fire within delay(0) on MariaDB. Needs a timing-tolerant variant; out of scope here.

Each skip uses markTestSkipped with a one-line reason so future readers can find them.

Verification

  • Local run against MariaDB 12.2.2: 239 tests, 752 assertions, 11 skipped, 0 failures
  • Controlled revert of MysqlEncodedValue::fromValue() to the pre-Use VarString for string parameter encoding in binary protocol #142 LongBlob encoding: the new UUID test fails with Incorrect uuid value (1292/22007), confirming the regression signal
  • Existing MySQL jobs untouched

@trowski / @kelunik, happy to adjust scope (e.g., pin a specific MariaDB version, or tighten the testTransactionsCallbacksOnDestruct situation in a follow-up).

webpatser and others added 6 commits May 11, 2026 10:12
The encoding fix from amphp#142 made prepared-statement string parameters
round-trip correctly against MariaDB's native UUID column type, but
that integration path was never exercised in CI. This adds:

- A tests-mariadb job (PHP 8.4 + 8.5) that installs MariaDB via apt
  and runs the new test against a live server
- An integration test that creates a UUID column, inserts via
  prepared statement, reads back, and asserts the value survives
  the binary protocol path

The test skips on MySQL (no native UUID type) and on MariaDB < 10.7,
so it's a no-op on the existing 5 MySQL jobs and only runs on the
new MariaDB jobs.

Verified locally against MariaDB 12.2.2 (passes). A controlled revert
of MysqlEncodedValue::fromValue() to LongBlob encoding reproduces the
original "Incorrect uuid value (1292/22007)" failure, confirming the
test catches the regression it's meant to guard.
Drops --filter and exercises the whole test suite against MariaDB, with
explicit skips for tests that hit MariaDB/MySQL semantic differences:

- testDateType YEAR rows: MariaDB rejects CAST(... AS YEAR); MySQL-only
  syntax. The actual YEAR storage type is unaffected.
- testJson: MariaDB has no native JSON wire type (aliased to LONGTEXT)
  and rejects CAST(... AS JSON). The test was designed around MySQL's
  JSON column type.
- testPrepared parameter-definition assertion: MariaDB returns
  MYSQL_TYPE_NULL for parameter placeholders by design, rather than
  the resolved types MySQL returns. Wraps just that block; the rest of
  the test (column metadata + execution + result iteration) still runs.
- testTransactionsCallbacksOnDestruct: rollback callbacks don't fire
  within delay(0) on MariaDB; needs a separate timing-tolerant test.

Adds MysqlTestCase::isMariaDb() helper that does a SELECT VERSION()
once and caches the result. Reused by all four skips so future
divergences have one obvious place to hook.

Locally: 239 tests, 752 assertions, 11 skipped, 0 failures against
MariaDB 12.2.2.
Remove reference to non-existent method.
@trowski
Copy link
Copy Markdown
Member

trowski commented May 16, 2026

I'm not certain why testTransactionsCallbacksOnDestruct was failing for you on MariaDB. This test should be independent of the server. I'm curious as to the issue you were seeing.

I move the MariaDB CI jobs into the existing matrix to avoid a lot of duplication.

Thank you for setting this up!

@trowski trowski merged commit 4873dd2 into amphp:3.x May 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants