Add options to enforce recreate containers even if already exists

This commit is contained in:
Laurent Indermuehle 2023-03-03 14:23:08 +01:00
parent 7e2e5a3e94
commit 0ef8552973
No known key found for this signature in database
GPG key ID: 93FA944C9F34DD09
2 changed files with 5 additions and 4 deletions

View file

@ -21,6 +21,7 @@ test-integration:
podman network create podman || true podman network create podman || true
podman run \ podman run \
--detach \ --detach \
--replace \
--name primary \ --name primary \
--env MARIADB_ROOT_PASSWORD=msandbox \ --env MARIADB_ROOT_PASSWORD=msandbox \
--env MYSQL_ROOT_PASSWORD=msandbox \ --env MYSQL_ROOT_PASSWORD=msandbox \
@ -31,6 +32,7 @@ test-integration:
mysqld mysqld
podman run \ podman run \
--detach \ --detach \
--replace \
--name replica1 \ --name replica1 \
--env MARIADB_ROOT_PASSWORD=msandbox \ --env MARIADB_ROOT_PASSWORD=msandbox \
--env MYSQL_ROOT_PASSWORD=msandbox \ --env MYSQL_ROOT_PASSWORD=msandbox \
@ -41,6 +43,7 @@ test-integration:
mysqld mysqld
podman run \ podman run \
--detach \ --detach \
--replace \
--name replica2 \ --name replica2 \
--env MARIADB_ROOT_PASSWORD=msandbox \ --env MARIADB_ROOT_PASSWORD=msandbox \
--env MYSQL_ROOT_PASSWORD=msandbox \ --env MYSQL_ROOT_PASSWORD=msandbox \

View file

@ -37,7 +37,8 @@ The Makefile accept the following options:
- **connector**: The name of the python package of the connector along with its version number. Use '==' as a separator. - **connector**: The name of the python package of the connector along with its version number. Use '==' as a separator.
- **python**: The python version to use in the controller. - **python**: The python version to use in the controller.
- **target** : If omitted, all test targets will run. But you can limit the tests to a single target to speed up your tests. - **target** : If omitted, all test targets will run. But you can limit the tests to a single target to speed up your tests.
- **keep_containers_alive**: This option keeps all tree databases containers and the ansible-test container alive at the end of tests or in case of failure. This is useful to enter one of the containers with `podman exec -it <container-name> bash` for debugging. - **keep_containers_alive**: This option keeps all tree databases containers and the ansible-test container alive at the end of tests or in case of failure. This is useful to enter one of the containers with `podman exec -it <container-name> bash` for debugging. Rerunning the
test will recreate those containers.
- **continue_on_errors**: Tells ansible-test to retry on errors and also continue on errors. This is the way the GitHub Action's workflow runs the tests. If you develop a new target, this option can be used to validate that your tests cleanup everything so a new run can restart without errors like "Failed to create database x because it already exists". - **continue_on_errors**: Tells ansible-test to retry on errors and also continue on errors. This is the way the GitHub Action's workflow runs the tests. If you develop a new target, this option can be used to validate that your tests cleanup everything so a new run can restart without errors like "Failed to create database x because it already exists".
Examples: Examples:
@ -53,9 +54,6 @@ make ansible="stable-2.14" db_engine_version="mysql:5.7.40" python="3.8" connect
# A single target and continue on errors # A single target and continue on errors
make ansible="stable-2.14" db_engine_version="mysql:8.0.31" python="3.9" connector="mysqlclient==2.0.3" docker_image="ghcr.io/community.mysql/test-container-my80-py39-mysqlclient203:latest" target="test_mysql_db" keep_containers_alive=1 continue_on_errors=1 make ansible="stable-2.14" db_engine_version="mysql:8.0.31" python="3.9" connector="mysqlclient==2.0.3" docker_image="ghcr.io/community.mysql/test-container-my80-py39-mysqlclient203:latest" target="test_mysql_db" keep_containers_alive=1 continue_on_errors=1
# Kill containers before rerun tests after using `keep_containers_alive=1`
podman stop -a; podman rm -a; make ansible="stable-2.14" db_engine_version="mysql:5.7.40" python="3.8" connector="pymysql==0.7.10" docker_image="ghcr.io/community.mysql/test-container-my57-py38-pymysql0711:latest" target="test_mysql_db" keep_containers_alive=1
# If your system has an usupported version of Python: # If your system has an usupported version of Python:
make local_python_version="3.8" ansible="stable-2.14" db_engine_version="mariadb:10.6.11" python="3.9" connector="pymysql==0.9.3" docker_image="ghcr.io/community.mysql/test-container-mariadb103-py39-pymysql093:latest" make local_python_version="3.8" ansible="stable-2.14" db_engine_version="mariadb:10.6.11" python="3.9" connector="pymysql==0.9.3" docker_image="ghcr.io/community.mysql/test-container-mariadb103-py39-pymysql093:latest"
``` ```