build/test: add MySQL 9.x compose service + test-mysql9 target#28
Conversation
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>
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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>
There was a problem hiding this comment.
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
mysql9Docker Compose service (profile-gated) on host port 3307. - Add
make test-mysql9andmake clean-schema-mysql9targets 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.
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>
There was a problem hiding this comment.
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.
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>
There was a problem hiding this comment.
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.
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>
There was a problem hiding this comment.
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.
Summary
Adds forward-compat testing against MySQL 9.x:
mysql9service incompose.yamlon port 3307 (imagemysql:9.4).docker compose up -dbrings both 8.0 and 9.4 up.make test-mysql9runs the full integration suite against the 9.x instance, overriding bothMYSQL_PORTandMYSCHEMA_TEST_DSNexplicitly.make clean-schema-mysql9resets the test DB on 3307.No code-path changes — catalog / parser / diff are exercised against 9.x as-is.
Verification
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 PASSmake test-scenario MYSQL_PORT=3307— PASSmake lintmake test) unaffected🤖 Generated with Claude Code