add back all the tests steps disabled during development

This commit is contained in:
Laurent Indermuehle 2023-09-15 15:31:29 +02:00
parent b3b7868079
commit 29b6ad89a1
No known key found for this signature in database
GPG key ID: 93FA944C9F34DD09
3 changed files with 212 additions and 221 deletions

View file

@ -50,63 +50,56 @@ test-integration:
--health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \ --health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \
docker.io/library/$(db_engine_name):$(db_engine_version) \ docker.io/library/$(db_engine_name):$(db_engine_version) \
mysqld mysqld
# podman run \ podman run \
# --detach \ --detach \
# --replace \ --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 \
# --network podman \ --network podman \
# --publish 3308:3306 \ --publish 3308:3306 \
# --health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \ --health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \
# docker.io/library/$(db_engine_name):$(db_engine_version) \ docker.io/library/$(db_engine_name):$(db_engine_version) \
# mysqld mysqld
# podman run \ podman run \
# --detach \ --detach \
# --replace \ --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 \
# --network podman \ --network podman \
# --publish 3309:3306 \ --publish 3309:3306 \
# --health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \ --health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \
# docker.io/library/$(db_engine_name):$(db_engine_version) \ docker.io/library/$(db_engine_name):$(db_engine_version) \
# mysqld mysqld
# # Setup replication and restart containers # 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' podman exec primary bash -c 'echo -e [mysqld]\\nserver-id=1\\nlog-bin=/var/lib/mysql/primary-bin > /etc/mysql/conf.d/replication.cnf'
# podman exec replica1 bash -c 'echo -e [mysqld]\\nserver-id=2\\nlog-bin=/var/lib/mysql/replica1-bin > /etc/mysql/conf.d/replication.cnf' podman exec replica1 bash -c 'echo -e [mysqld]\\nserver-id=2\\nlog-bin=/var/lib/mysql/replica1-bin > /etc/mysql/conf.d/replication.cnf'
# podman exec replica2 bash -c 'echo -e [mysqld]\\nserver-id=3\\nlog-bin=/var/lib/mysql/replica2-bin > /etc/mysql/conf.d/replication.cnf' podman exec replica2 bash -c 'echo -e [mysqld]\\nserver-id=3\\nlog-bin=/var/lib/mysql/replica2-bin > /etc/mysql/conf.d/replication.cnf'
# # Don't restart a container unless it is healthy # Don't restart a container unless it is healthy
while ! podman healthcheck run primary && [[ "$$SECONDS" -lt 120 ]]; do sleep 1; done while ! podman healthcheck run primary && [[ "$$SECONDS" -lt 120 ]]; do sleep 1; done
# podman restart -t 30 primary podman restart -t 30 primary
# while ! podman healthcheck run replica1 && [[ "$$SECONDS" -lt 120 ]]; do sleep 1; done while ! podman healthcheck run replica1 && [[ "$$SECONDS" -lt 120 ]]; do sleep 1; done
# podman restart -t 30 replica1 podman restart -t 30 replica1
# while ! podman healthcheck run replica2 && [[ "$$SECONDS" -lt 120 ]]; do sleep 1; done while ! podman healthcheck run replica2 && [[ "$$SECONDS" -lt 120 ]]; do sleep 1; done
# podman restart -t 30 replica2 podman restart -t 30 replica2
# while ! podman healthcheck run primary && [[ "$$SECONDS" -lt 120 ]]; do sleep 1; done while ! podman healthcheck run primary && [[ "$$SECONDS" -lt 120 ]]; do sleep 1; done
# mkdir -p .venv/$(ansible) mkdir -p .venv/$(ansible)
# python$(local_python_version) -m venv .venv/$(ansible) python$(local_python_version) -m venv .venv/$(ansible)
# # Start venv (use `; \` to keep the same shell)
# 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 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
# End of venv
# Start venv (use `; \` to keep the same shell)
source .venv/$(ansible)/bin/activate; \ 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; \ set -x; \
ansible-test integration $(target) -v --color --coverage --diff \ ansible-test integration $(target) -v --color --coverage --diff \
--docker ghcr.io/ansible-collections/community.mysql/test-container\ --docker ghcr.io/ansible-collections/community.mysql/test-container\
-$(db_client)-py$(python_version_flat)-$(connector_name)$(connector_version_flat):latest \ -$(db_client)-py$(python_version_flat)-$(connector_name)$(connector_version_flat):latest \
--docker-network podman $(_continue_on_errors) $(_keep_containers_alive) --python $(python); \ --docker-network podman $(_continue_on_errors) $(_keep_containers_alive) --python $(python); \
set +x set +x
# End of venv
rm tests/integration/db_engine_name rm tests/integration/db_engine_name
rm tests/integration/db_engine_version rm tests/integration/db_engine_version

View file

@ -150,8 +150,6 @@
- users_privs - users_privs
register: result register: result
- debug: var=result
- name: Recreate users from mysql_info users_privs result - name: Recreate users from mysql_info users_privs result
community.mysql.mysql_user: community.mysql.mysql_user:
name: "{{ item.user }}" name: "{{ item.user }}"

View file

@ -21,204 +21,204 @@
block: block:
# # Create default MySQL config file with credentials # Create default MySQL config file with credentials
# - name: mysql_info - create default config file - name: mysql_info - create default config file
# template: template:
# src: my.cnf.j2 src: my.cnf.j2
# dest: "{{ playbook_dir }}/root/.my.cnf" dest: "{{ playbook_dir }}/root/.my.cnf"
# mode: '0400' mode: '0400'
# # Create non-default MySQL config file with credentials # Create non-default MySQL config file with credentials
# - name: mysql_info - create non-default config file - name: mysql_info - create non-default config file
# template: template:
# src: my.cnf.j2 src: my.cnf.j2
# dest: "{{ playbook_dir }}/root/non-default_my.cnf" dest: "{{ playbook_dir }}/root/non-default_my.cnf"
# mode: '0400' mode: '0400'
# ############### ###############
# # Do tests # Do tests
# # Access by default cred file # Access by default cred file
# - name: mysql_info - collect default cred file - name: mysql_info - collect default cred file
# mysql_info: mysql_info:
# login_user: '{{ mysql_user }}' login_user: '{{ mysql_user }}'
# login_host: '{{ mysql_host }}' login_host: '{{ mysql_host }}'
# login_port: '{{ mysql_primary_port }}' login_port: '{{ mysql_primary_port }}'
# config_file: "{{ playbook_dir }}/root/.my.cnf" config_file: "{{ playbook_dir }}/root/.my.cnf"
# register: result register: result
# - assert: - assert:
# that: that:
# - result is not changed - result is not changed
# - db_version in result.version.full - db_version in result.version.full
# - result.settings != {} - result.settings != {}
# - result.global_status != {} - result.global_status != {}
# - result.databases != {} - result.databases != {}
# - result.engines != {} - result.engines != {}
# - result.users != {} - result.users != {}
# - name: mysql_info - Test connector informations display - name: mysql_info - Test connector informations display
# ansible.builtin.import_tasks: ansible.builtin.import_tasks:
# file: connector_info.yml file: connector_info.yml
# # Access by non-default cred file # Access by non-default cred file
# - name: mysql_info - check non-default cred file - name: mysql_info - check non-default cred file
# mysql_info: mysql_info:
# login_user: '{{ mysql_user }}' login_user: '{{ mysql_user }}'
# login_host: '{{ mysql_host }}' login_host: '{{ mysql_host }}'
# login_port: '{{ mysql_primary_port }}' login_port: '{{ mysql_primary_port }}'
# config_file: "{{ playbook_dir }}/root/non-default_my.cnf" config_file: "{{ playbook_dir }}/root/non-default_my.cnf"
# register: result register: result
# - assert: - assert:
# that: that:
# - result is not changed - result is not changed
# - result.version != {} - result.version != {}
# # Remove cred files # Remove cred files
# - name: mysql_info - remove cred files - name: mysql_info - remove cred files
# file: file:
# path: '{{ item }}' path: '{{ item }}'
# state: absent state: absent
# loop: loop:
# - "{{ playbook_dir }}/.my.cnf" - "{{ playbook_dir }}/.my.cnf"
# - "{{ playbook_dir }}/non-default_my.cnf" - "{{ playbook_dir }}/non-default_my.cnf"
# # Access with password # Access with password
# - name: mysql_info - check access with password - name: mysql_info - check access with password
# mysql_info: mysql_info:
# <<: *mysql_params <<: *mysql_params
# register: result register: result
# - assert: - assert:
# that: that:
# - result is not changed - result is not changed
# - result.version != {} - result.version != {}
# # Test excluding # Test excluding
# - name: Collect all info except settings and users - name: Collect all info except settings and users
# mysql_info: mysql_info:
# <<: *mysql_params <<: *mysql_params
# filter: '!settings,!users' filter: '!settings,!users'
# register: result register: result
# - assert: - assert:
# that: that:
# - result is not changed - result is not changed
# - result.version != {} - result.version != {}
# - result.global_status != {} - result.global_status != {}
# - result.databases != {} - result.databases != {}
# - result.engines != {} - result.engines != {}
# - result.settings is not defined - result.settings is not defined
# - result.users is not defined - result.users is not defined
# # Test including # Test including
# - name: Collect info only about version and databases - name: Collect info only about version and databases
# mysql_info: mysql_info:
# <<: *mysql_params <<: *mysql_params
# filter: filter:
# - version - version
# - databases - databases
# register: result register: result
# - assert: - assert:
# that: that:
# - result is not changed - result is not changed
# - result.version != {} - result.version != {}
# - result.databases != {} - result.databases != {}
# - result.engines is not defined - result.engines is not defined
# - result.settings is not defined - result.settings is not defined
# - result.global_status is not defined - result.global_status is not defined
# - result.users is not defined - result.users is not defined
# # Test exclude_fields: db_size # Test exclude_fields: db_size
# # 'unsupported' element is passed to check that an unsupported value # 'unsupported' element is passed to check that an unsupported value
# # won't break anything (will be ignored regarding to the module's documentation). # won't break anything (will be ignored regarding to the module's documentation).
# - name: Collect info about databases excluding their sizes - name: Collect info about databases excluding their sizes
# mysql_info: mysql_info:
# <<: *mysql_params <<: *mysql_params
# filter: filter:
# - databases - databases
# exclude_fields: exclude_fields:
# - db_size - db_size
# - unsupported - unsupported
# register: result register: result
# - assert: - assert:
# that: that:
# - result is not changed - result is not changed
# - result.databases != {} - result.databases != {}
# - result.databases.mysql == {} - result.databases.mysql == {}
# ######################################################## ########################################################
# # Issue #65727, empty databases must be in returned dict # Issue #65727, empty databases must be in returned dict
# # #
# - name: Create empty database acme - name: Create empty database acme
# mysql_db: mysql_db:
# <<: *mysql_params <<: *mysql_params
# name: acme name: acme
# - name: Collect info about databases - name: Collect info about databases
# mysql_info: mysql_info:
# <<: *mysql_params <<: *mysql_params
# filter: filter:
# - databases - databases
# return_empty_dbs: true return_empty_dbs: true
# register: result register: result
# # Check acme is in returned dict # Check acme is in returned dict
# - assert: - assert:
# that: that:
# - result is not changed - result is not changed
# - result.databases.acme.size == 0 - result.databases.acme.size == 0
# - result.databases.mysql != {} - result.databases.mysql != {}
# - name: Collect info about databases excluding their sizes - name: Collect info about databases excluding their sizes
# mysql_info: mysql_info:
# <<: *mysql_params <<: *mysql_params
# filter: filter:
# - databases - databases
# exclude_fields: exclude_fields:
# - db_size - db_size
# return_empty_dbs: true return_empty_dbs: true
# register: result register: result
# # Check acme is in returned dict # Check acme is in returned dict
# - assert: - assert:
# that: that:
# - result is not changed - result is not changed
# - result.databases.acme == {} - result.databases.acme == {}
# - result.databases.mysql == {} - result.databases.mysql == {}
# - name: Remove acme database - name: Remove acme database
# mysql_db: mysql_db:
# <<: *mysql_params <<: *mysql_params
# name: acme name: acme
# state: absent state: absent
# - include_tasks: issue-28.yml - include_tasks: issue-28.yml
# # https://github.com/ansible-collections/community.mysql/issues/204 # https://github.com/ansible-collections/community.mysql/issues/204
# - name: Create database containing only views - name: Create database containing only views
# mysql_db: mysql_db:
# <<: *mysql_params <<: *mysql_params
# name: allviews name: allviews
# - name: Create view - name: Create view
# mysql_query: mysql_query:
# <<: *mysql_params <<: *mysql_params
# login_db: allviews login_db: allviews
# query: 'CREATE VIEW v_today (today) AS SELECT CURRENT_DATE' query: 'CREATE VIEW v_today (today) AS SELECT CURRENT_DATE'
# - name: Fetch info - name: Fetch info
# mysql_info: mysql_info:
# <<: *mysql_params <<: *mysql_params
# register: result register: result
# - name: Check - name: Check
# assert: assert:
# that: that:
# - result.databases.allviews.size == 0 - result.databases.allviews.size == 0
- name: Inport tasks file to tests users_privs filter - name: Inport tasks file to tests users_privs filter
ansible.builtin.import_tasks: ansible.builtin.import_tasks: