Feature/mariadb integration ci (#246)

* Replace matrix.mysql by matrix.db_engine_version

* Specify db flavor

* Upgrade dbdeployer to 1.56.0

See https://github.com/datacharmer/dbdeployer/issues/120

* Fix: github workflow syntax

* Fix: mysql version file for mariadb engine

* Do not test mysql_variables modes persist and persist_only on mariadb

Those modes do not exist on mariadb. See https://mariadb.com/kb/en/set/

* Exclude integration tests for mariadb_10.5.4 with pymysql==0.7.10

* TLS on mariadb is disabled by default

* Configure mariadb supported versions in matrix

As discussed in https://github.com/ansible-collections/community.mysql/discussions/141#discussioncomment-643657

* Fix: test_mysql_db : assert that databases does not exist

"assertion": "database1 not in mysql_result.stdout"

* Fix: assertion mysql_version in result.version.full

* Fix: test_mysql_user : Check that the module made a change and that the expected plugin type is set

'mysql_native_password' in show_create_user.stdout

* Fix: test_mysql_replication : Create user for replication

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax;
check the manual that corresponds to your MariaDB server version for the
right syntax to use near 'BY 'replication_pass'' at line 1

https://dev.mysql.com/doc/mysql-replication-excerpt/5.7/en/replication-howto-repuser.html
https://dev.mysql.com/doc/mysql-replication-excerpt/8.0/en/replication-howto-repuser.html
https://mariadb.com/kb/en/setting-up-replication/#example-enabling-replication-for-mariadb

Create user syntax compatible with auth plugin and password on both
mysql and mariadb.

https://dev.mysql.com/doc/refman/8.0/en/create-user.html
https://mariadb.com/kb/en/create-user/

* Fix: test_mysql_replication: replica_status 'dict object' has no attribute 'Source_Host'

* Do not test mysql_replication_channel.yml on mariadb

* Do not test target 'test_mysql_role' with mariadb, too much errors to fix

* Setup mysql_version_parts depending on install type (mysql or mariadb)

* Install mariadb-client when install_type is mariadb

To use the same client tools as the database engine.

And to use a more updated mysqldump version, in order to fix this error:

ERROR 1556 (HY000) at line 776: You can't use locks with log tables

* Fix: mysql auth plugin is set on mariadb >10.2

* Fix: skip assertion on mariadb 10.2

* Do not execute test_user_plugin_auth.yml tests on mariadb, create/update useer sql syntax not compatible

* Fix: test_mysql_user : assert user1 TLS requirements

Remove test for oldd versions

* Fix: typo

* Fix: test_mysql_user : Test idempotency (expect ok) ignore mariadb 10.5

* [ci skip] Add changelog fragment

* Delete changelog fragment
This commit is contained in:
R.Sicart 2021-12-14 09:30:46 +01:00 committed by GitHub
commit 1b061131dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 195 additions and 58 deletions

View file

@ -1,13 +1,18 @@
dbdeployer_version: 1.52.0
dbdeployer_version: 1.56.0
dbdeployer_home_dir: /opt/dbdeployer
home_dir: /root
percona_client_version: 5.7
mariadb_install: false
mysql_version: 8.0.22
mariadb_version: 10.5.4
mysql_base_port: 3306
percona_client_package: >-
{%- if mariadb_install -%}
mariadb-client
{%- else -%}
percona-server-client-5.7
{%- endif -%}

View file

@ -6,10 +6,10 @@
- name: "{{ role_name }} | config | run unpack tarball"
shell:
cmd: "dbdeployer unpack {{ dbdeployer_sandbox_download_dir }}/{{ install_tarball }}"
cmd: "dbdeployer unpack {{ dbdeployer_sandbox_download_dir }}/{{ install_tarball }} --flavor {{ install_type }}"
creates: "{{ dbdeployer_sandbox_binary_dir }}/{{ install_version }}"
- name: "{{ role_name }} | config | setup replication topology"
shell:
cmd: "dbdeployer deploy multiple {{ install_version }} --base-port {{ mysql_base_port }} --my-cnf-options=\"master_info_repository='TABLE'\" --my-cnf-options=\"relay_log_info_repository='TABLE'\""
cmd: "dbdeployer deploy multiple {{ install_version }} --flavor {{ install_type }} --base-port {{ mysql_base_port }} --my-cnf-options=\"master_info_repository='TABLE'\" --my-cnf-options=\"relay_log_info_repository='TABLE'\""
creates: "{{ dbdeployer_sandbox_home_dir }}/multi_msb_{{ install_version|replace('.','_') }}"

View file

@ -4,12 +4,26 @@
keyserver: keyserver.ubuntu.com
id: 4D1BB29D63D98E422B2113B19334A25F8507EFA5
state: present
when: install_type == 'mysql'
- name: "{{ role_name }} | install | add percona repositories"
apt_repository:
repo: "{{ item }}"
repo: deb http://repo.percona.com/percona/apt {{ ansible_lsb.codename }} main
state: present
loop: "{{ percona_mysql_repos }}"
when: install_type == 'mysql'
- name: "{{ role_name }} | install | add apt signing key for mariadb"
apt_key:
keyserver: keyserver.ubuntu.com
id: F1656F24C74CD1D8
state: present
when: install_type == 'mariadb'
- name: "{{ role_name }} | install | add mariadb repositories"
apt_repository:
repo: "deb [arch=amd64,arm64] https://downloads.mariadb.com/MariaDB/mariadb-{{ mysql_major_version }}/repo/ubuntu {{ ansible_lsb.codename }} main"
state: present
when: install_type == 'mariadb'
- name: "{{ role_name }} | install | install packages required by percona"
apt:

View file

@ -1,7 +1,12 @@
---
- name: "{{ role_name }} | setvars | split mysql version in parts"
set_fact:
mysql_version_parts: "{{ mysql_version.split('.') }}"
mysql_version_parts: >-
{%- if mariadb_install -%}
{{ mariadb_version.split('.') }}
{%- else -%}
{{ mysql_version.split('.') }}
{%- endif -%}
- name: "{{ role_name }} | setvars | get mysql major version"
set_fact:

View file

@ -7,12 +7,8 @@ dbdeployer_sandbox_download_dir: "{{ home_dir }}/downloads"
dbdeployer_sandbox_binary_dir: "{{ home_dir }}/opt/mysql"
dbdeployer_sandbox_home_dir: "{{ home_dir }}/sandboxes"
percona_mysql_repos:
- deb http://repo.percona.com/apt {{ ansible_lsb.codename }} main
- deb-src http://repo.percona.com/apt {{ ansible_lsb.codename }} main
percona_mysql_packages:
- percona-server-client-{{ percona_client_version }}
- "{{ percona_client_package }}"
python_packages: [pymysql == 0.9.3]