Is changed (#427)

* Refactor tests to use "is" and "is not" changed

* Refactor tests to use is succeeded or is failed

* Reformat indentation

* Add filter "bool" to prevent issues
This commit is contained in:
Laurent Indermühle 2022-08-23 09:11:55 +02:00 committed by GitHub
parent 61586ae4cc
commit 0a68bb270f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 194 additions and 188 deletions

View file

@ -56,7 +56,7 @@
- name: assert successful completion of create database using check_mode since databases does not exist prior
assert:
that:
- check_mode_result.changed == true
- check_mode_result is changed
- name: run command to list databases like specified database name
command: "{{ mysql_command }} \"-e show databases like 'database%'\""
@ -87,7 +87,7 @@
- name: assert successful completion of create database
assert:
that:
- result.changed == true
- result is changed
- result.db_list == ['{{ db1_name }}', '{{ db2_name }}', '{{ db3_name }}']
- name: run command to list databases like specified database name
@ -120,7 +120,7 @@
- name: assert that recreation of existing databases does not make change (since recreated using check mode)
assert:
that:
- check_mode_result.changed == false
- check_mode_result is not changed
- name: run command to list databases like specified database name
command: "{{ mysql_command }} \"-e show databases like 'database%'\""
@ -151,7 +151,7 @@
- name: assert that recreation of existing databases does not make change
assert:
that:
- result.changed == false
- result is not changed
- name: run command to list databases like specified database name
command: "{{ mysql_command }} \"-e show databases like 'database%'\""
@ -180,7 +180,7 @@
- name: assert successful completion of deleting database
assert:
that:
- result.changed == true
- result is changed
- name: run command to list databases like specified database name
command: "{{ mysql_command }} \"-e show databases like 'database%'\""
@ -212,7 +212,7 @@
- name: assert successful completion of recreation of partially existing database using check mode
assert:
that:
- check_mode_result.changed == true
- check_mode_result is changed
- name: run command to list databases like specified database name
command: "{{ mysql_command }} \"-e show databases like 'database%'\""
@ -243,7 +243,7 @@
- name: assert successful completion of create database
assert:
that:
- result.changed == true
- result is changed
- name: run command to list databases like specified database name
command: "{{ mysql_command }} \"-e show databases like 'database%'\""
@ -284,7 +284,7 @@
- name: assert successful completion of dump operation using check mode
assert:
that:
- check_mode_dump_result.changed == true
- check_mode_dump_result is changed
- name: run command to list databases like specified database name
command: "{{ mysql_command }} \"-e show databases like 'database%'\""
@ -401,7 +401,7 @@
- name: assert successful completion of dump operation
assert:
that:
- dump_result.changed == true
- dump_result is changed
- dump_result.db_list == ['{{ db1_name }}', '{{ db2_name }}', '{{ db3_name }}']
- name: run command to list databases like specified database name
@ -451,7 +451,7 @@
- name: assert successful completion of dump operation
assert:
that:
- dump_result.changed == true
- dump_result is changed
- name: run command to list databases like specified database name
command: "{{ mysql_command }} \"-e show databases like 'database%'\""
@ -491,7 +491,7 @@
- name: assert successful completion of delete databases which already exists using check mode
assert:
that:
- check_mode_result.changed == true
- check_mode_result is changed
- name: run command to test state=absent for a database name
command: "{{ mysql_command }} \"-e show databases like 'database%'\""
@ -520,7 +520,7 @@
- name: assert successful completion of deleting database
assert:
that:
- result.changed == true
- result is changed
- result.db_list == ['{{ db2_name }}', '{{ db3_name }}']
- name: run command to list databases like specified database name
@ -551,7 +551,7 @@
- name: assert that deletion of non existing databases does not make change (using check mode)
assert:
that:
- check_mode_result.changed == false
- check_mode_result is not changed
- name: run command to test state=absent for a database name
command: "{{ mysql_command }} \"-e show databases like 'database%'\""
@ -580,7 +580,7 @@
- name: assert that deletion of non existing databases does not make change
assert:
that:
- result.changed == false
- result is not changed
- name: run command to list databases like specified database name
command: "{{ mysql_command }} \"-e show databases like 'database%'\""
@ -612,7 +612,7 @@
- name: assert successful completion of deleting database
assert:
that:
- result.changed == true
- result is changed
- name: run command to list databases like specified database name
command: "{{ mysql_command }} \"-e show databases like 'database%'\""

View file

@ -159,7 +159,7 @@
- name: assert successful completion of dump operation (with multiple databases in list form) via check mode
assert:
that:
- "dump_result.changed == true"
- dump_result is changed
- name: database dump file2 should not exist
stat:
@ -187,7 +187,7 @@
- name: assert successful completion of dump operation (with multiple databases in list form)
assert:
that:
- "dump_result2.changed == true"
- dump_result2 is changed
- name: state dump - dump file2 should exist
file:
@ -249,7 +249,7 @@
- name: assert output message restored a database from dump file1
assert:
that:
- "import_result.changed == true"
- import_result is changed
- name: remove database
mysql_db:
@ -284,7 +284,7 @@
- name: assert output message restored a database from dump file2 (check mode)
assert:
that:
- "check_import_result.changed == true"
- check_import_result is changed
- name: run command to list databases
command: "{{ mysql_command }} \"-e show databases like 'data%'\""
@ -309,7 +309,7 @@
- name: assert output message restored a database from dump file2
assert:
that:
- import_result2.changed == true
- import_result2 is changed
- import_result2.db_list == ['{{ db_name2 }}']
- name: run command to list databases
@ -335,7 +335,7 @@
- name: assert output message backup the database
assert:
that:
- "result.changed == true"
- result is changed
- "result.db =='{{ db_name }}'"
# - name: assert database was backed up successfully
@ -364,7 +364,7 @@
- name: assert output message restore the database
assert:
that:
- "result.changed == true"
- result is changed
- name: select data from table employee
command: "{{ mysql_command }} {{ db_name }} \"-e select * from employee\""
@ -398,7 +398,7 @@
- assert:
that:
- result.failed == true
- result is failed
- name: try to import with force parameter
mysql_db:

View file

@ -95,7 +95,7 @@
- name: assert test mysql_db encoding param not valid - issue 8075 (failed=true)
assert:
that:
- "result.failed == true"
- result is failed
- "'Traceback' not in result.msg"
- "'Unknown character set' in result.msg"
@ -196,7 +196,7 @@
- name: assert output message that database was created
assert:
that:
- "result.changed == true"
- result is changed
- name: run command to test database was created using user1
command: "{{ mysql_command }} -e \"show databases like '{{ db_user1 | regex_replace(\"([%_\\\\])\", \"\\\\\\1\") }}'\""
@ -233,7 +233,7 @@
- name: assert output message that database was not created using dbuser2
assert:
that:
- "result.failed == true"
- result is failed
- "'Access denied' in result.msg"
- name: run command to test that database was not created
@ -260,7 +260,7 @@
- name: assert output message that database was not deleted using dbuser2
assert:
that:
- "result.failed == true"
- result is failed
- "'Access denied' in result.msg"
- name: run command to test database was not deleted