Skip to content

Commit c47b4b1

Browse files
authored
[CP-829] CI e2e testing: Support different MariaDB versions and parameters (#4478)
- Declare different mariadb versions (start with `maria-lts`) and provide associated image, parameters and env vars as a separate object configuration. - Add a dedicated entry for gtid and pos MariaDB entries including changes in Go test code to support GTID in MariaDB tests. :memo: This change requires changes in branch protection conditions.
1 parent e6003a9 commit c47b4b1

3 files changed

Lines changed: 36 additions & 10 deletions

File tree

.github/workflows/flow.yml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ permissions:
2323

2424
jobs:
2525
flow_test:
26+
name: flow_test (${{ matrix.runner }}, ${{ matrix.db-version.pg }}, ${{ matrix.db-version.mysql }}, ${{ matrix.db-version.mongo }}, ${{ matrix.db-version.ch }})
2627
if: |
2728
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
2829
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) ||
@@ -35,8 +36,31 @@ jobs:
3536
db-version: [
3637
{pg: 16, mysql: 'mysql-gtid', mongo: '6.0', ch: 'lts'},
3738
{pg: 17, mysql: 'mysql-pos', mongo: '7.0', ch: 'stable'},
38-
{pg: 18, mysql: 'maria', mongo: '8.0', ch: 'latest'},
39+
{pg: 18, mysql: 'maria-pos', mongo: '8.0', ch: 'latest'},
40+
{pg: 18, mysql: 'maria-gtid', mongo: '8.0', ch: 'stable'},
3941
]
42+
# Per-version container settings consumed by the "MySQL" step, keyed by the matrix
43+
# db-version.mysql value. Grouped under "mysql" since these are MySQL/MariaDB families;
44+
# only the databases handled by the MySQL step are listed here. Wrapped in a single-item
45+
# list because matrix values must be arrays; it stays a single shared value (no extra jobs).
46+
version-configs:
47+
- mysql:
48+
mysql-gtid:
49+
img: 'mysql:9.5'
50+
env: ['MYSQL_ROOT_PASSWORD=cipass']
51+
parameters: []
52+
mysql-pos:
53+
img: 'mysql:5.7'
54+
env: ['MYSQL_ROOT_PASSWORD=cipass']
55+
parameters: ['--log_bin=mysql-bin', '--server-id=1', '--bind-address=::']
56+
maria-pos:
57+
img: 'mariadb:lts-ubi9@sha256:55a81b2d791d2ff8ad33fef413d9e45e0ac57a951127e0cfc69a8e59f922ba6e'
58+
env: ['MARIADB_ROOT_PASSWORD=cipass']
59+
parameters: ['--log-bin=maria']
60+
maria-gtid:
61+
img: 'mariadb:lts-ubi9@sha256:55a81b2d791d2ff8ad33fef413d9e45e0ac57a951127e0cfc69a8e59f922ba6e'
62+
env: ['MARIADB_ROOT_PASSWORD=cipass']
63+
parameters: ['--log-bin=maria', '--gtid-strict-mode=ON']
4064
runs-on: ${{ matrix.runner }}
4165
timeout-minutes: 30
4266
services:
@@ -190,14 +214,13 @@ jobs:
190214
output-credentials: true
191215

192216
- name: MySQL
217+
env:
218+
DB_IMG: ${{ matrix.version-configs.mysql[matrix.db-version.mysql].img }}
219+
DB_ENV: ${{ join(matrix.version-configs.mysql[matrix.db-version.mysql].env, ' -e ') }}
220+
DB_PARAMS: ${{ join(matrix.version-configs.mysql[matrix.db-version.mysql].parameters, ' ') }}
193221
run: |
194-
if [ "${{ matrix.db-version.mysql }}" = "mysql-gtid" ]; then
195-
docker run -d --rm --name mysql --network ${{ job.container.network }} -p 3306:3306 -e MYSQL_ROOT_PASSWORD=cipass mysql:9.5
196-
elif [ "${{ matrix.db-version.mysql }}" = "mysql-pos" ]; then
197-
docker run -d --rm --name mysql --network ${{ job.container.network }} -p 3306:3306 -e MYSQL_ROOT_PASSWORD=cipass mysql:5.7 --log_bin=mysql-bin --server-id=1 --bind-address=::
198-
elif [ "${{ matrix.db-version.mysql }}" = "maria" ]; then
199-
docker run -d --rm --name mariadb --network ${{ job.container.network }} -p 3306:3306 -e MARIADB_ROOT_PASSWORD=cipass mariadb:lts-ubi9@sha256:55a81b2d791d2ff8ad33fef413d9e45e0ac57a951127e0cfc69a8e59f922ba6e --log-bin=maria
200-
fi
222+
docker run -d --rm --name mysql --network ${{ job.container.network }} -p 3306:3306 \
223+
-e $DB_ENV $DB_IMG $DB_PARAMS
201224
202225
- name: Mongo
203226
run: |

flow/e2e/mysql.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ func SetupMySQL(t *testing.T, suffix string) (*MySqlSource, error) {
3939
case "mysql-pos":
4040
replicationMode = protos.MySqlReplicationMechanism_MYSQL_FILEPOS
4141
mysqlFlavor = protos.MySqlFlavor_MYSQL_MYSQL
42-
case "maria":
42+
case "maria-pos":
43+
replicationMode = protos.MySqlReplicationMechanism_MYSQL_FILEPOS
44+
mysqlFlavor = protos.MySqlFlavor_MYSQL_MARIA
45+
case "maria-gtid":
4346
replicationMode = protos.MySqlReplicationMechanism_MYSQL_GTID
4447
mysqlFlavor = protos.MySqlFlavor_MYSQL_MARIA
4548
default:

flow/internal/test_env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func MySQLTestVersion() string {
9595
}
9696

9797
func MySQLTestVersionIsMaria() bool {
98-
return MySQLTestVersion() == "maria"
98+
return strings.HasPrefix(MySQLTestVersion(), "maria")
9999
}
100100

101101
func MySQLTestVersionIsMySQLPos() bool {

0 commit comments

Comments
 (0)