mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-27 00:11:45 -07:00
Add check to the error message to ensure we captured the right one
This commit is contained in:
parent
db02d8eebf
commit
36bbc64def
1 changed files with 47 additions and 19 deletions
|
@ -13,61 +13,61 @@
|
||||||
|
|
||||||
block:
|
block:
|
||||||
|
|
||||||
- name: Check dumps errors | Setup test | Create 2 schemas
|
- name: Dumps errors | Setup test | Create 2 schemas
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
name:
|
name:
|
||||||
- "db1"
|
- "db1"
|
||||||
- "db2"
|
- "db2"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Check dumps errors | Setup test | Create 2 tables
|
- name: Dumps errors | Setup test | Create 2 tables
|
||||||
community.mysql.mysql_query:
|
community.mysql.mysql_query:
|
||||||
query:
|
query:
|
||||||
- "CREATE TABLE db1.t1 (id int)"
|
- "CREATE TABLE db1.t1 (id int)"
|
||||||
- "CREATE TABLE db1.t2 (id int)"
|
- "CREATE TABLE db1.t2 (id int)"
|
||||||
- "CREATE VIEW db2.v1 AS SELECT id from db1.t1"
|
- "CREATE VIEW db2.v1 AS SELECT id from db1.t1"
|
||||||
|
|
||||||
- name: Check dumps errors | Full dump without compression
|
- name: Dumps errors | Full dump without compression
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: all
|
name: all
|
||||||
target: /tmp/full-dump.sql
|
target: /tmp/full-dump.sql
|
||||||
register: full_dump
|
register: full_dump
|
||||||
|
|
||||||
- name: Check dumps errors | Full dump with gunzip
|
- name: Dumps errors | Full dump with gunzip
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: all
|
name: all
|
||||||
target: /tmp/full-dump.sql.gz
|
target: /tmp/full-dump.sql.gz
|
||||||
register: full_dump_gz
|
register: full_dump_gz
|
||||||
|
|
||||||
- name: Check dumps errors | Distinct dump without compression
|
- name: Dumps errors | Distinct dump without compression
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: db2
|
name: db2
|
||||||
target: /tmp/dump-db2.sql
|
target: /tmp/dump-db2.sql
|
||||||
register: dump_db2
|
register: dump_db2
|
||||||
|
|
||||||
- name: Check dumps errors | Distinct dump with gunzip
|
- name: Dumps errors | Distinct dump with gunzip
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: db2
|
name: db2
|
||||||
target: /tmp/dump-db2.sql.gz
|
target: /tmp/dump-db2.sql.gz
|
||||||
register: dump_db2_gz
|
register: dump_db2_gz
|
||||||
|
|
||||||
- name: Check dumps errors | Check distinct dumps are changed
|
- name: Dumps errors | Check distinct dumps are changed
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- dump_db2 is changed
|
- dump_db2 is changed
|
||||||
- dump_db2_gz is changed
|
- dump_db2_gz is changed
|
||||||
|
|
||||||
# Now db2.v1 targets an inexistant table so mysqldump will fail
|
# Now db2.v1 targets an inexistant table so mysqldump will fail
|
||||||
- name: Check dumps errors | Drop t1
|
- name: Dumps errors | Drop t1
|
||||||
community.mysql.mysql_query:
|
community.mysql.mysql_query:
|
||||||
query:
|
query:
|
||||||
- "DROP TABLE db1.t1"
|
- "DROP TABLE db1.t1"
|
||||||
|
|
||||||
- name: Check dumps errors | Full dump after drop t1 without compression
|
- name: Dumps errors | Full dump after drop t1 without compression
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: all
|
name: all
|
||||||
|
@ -75,21 +75,35 @@
|
||||||
register: full_dump_without_t1
|
register: full_dump_without_t1
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Check dumps errors | Full dump after drop t1 with gzip
|
- name: Dumps errors | Full dump after drop t1 with gzip without the fix
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: all
|
name: all
|
||||||
target: /tmp/full-dump-without-t1.sql.gz
|
target: /tmp/full-dump-without-t1.sql.gz
|
||||||
register: full_dump_without_t1_gz
|
register: full_dump_without_t1_gz_without_fix
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Check dumps errors | Check full dump
|
- name: Dumps errors | Full dump after drop t1 with gzip with the fix
|
||||||
|
community.mysql.mysql_db:
|
||||||
|
state: dump
|
||||||
|
name: all
|
||||||
|
target: /tmp/full-dump-without-t1.sql.gz
|
||||||
|
pipefail: true
|
||||||
|
register: full_dump_without_t1_gz_with_fix
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: Dumps errors | Check full dump
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- full_dump_without_t1 is failed
|
- full_dump_without_t1 is failed
|
||||||
- full_dump_without_t1_gz is failed
|
- full_dump_without_t1.msg is search(
|
||||||
|
"View 'db2.v1' references invalid table(s)")
|
||||||
|
- full_dump_without_t1_gz_without_fix is changed
|
||||||
|
- full_dump_without_t1_gz_with_fix is failed
|
||||||
|
- full_dump_without_t1_gz_with_fix.msg is search(
|
||||||
|
"View 'db2.v1' references invalid table(s)")
|
||||||
|
|
||||||
- name: Check dumps errors | Distinct dump after drop t1 without compression
|
- name: Dumps errors | Distinct dump after drop t1 without compression
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: db2
|
name: db2
|
||||||
|
@ -97,21 +111,35 @@
|
||||||
register: dump_db2_without_t1
|
register: dump_db2_without_t1
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Check dumps errors | Distinct dump after drop t1 with gzip
|
- name: Dumps errors | Distinct dump after drop t1 with gzip without the fix
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: db2
|
name: db2
|
||||||
target: /tmp/dump-db2-without_t1.sql.gz
|
target: /tmp/dump-db2-without_t1.sql.gz
|
||||||
register: dump_db2_without_t1_gz
|
register: dump_db2_without_t1_gz_without_fix
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Check dumps errors | Check full dump
|
- name: Dumps errors | Distinct dump after drop t1 with gzip with the fix
|
||||||
|
community.mysql.mysql_db:
|
||||||
|
state: dump
|
||||||
|
name: db2
|
||||||
|
target: /tmp/dump-db2-without_t1.sql.gz
|
||||||
|
pipefail: true
|
||||||
|
register: dump_db2_without_t1_gz_with_fix
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: Dumps errors | Check full dump
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- dump_db2_without_t1 is failed
|
- dump_db2_without_t1 is failed
|
||||||
- dump_db2_without_t1_gz is failed
|
- dump_db2_without_t1.msg is search(
|
||||||
|
"View 'db2.v1' references invalid table(s)")
|
||||||
|
- dump_db2_without_t1_gz_without_fix is changed
|
||||||
|
- dump_db2_without_t1_gz_with_fix is failed
|
||||||
|
- dump_db2_without_t1_gz_with_fix.msg is search(
|
||||||
|
"View 'db2.v1' references invalid table(s)")
|
||||||
|
|
||||||
- name: Check dumps errors | Cleanup
|
- name: Dumps errors | Cleanup
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
name:
|
name:
|
||||||
- "db1"
|
- "db1"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue