Fix issues and documentation with integration tests after merge of #490. (#514)

* Fix explanation about containers images
* Add definitive URI to the containers images
* Document that new images must be set as public
* Add makefile options possible values
* Document that any mysql and mariadb tag can be use
* Add computation of docker_image path
* Refactor pre-command to separate commands for cleaner GHA output
* Refactor to use GHA test matrix
* Cut docker_image from documentation since it's now automatic
* Document how to use run_all_test.py to display the test matrix
* Temp: Add path to images in my fork to validate integrations tests
This commit is contained in:
Laurent Indermühle 2023-03-24 10:16:36 +01:00 committed by GitHub
commit e2aa655762
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 637 additions and 534 deletions

View file

@ -11,12 +11,32 @@ ifdef continue_on_errors
_continue_on_errors = --retry-on-error --continue-on-error
endif
db_ver_tuple := $(subst ., , $(db_engine_version))
db_engine_version_flat := $(word 1, $(db_ver_tuple))$(word 2, $(db_ver_tuple))
con_ver_tuple := $(subst ., , $(connector_version))
connector_version_flat := $(word 1, $(con_ver_tuple))$(word 2, $(con_ver_tuple))$(word 3, $(con_ver_tuple))
py_ver_tuple := $(subst ., , $(python))
python_version_flat := $(word 1, $(py_ver_tuple))$(word 2, $(py_ver_tuple))
ifeq ($(db_engine_version_flat), 57)
db_client := my57
else
db_client := $(db_engine_name)
endif
.PHONY: test-integration
test-integration:
echo -n $(db_engine_version) > tests/integration/db_engine_version
echo -n $(connector) > tests/integration/connector
echo -n $(python) > tests/integration/python
echo -n $(ansible) > tests/integration/ansible
@echo -n $(db_engine_name) > tests/integration/db_engine_name
@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
podman network create podman || true
podman run \
@ -28,7 +48,7 @@ test-integration:
--network podman \
--publish 3307:3306 \
--health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \
docker.io/library/$(db_engine_version) \
docker.io/library/$(db_engine_name):$(db_engine_version) \
mysqld
podman run \
--detach \
@ -39,7 +59,7 @@ test-integration:
--network podman \
--publish 3308:3306 \
--health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \
docker.io/library/$(db_engine_version) \
docker.io/library/$(db_engine_name):$(db_engine_version) \
mysqld
podman run \
--detach \
@ -50,7 +70,7 @@ test-integration:
--network podman \
--publish 3309:3306 \
--health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \
docker.io/library/$(db_engine_version) \
docker.io/library/$(db_engine_name):$(db_engine_version) \
mysqld
# Setup replication and restart containers
podman exec primary bash -c 'echo -e [mysqld]\\nserver-id=1\\nlog-bin=/var/lib/mysql/primary-bin > /etc/mysql/conf.d/replication.cnf'
@ -69,9 +89,13 @@ test-integration:
source .venv/$(ansible)/bin/activate
python$(local_python_version) -m ensurepip
python$(local_python_version) -m pip install --disable-pip-version-check https://github.com/ansible/ansible/archive/$(ansible).tar.gz
-set -x; ansible-test integration $(target) -v --color --coverage --diff --docker $(docker_image) --docker-network podman $(_continue_on_errors) $(_keep_containers_alive) --python $(python); set +x
-set -x; ansible-test integration $(target) -v --color --coverage --diff \
--docker ghcr.io/ansible-collections/community.mysql/test-container-$(db_client)-py$(python_version_flat)-$(connector_name)$(connector_version_flat):latest \
--docker-network podman $(_continue_on_errors) $(_keep_containers_alive) --python $(python); set +x
rm tests/integration/db_engine_name
rm tests/integration/db_engine_version
rm tests/integration/connector
rm tests/integration/connector_name
rm tests/integration/connector_version
rm tests/integration/python
rm tests/integration/ansible
ifndef keep_containers_alive