Skip to content

build/test: add MySQL 9.x compose service + test-mysql9 target#28

Merged
winebarrel merged 11 commits into
mainfrom
add-mysql9-test
May 2, 2026
Merged

build/test: add MySQL 9.x compose service + test-mysql9 target#28
winebarrel merged 11 commits into
mainfrom
add-mysql9-test

Conversation

@winebarrel

@winebarrel winebarrel commented May 2, 2026

Copy link
Copy Markdown
Owner

Summary

Adds forward-compat testing against MySQL 9.x:

  • New mysql9 service in compose.yaml on port 3307 (image mysql:9.4). docker compose up -d brings both 8.0 and 9.4 up.
  • make test-mysql9 runs the full integration suite against the 9.x instance, overriding both MYSQL_PORT and MYSCHEMA_TEST_DSN explicitly.
  • make clean-schema-mysql9 resets the test DB on 3307.
  • CI matrix runs the suite against both 8.0 and 9.4 on every push / PR; Codecov upload only on the 8.0 leg.

No code-path changes — catalog / parser / diff are exercised against 9.x as-is.

Verification

docker compose up -d
make test-mysql9

Full suite passes locally on 9.4: parser, model, diff, catalog, root-level YAML harness.

Test plan

  • docker compose up -d (both services come up)
  • make test-mysql9 — all packages PASS
  • make test-scenario MYSQL_PORT=3307 — PASS
  • make lint
  • Existing 8.0 flow (make test) unaffected

🤖 Generated with Claude Code

Adds a profile-gated `mysql9` service to compose.yaml (port 3307,
mysql:9.4) so the existing 8.0 instance on 3306 can run alongside it.
The 9.x service uses the `mysql9` Compose profile to keep `docker
compose up -d` defaulting to just 8.0 — explicit opt-in via
`docker compose --profile mysql9 up -d mysql9`.

Makefile gains:
  - `test-mysql9` — runs the full integration suite against the 9.x
    instance by overriding MYSQL_PORT=3307 and MYSCHEMA_TEST_DSN. No
    other code paths change; the catalog reader, parser, and diff
    are exercised against 9.x as-is.
  - `clean-schema-mysql9` — DROP/CREATE myschema_test on 3307,
    mirroring `clean-schema` for 8.0.

AGENTS.md gets a short section documenting the workflow.

Verified locally: `make test-mysql9` passes the full integration
suite against mysql:9.4.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 2, 2026 14:41
@codecov

codecov Bot commented May 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.33%. Comparing base (321e590) to head (36699d4).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #28   +/-   ##
=======================================
  Coverage   73.33%   73.33%           
=======================================
  Files          27       27           
  Lines        2141     2141           
=======================================
  Hits         1570     1570           
  Misses        411      411           
  Partials      160      160           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Adds a matrix dimension to the CI workflow so the integration suite
runs against both MySQL 8.0 (the existing baseline) and MySQL 9.4 on
each push / PR. Codecov upload only happens on the 8.0 leg to avoid
duplicate coverage reports.

For each matrix entry we:
  - bring up the target compose service (`mysql` for 8.0, `mysql9`
    for 9.4 — the latter via the `mysql9` profile, matching the
    Makefile target),
  - wait for the per-port mysqladmin ping,
  - run `make test` and `make test-scenario` with MYSQL_PORT and
    MYSCHEMA_TEST_DSN overridden via job-level env so the same
    Makefile invocation works for both versions.

test/scenario/helper.sh: the mysql client args now read MYSQL_HOST /
MYSQL_PORT / MYSQL_USER from the environment (with the existing 8.0
defaults preserved), so the scenario suite reaches the right port
when CI sets MYSQL_PORT=3307.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds forward-compatibility test infrastructure to run the existing integration/scenario test suites against a MySQL 9.x container alongside the existing MySQL 8.0 setup.

Changes:

  • Add an optional mysql9 Docker Compose service (profile-gated) on host port 3307.
  • Add make test-mysql9 and make clean-schema-mysql9 targets for running/resetting against MySQL 9.x.
  • Expand CI to run a test matrix against MySQL 8.0 and 9.4, with Codecov upload only on 8.0.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/scenario/helper.sh Parameterizes mysql CLI host/port/user for scenario DB setup/teardown.
compose.yaml Adds profile-gated mysql9 service (3307→3306) with healthcheck.
Makefile Adds MySQL 9.x test/reset targets.
AGENTS.md Documents how to run MySQL 9.x forward-compat testing locally.
.github/workflows/ci.yml Runs CI test matrix on MySQL 8.0 and 9.4 (selective Codecov).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
Comment thread test/scenario/helper.sh
Comment thread Makefile Outdated
Comment thread compose.yaml Outdated
winebarrel and others added 5 commits May 2, 2026 23:51
The matrix CI sets MYSQL_PORT=3307 in the job env so the scenario
suite hits the mysql9 container, but the Makefile's
`export MYSQL_PORT := 3306` was an unconditional assignment that
overrode the env value (Make assignments win over env unless `-e` is
passed). The result: the 9.4 leg's `make test-scenario` ran the
mysql client against 3306 and failed with "Can't connect" against
the 8.0 service that wasn't running on that leg.

Switch the five DB-connection vars (MYSQL_HOST/PORT/USER/PWD/DB) to
`?=` so the env value wins when set, and export them explicitly on a
trailing line. `make test` / `make test-mysql9` / `make test-scenario`
verified locally on both ports.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace the if/else around `docker compose up -d` with a single
invocation. The matrix sets COMPOSE_PROFILES at job-level env (empty
for the 8.0 leg, "mysql9" for the 9.4 leg), and Compose treats an
empty COMPOSE_PROFILES as "no extra profiles enabled". A
profile-less service like `mysql` still starts when named, so the
same command works for both legs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both compose services come up on every matrix leg; only the port the
tests point at differs. Always enable the `mysql9` profile so the
9.x service starts alongside the always-on 8.0 one, and run a single
`docker compose up -d` (no service argument). The matrix shrinks to
just `mysql_label` / `mysql_port` / `upload_codecov`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`docker compose up -d` now starts both `mysql` (8.0) and `mysql9`
(9.4) without any profile gymnastics. CI workflow drops the
COMPOSE_PROFILES env. AGENTS.md and the test-mysql9 Makefile target
docs follow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two remaining inline comments (the other two were already addressed
in earlier commits of this branch):

test/scenario/helper.sh
  - The default `_base_dsn` no longer hardcodes 127.0.0.1:3306; it's
    now built from MYSQL_USER / MYSQL_HOST / MYSQL_PORT, so the
    mysql CLI used by setup_db and the myschema driver target the
    same instance even when only MYSQL_PORT is overridden.
    Reordered the var-init block so MYSQL_HOST / MYSQL_PORT /
    MYSQL_USER are resolved before _base_dsn references them.
    (Copilot #2.)

Makefile
  - test-mysql9 / clean-schema-mysql9 stop hardcoding the full DSN
    and just delegate to the existing `test` / `clean-schema`
    targets with MYSQL_PORT=3307. The MYSCHEMA_TEST_DSN template at
    the top of the Makefile is recursively expanded, so the new port
    flows through to the DSN and any MYSQL_HOST / MYSQL_USER
    customisation carries with it. (Copilot #3.)

Verified locally: `make test-mysql9` and `make test-scenario
MYSQL_PORT=3307` both pass against the running 9.x compose service.

Copilot #1 (Makefile `:=` overriding env) was fixed in 0320bfc.
Copilot #4 (compose.yaml comment about profile) was updated when
the profile itself was removed in 1f51540.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread compose.yaml
Comment thread Makefile Outdated
Comment thread AGENTS.md Outdated
Three inline comments:

Makefile + AGENTS.md
  - test-mysql9 now overrides both MYSQL_PORT and MYSCHEMA_TEST_DSN
    explicitly. With only MYSQL_PORT overridden, a caller who already
    has MYSCHEMA_TEST_DSN set in their environment would silently hit
    the wrong port (the `?=` template at the top of the Makefile
    skips the recompute when MYSCHEMA_TEST_DSN is already set).
    Setting both keeps the target self-contained.
  - AGENTS.md doc updated to match: explicit on overriding both, and
    notes the rationale.
  - (Copilot #2, #3.)

PR description (no code change)
  - The PR body still claimed mysql9 was profile-gated; that profile
    was removed earlier in the branch and the body was stale.
    Updated via `gh pr edit` to match the current always-on
    behaviour. (Copilot #1.)

Verified: `make test-mysql9` passes against the 9.4 compose service
with no MYSCHEMA_TEST_DSN preset and with one preset to 3306 (the
explicit override now takes priority).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
winebarrel and others added 3 commits May 3, 2026 00:09
Copilot review: the readiness loop ran 60 iterations and exited via
the trailing `sleep 2` (which returns 0), so a MySQL that never
became reachable wouldn't fail the step — subsequent test runs would
crash with a connect error and waste CI minutes.

Use the standard `timeout 120 bash -c 'until <ping>; do sleep 2; done'`
idiom: if the server doesn't respond within 120 seconds the step
exits non-zero. (The compose-up loop is left as-is — it retries
just the `docker compose` invocation in case Docker itself is slow
to settle, and pulls/starts succeed on the first attempt in
practice.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Re-introduces a `mysql_service` field on the matrix so each leg only
starts the compose service it actually tests against — `mysql` (8.0)
on the 3306 leg, `mysql9` (9.4) on the 3307 leg. Reverses the
direction of commit 6077360.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Symmetric with `mysql9` so the Compose service name carries the
version. Updates the matrix entry in ci.yml accordingly. No port /
behaviour change; same image (mysql:8.0), same 3306 host port.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
@winebarrel winebarrel merged commit d13d39f into main May 2, 2026
9 checks passed
@winebarrel winebarrel deleted the add-mysql9-test branch May 2, 2026 15:19
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.

2 participants