Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Add 2024 versions to tests #660

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9aa532f
Enable mysql_native_password for MySQL 8.2+
laurent-indermuehle Jul 16, 2024
a009515
Enable mysql_native_password for MySQL 8.2+
laurent-indermuehle Jul 17, 2024
a98482d
Fix connection to MySQL 8 since Ubuntu 20.04 update
laurent-indermuehle Jul 17, 2024
123acca
Fix variable propagation to the sub-sub-shell
laurent-indermuehle Jul 17, 2024
036e4c2
Fix newlines
laurent-indermuehle Jul 17, 2024
46ff4af
Fix incomplete test suite
laurent-indermuehle Jul 17, 2024
217f2a2
Cut mysqlclient form the documentation
laurent-indermuehle Jul 17, 2024
c3fb4b6
Fix variable syntax mistakenly copied from Make
laurent-indermuehle Jul 17, 2024
f0493b5
Fix bad substitution
laurent-indermuehle Jul 17, 2024
e810f4a
Fix syntax error in conditional expression
laurent-indermuehle Jul 17, 2024
01b432a
Cut tests for Python 3.12 not supported by ansible-test
laurent-indermuehle Jul 17, 2024
e69cda7
Upgrade integration controller to ubuntu2204 by removing python
laurent-indermuehle Jul 18, 2024
8cb40e1
Cut tests for EoL MariaDB 10.4
laurent-indermuehle Jul 18, 2024
54d55a7
Reduce number of test in the matrix
laurent-indermuehle Jul 18, 2024
751830c
Cut support for intermediate LTS
laurent-indermuehle Jul 18, 2024
f1e6d05
Add missing exclude for a PyMySQL version and mysqlclient name
laurent-indermuehle Jul 18, 2024
8bbefcf
Fix python command not found with ansible-devel and add the debug
laurent-indermuehle Jul 18, 2024
783b76c
Disable retry-on-error
laurent-indermuehle Jul 18, 2024
f1597c9
Add back the python version in the unit tests titles
laurent-indermuehle Jul 18, 2024
609599a
Cut python from the integration tests title
laurent-indermuehle Jul 18, 2024
7ba7832
Enhance jobs title readability
laurent-indermuehle Jul 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 2 additions & 86 deletions .github/workflows/ansible-test-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,11 @@ jobs:
- mariadb
db_engine_version:
- '8.0.38'
# - '8.4.1' # Unable to install mysql-client on Ubuntu 20.04 default container used by ansible-test
- '8.4.1'
- '10.4.34'
- '10.5.25'
- '10.6.18'
laurent-indermuehle marked this conversation as resolved.
Show resolved Hide resolved
- '10.11.8'
python:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
connector_name:
- pymysql
- mysqlclient
Expand All @@ -78,15 +73,13 @@ jobs:
# RHEL8 context
- connector_name: pymysql
connector_version: '0.10.1'
python: '3.6'
ansible: stable-2.16
db_engine_name: mariadb
db_engine_version: '10.11.8'

# RHEL9 context
- connector_name: pymysql
connector_version: '1.1.1'
python: '3.9'
ansible: stable-2.17
db_engine_name: mariadb
db_engine_version: '10.11.8'
Expand Down Expand Up @@ -125,81 +118,9 @@ jobs:
- connector_name: mysqlclient
connector_version: '1.0.2'

- db_engine_version: '8.4.1'
python: '3.8'

- db_engine_version: '10.4.34'
python: '3.10'

- db_engine_version: '10.4.34'
python: '3.11'

- db_engine_version: '10.4.34'
ansible: devel

- db_engine_version: '10.6.18'
python: '3.8'

- db_engine_version: '10.6.18'
python: '3.9'

- python: '3.8'
connector_version: '1.0.2'

- python: '3.8'
connector_version: '2.0.3'

- python: '3.8'
connector_version: '2.1.1'

- python: '3.9'
connector_version: '1.0.2'

- python: '3.9'
connector_version: '2.0.1'

- python: '3.9'
connector_version: '2.1.1'

- python: '3.10'
connector_version: '0.9.3'

- python: '3.10'
connector_version: '2.0.1'

- python: '3.10'
connector_version: '2.0.3'

- python: '3.11'
connector_version: '0.9.3'

- python: '3.11'
connector_version: '1.0.2'

- python: '3.11'
connector_version: '2.0.1'

- python: '3.11'
connector_version: '2.0.3'

- python: '3.8'
ansible: stable-2.16

- python: '3.8'
ansible: stable-2.17

- python: '3.8'
ansible: devel

- python: '3.9'
ansible: stable-2.16

- python: '3.9'
ansible: stable-2.17

- python: '3.9'
ansible: devel

services:
db_primary:
image: docker.io/library/${{ matrix.db_engine_name }}:${{ matrix.db_engine_version }}
Expand Down Expand Up @@ -281,10 +202,10 @@ jobs:
- name: >-
Perform integration testing against
Ansible version ${{ matrix.ansible }}
under Python ${{ matrix.python }}
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
docker-image: ubuntu2204
pre-test-cmd: >-
echo Setting db_engine_name to "${{ matrix.db_engine_name }}"...;
echo -n "${{ matrix.db_engine_name }}"
Expand All @@ -303,14 +224,9 @@ jobs:
echo -n "${{ matrix.connector_version }}"
> tests/integration/connector_version;

echo Setting Python version to "${{ matrix.python }}"...;
echo -n "${{ matrix.python }}"
> tests/integration/python;

echo Setting Ansible version to "${{ matrix.ansible }}"...;
echo -n "${{ matrix.ansible }}"
> tests/integration/ansible
target-python-version: ${{ matrix.python }}
testing-type: integration

units:
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ test-integration:
@echo -n $(db_engine_version) > tests/integration/db_engine_version
@echo -n $(connector_name) > tests/integration/connector_name
@echo -n $(connector_version) > tests/integration/connector_version
@echo -n $(python) > tests/integration/python
@echo -n $(ansible) > tests/integration/ansible

# Create podman network for systems missing it. Error can be ignored
Expand Down Expand Up @@ -90,7 +89,7 @@ test-integration:
https://github.com/ansible/ansible/archive/$(ansible).tar.gz; \
set -x; \
ansible-test integration $(target) -v --color --coverage --diff \
--docker --python $(python) \
--docker ubuntu2204 \
--docker-network podman $(_continue_on_errors) $(_keep_containers_alive); \
set +x
# End of venv
Expand All @@ -99,7 +98,6 @@ test-integration:
rm tests/integration/db_engine_version
rm tests/integration/connector_name
rm tests/integration/connector_version
rm tests/integration/python
rm tests/integration/ansible
ifndef keep_containers_alive
podman stop --time 0 --ignore primary replica1 replica2
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,18 @@ Here is the table for the support timeline:

### Python

- 3.8
- 3.9
- 3.10
- 3.11 (collection version >= 3.10.0)
- 3.8 (Unit tests only)
- 3.9 (Unit tests only)
- 3.10 (Sanity, Units and integrations tests)
- 3.11 (Unit tests only, collection version >= 3.10.0)

### Databases

For MariaDB, only Long Term releases are tested.

- mysql 5.7.40 (collection version < 3.10.0)
- mysql 8.0.31 (collection version < 3.10.0)
- mysql 8.0.31 (collection version < 3.10.0)
- mysql 8.4.1 (collection version >= 3.10.0) !!! FAILING, no support yet !!!
- mariadb:10.3.34 (collection version < 3.5.1)
- mariadb:10.4.24 (collection version >= 3.5.2, < 3.10.0)
- mariadb:10.4.34 (collection version >= 3.10.0)
Expand Down
24 changes: 7 additions & 17 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,6 @@ The Makefile accept the following options
- "1.1.1" <- pymysql
- Description: The version of the python package of the connector to use. This value is used to filter tests meant for other connectors.

- `python`
- Mandatory: true
- Choices:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- Description: The python version to use in the controller (ansible-test container).

- `target`
- Mandatory: false
- Choices:
Expand All @@ -123,23 +113,23 @@ tests will overwrite the 3 databases containers so no need to kill them in advan

```sh
# Run all targets
make ansible="stable-2.16" db_engine_name="mysql" db_engine_version="8.0.31" python="3.10" connector_name="pymysql" connector_version="1.0.2"
make ansible="stable-2.16" db_engine_name="mysql" db_engine_version="8.0.31" connector_name="pymysql" connector_version="1.0.2"

# A single target
make ansible="stable-2.16" db_engine_name="mysql" db_engine_version="8.0.31" python="3.10" connector_name="pymysql" connector_version="1.0.2" target="test_mysql_info"
make ansible="stable-2.16" db_engine_name="mysql" db_engine_version="8.0.31" connector_name="pymysql" connector_version="1.0.2" target="test_mysql_info"

# Keep databases and ansible tests containers alives
# A single target and continue on errors
make ansible="stable-2.17" db_engine_name="mysql" db_engine_version="8.0.31" python="3.11" connector_name="mysqlclient" connector_version="2.0.3" target="test_mysql_query" keep_containers_alive=1 continue_on_errors=1
make ansible="stable-2.17" db_engine_name="mysql" db_engine_version="8.0.31" connector_name="mysqlclient" connector_version="2.0.3" target="test_mysql_query" keep_containers_alive=1 continue_on_errors=1

# If your system has an usupported version of Python:
make local_python_version="3.10" ansible="stable-2.17" db_engine_name="mariadb" db_engine_version="10.6.11" python="3.11" connector_name="pymysql" connector_version="1.0.2"
make local_python_version="3.10" ansible="stable-2.17" db_engine_name="mariadb" db_engine_version="10.6.11" connector_name="pymysql" connector_version="1.0.2"
```


### Run all tests

GitHub Action offer a test matrix that run every combination of Python, MySQL, MariaDB and Connector against each other. To reproduce this, this repo provides a script called *run_all_tests.py*.
GitHub Action offer a test matrix that run every combination of MySQL, MariaDB and Connector against each other. To reproduce this, this repo provides a script called *run_all_tests.py*.

Examples:

Expand All @@ -148,8 +138,8 @@ python run_all_tests.py
```


### Add a new Python, Connector or Database version
### Add a new Connector or Database version

New components version should be added to this file: [.github/workflows/ansible-test-plugins.yml](https://github.com/ansible-collections/community.mysql/tree/main/.github/workflows)

Be careful to not add too much tests. When adding a new version of Python, for instance, only test it agains the latest versions of Ansible and MySQL/MariaDB. When tests are run, you can see that we already start 40 virtual machines!
Be careful to not add too much tests. The matrix creates an exponential number of virtual machines!
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
---

# (A) Ubuntu 20.04 has been updated on July 10th 2024 and now required
# additionnal packages to connect to MySQL 8+. I think it was because of a
# security issues discovered in mysql-client and/or PyMySQL. The error was:
# unable to connect to database using pymysql 1.0.2, check login_user and
# login_password are correct or /root/.my.cnf has the credentials. Exception
# message: 'cryptography' package is required for sha256_password or
# caching_sha2_password auth method
# Ubuntu 20.04 is chosen by ansible-test default image. So any change in
# ansible-test or Ubuntu can break our tests anytime without us knowing why.
# We use the ubuntu2204 image provided by ansible-test.

- name: "{{ role_name }} | Requirements | Install Linux packages"
ansible.builtin.package:
Expand All @@ -21,12 +13,10 @@
# different name between Ubuntu 20.04 and 22.04. Luckily, libmysql++ is
# available on both.
- "{{ 'libmysql++-dev' if db_engine == 'mysql' else 'libmariadb-dev' }}"
- python3-cryptography # (A)
state: present

- name: "{{ role_name }} | Requirements | Install Python packages"
ansible.builtin.pip:
name:
- cffi # (A)
- "{{ connector_name }}=={{ connector_version }}"
state: present
7 changes: 0 additions & 7 deletions tests/integration/targets/setup_controller/tasks/setvars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
'file',
'/root/ansible_collections/community/mysql/tests/integration/db_engine_version'
) }}
python_version_lookup: >-
{{ lookup(
'file',
'/root/ansible_collections/community/mysql/tests/integration/python'
) }}
ansible_version_lookup: >-
{{ lookup(
'file',
Expand All @@ -49,7 +44,6 @@
connector_version: "{{ connector_version_lookup.strip() }}"
db_engine: "{{ db_engine_name_lookup.strip() }}"
db_version: "{{ db_engine_version_lookup.strip() }}"
python_version: "{{ python_version_lookup.strip() }}"
test_ansible_version: >-
{%- if ansible_version_lookup == 'devel' -%}
{{ ansible_version_lookup }}
Expand Down Expand Up @@ -77,7 +71,6 @@
connector_version: {{ connector_version }}
db_engine: {{ db_engine }}
db_version: {{ db_version }}
python_version: {{ python_version }}
test_ansible_version: {{ test_ansible_version }}
ansible.builtin.debug:
msg: "{{ msg.split('\n') }}"
8 changes: 1 addition & 7 deletions tests/integration/targets/setup_controller/tasks/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,8 @@

- name: Display the python version in use
command:
cmd: python{{ python_version }} -V
cmd: python -V
changed_when: false
register: python_in_use

- name: Assert that expected Python is installed
assert:
that:
- python_in_use.stdout is search(python_version)

- name: Assert that we run the expected ansible version
assert:
Expand Down
Loading