1- # Subissue Draft for #1525 -01: Add DB Compatibility Matrix
1+ # Subissue #1703 (Draft for #1525 -01): Add DB Compatibility Matrix
2+
3+ - Issue: https://github.com/torrust/torrust-tracker/issues/1703
24
35## Goal
46
@@ -42,7 +44,7 @@ The implementation must follow these quality rules for all new and modified test
4244
4345The PR #1695 review branch includes a QA script that defines the expected behavior:
4446
45- - ` run-db- compatibility-matrix.sh ` :
47+ - ` database- compatibility` job in ` .github/workflows/testing.yaml ` :
4648 executes a compatibility matrix across SQLite, multiple MySQL versions, and multiple PostgreSQL
4749 versions.
4850
@@ -86,51 +88,44 @@ Steps:
8688 - PostgreSQL (reserved for subissue #1525 -08): ` TORRUST_TRACKER_CORE_POSTGRES_DRIVER_IMAGE_TAG `
8789
8890 When ` TORRUST_TRACKER_CORE_MYSQL_DRIVER_IMAGE_TAG ` is not set, the test falls back to the
89- current hardcoded default (e.g. ` 8.0 ` ), preserving existing behavior. The matrix script sets
91+ current hardcoded default (e.g. ` 8.0 ` ), preserving existing behavior. The CI matrix job sets
9092 this variable explicitly for each version in the loop, so unset means "run as today" and the
9193 matrix just expands that into multiple combinations.
9294
93- - Add ` contrib/dev-tools/qa/run-db-compatibility-matrix.sh ` modeled after the PR prototype:
94- - ` set -euo pipefail `
95- - define default version sets from env vars:
96- - ` MYSQL_VERSIONS ` defaulting to at least ` 8.0 8.4 `
97- - ` POSTGRES_VERSIONS ` reserved for subissue #1525 -08
98- - run pre-checks once (` cargo check --workspace --all-targets ` )
99- - run protocol/configuration tests once
100- - run SQLite driver tests once
101- - loop MySQL versions: ` docker pull mysql:<version> ` , then run MySQL driver tests with
102- ` TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST=1 ` and
103- ` TORRUST_TRACKER_CORE_MYSQL_DRIVER_IMAGE_TAG=<version> `
104- - print a clear heading for each backend/version before executing tests
105- - fail fast on first failure with the failing backend/version visible in logs
106- - keep script complexity intentionally low; avoid re-implementing test logic already in test
107- functions
108- - Replace the current single MySQL ` database ` step in ` .github/workflows/testing.yaml ` with
109- execution of the new script.
95+ - Add a dedicated ` database-compatibility ` workflow job (between unit and e2e) with matrix values for MySQL versions:
96+ - include matrix values for at least ` 8.0 ` and ` 8.4 `
97+ - run ` cargo test -p bittorrent-tracker-core --features db-compatibility-tests run_mysql_driver_tests -- --nocapture `
98+ - set ` TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST=true `
99+ - set ` TORRUST_TRACKER_CORE_MYSQL_DRIVER_IMAGE_TAG=<version> `
100+ - keep the test logic in Rust; use workflow matrix for version fan-out
101+ - Replace the current single MySQL ` database ` step in ` .github/workflows/testing.yaml ` with a
102+ dedicated ` database-compatibility ` job.
110103
111104Acceptance criteria:
112105
113106- [ ] DB image version injection is supported via ` TORRUST_TRACKER_CORE_MYSQL_DRIVER_IMAGE_TAG `
114107 (and a reserved ` POSTGRES ` equivalent for subissue #1525 -08).
115- - [ ] ` contrib/dev-tools/qa/run-db- compatibility-matrix.sh ` exists and runs successfully.
116- - [ ] The script exercises SQLite and at least two MySQL versions by default.
108+ - [ ] ` database- compatibility` workflow job runs successfully for each configured MySQL version .
109+ - [ ] The workflow matrix exercises at least two MySQL versions by default.
117110- [ ] Failures identify the backend/version combination that broke.
118- - [ ] The ` database ` job step in ` .github/workflows/testing.yaml ` runs the matrix script instead
119- of a single-version MySQL command.
120- - [ ] The script structure allows PostgreSQL to be added in subissue #1525 -08 without a redesign.
111+ - [ ] The dedicated ` database-compatibility ` job in ` .github/workflows/testing.yaml ` replaces the
112+ old single-version MySQL command.
113+ - [ ] The workflow matrix structure allows PostgreSQL to be added in subissue #1525 -08 without a
114+ redesign.
121115- [ ] Tests do not hard-code host ports; ` testcontainers ` assigns random ports automatically.
122116- [ ] All containers started by tests are removed unconditionally on test completion or failure.
123117
124118### 2) Document the workflow
125119
126120Steps:
127121
128- - Document the local invocation command for the matrix script.
129- - Document that the CI ` database ` step runs the same script.
122+ - Document the local invocation command for the compatibility test using explicit feature + env
123+ vars.
124+ - Document that CI runs the same test through the ` database-compatibility ` workflow job matrix.
130125
131126Acceptance criteria:
132127
133- - [ ] The matrix script is documented and runnable without ad hoc manual steps.
128+ - [ ] The compatibility test command is documented and runnable without ad hoc manual steps.
134129
135130## Out of Scope
136131
@@ -143,13 +138,13 @@ Acceptance criteria:
143138
144139- [ ] ` cargo test --workspace --all-targets ` passes.
145140- [ ] ` linter all ` exits with code ` 0 ` .
146- - [ ] The matrix script has been executed successfully in a clean environment; a passing run log
147- is included in the PR description.
141+ - [ ] The ` database-compatibility ` workflow job has been executed successfully in a clean
142+ environment; a passing run log is included in the PR description.
148143
149144## References
150145
151146- EPIC: #1525
152147- Reference PR: #1695
153148- Reference implementation branch: ` josecelano:pr-1684-review ` — see EPIC for checkout
154149 instructions (` docs/issues/1525-overhaul-persistence.md ` )
155- - Reference script : ` contrib/dev-tools/qa/run-db- compatibility-matrix.sh `
150+ - Reference job : ` .github/workflows/testing.yaml ` ` database- compatibility`
0 commit comments