mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-27 04:41:28 -07:00
Add unique name to simplify debugging
This commit is contained in:
parent
6adb71a3ea
commit
b973849b53
4 changed files with 91 additions and 87 deletions
|
@ -1,17 +1,19 @@
|
|||
- set_fact:
|
||||
---
|
||||
- name: Config overrides | Set facts
|
||||
set_fact:
|
||||
db_to_create: testdb1
|
||||
config_file: "{{ playbook_dir }}/.my1.cnf"
|
||||
fake_port: 9999
|
||||
fake_host: "blahblah.local"
|
||||
include_dir: "{{ playbook_dir }}/mycnf.d"
|
||||
|
||||
- name: Create custom config file
|
||||
- name: Config overrides | Create custom config file
|
||||
shell: 'echo "[client]" > {{ config_file }}'
|
||||
|
||||
- name: Add fake port to config file
|
||||
- name: Config overrides | Add fake port to config file
|
||||
shell: 'echo "port = {{ fake_port }}" >> {{ config_file }}'
|
||||
|
||||
- name: Add blank line
|
||||
- name: Config overrides | Add blank line
|
||||
shell: 'echo "" >> {{ config_file }}'
|
||||
when:
|
||||
- >
|
||||
|
@ -21,7 +23,7 @@
|
|||
and connector_ver is version('0.9.3', '>=')
|
||||
)
|
||||
|
||||
- name: Create include_dir
|
||||
- name: Config overrides | Create include_dir
|
||||
file:
|
||||
path: '{{ include_dir }}'
|
||||
state: directory
|
||||
|
@ -34,7 +36,7 @@
|
|||
and connector_ver is version('0.9.3', '>=')
|
||||
)
|
||||
|
||||
- name: Add include_dir
|
||||
- name: Config overrides | Add include_dir
|
||||
lineinfile:
|
||||
path: '{{ config_file }}'
|
||||
line: '!includedir {{ include_dir }}'
|
||||
|
@ -47,7 +49,7 @@
|
|||
and connector_ver is version('0.9.3', '>=')
|
||||
)
|
||||
|
||||
- name: Create database using fake port to connect to, must fail
|
||||
- name: Config overrides | Create database using fake port to connect to, must fail
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -61,13 +63,13 @@
|
|||
ignore_errors: yes
|
||||
register: result
|
||||
|
||||
- name: Must fail because login_port default has beed overriden by wrong value from config file
|
||||
- name: Config overrides | Must fail because login_port default has beed overriden by wrong value from config file
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
||||
- result.msg is search("unable to connect to database")
|
||||
|
||||
- name: Create database using default port
|
||||
- name: Config overrides | Create database using default port
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -80,18 +82,18 @@
|
|||
config_overrides_defaults: no
|
||||
register: result
|
||||
|
||||
- name: Must not fail because of the default of login_port is correct
|
||||
- name: Config overrides | Must not fail because of the default of login_port is correct
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Reinit custom config file
|
||||
- name: Config overrides | Reinit custom config file
|
||||
shell: 'echo "[client]" > {{ config_file }}'
|
||||
|
||||
- name: Add fake host to config file
|
||||
- name: Config overrides | Add fake host to config file
|
||||
shell: 'echo "host = {{ fake_host }}" >> {{ config_file }}'
|
||||
|
||||
- name: Remove database using fake login_host
|
||||
- name: Config overrides | Remove database using fake login_host
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -104,14 +106,13 @@
|
|||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Must fail because login_host default has beed overriden by wrong value from config file
|
||||
- name: Config overrides | Must fail because login_host default has beed overriden by wrong value from config file
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
||||
- result.msg is search("Can't connect to MySQL server on '{{ fake_host }}'") or result.msg is search("Unknown MySQL server host '{{ fake_host }}'")
|
||||
|
||||
# Clean up
|
||||
- name: Remove test db
|
||||
- name: Config overrides | Clean up test database
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
|
||||
- set_fact:
|
||||
- name: Encoding | Set fact
|
||||
set_fact:
|
||||
latin1_file1: "{{ tmp_dir }}/{{ file }}"
|
||||
|
||||
- name: Deleting Latin1 encoded Database
|
||||
|
@ -12,7 +13,7 @@
|
|||
name: '{{ db_latin1_name }}'
|
||||
state: absent
|
||||
|
||||
- name: create Latin1 encoded database
|
||||
- name: Encoding | Create Latin1 encoded database
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -22,16 +23,16 @@
|
|||
state: present
|
||||
encoding: latin1
|
||||
|
||||
- name: create a table in Latin1 database
|
||||
- name: Encoding | Create a table in Latin1 database
|
||||
command: "{{ mysql_command }} {{ db_latin1_name }} -e \"create table testlatin1(id int, name varchar(100))\""
|
||||
|
||||
|
||||
# Inserting a string in latin1 into table, , this string be tested later,
|
||||
# so report any change of content in the test too
|
||||
- name: inserting data into Latin1 database
|
||||
- name: Encoding | Inserting data into Latin1 database
|
||||
command: "{{ mysql_command }} {{ db_latin1_name }} -e \"insert into testlatin1 value(47,'Amédée Bôlüt')\""
|
||||
|
||||
- name: selecting table
|
||||
- name: Encoding | Selecting table
|
||||
command: "{{ mysql_command }} {{ db_latin1_name }} -e \"select * from testlatin1\""
|
||||
register: output
|
||||
|
||||
|
@ -51,7 +52,7 @@
|
|||
that:
|
||||
- result is changed
|
||||
|
||||
- name: state dump - file name should exist
|
||||
- name: Encoding | State dump - file name should exist (latin1_file1)
|
||||
file:
|
||||
name: '{{ latin1_file1 }}'
|
||||
state: file
|
||||
|
@ -59,7 +60,7 @@
|
|||
- name: od the file and check of latin1 encoded string is present
|
||||
shell: grep -a 47 {{ latin1_file1 }} | od -c |grep "A m 351 d 351 e B 364\|A m 303 251 d 303 251 e B 303"
|
||||
|
||||
- name: Dropping {{ db_latin1_name }} database
|
||||
- name: Encoding | Dropping {{ db_latin1_name }} database
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -68,7 +69,7 @@
|
|||
name: '{{ db_latin1_name }}'
|
||||
state: absent
|
||||
|
||||
- name: Importing the latin1 mysql script
|
||||
- name: Encoding | Importing the latin1 mysql script
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -80,11 +81,12 @@
|
|||
target: "{{ latin1_file1 }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
- name: Encoding | Assert that importing latin1 is changed
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: check encoding of table
|
||||
- name: Encoding | Check encoding of table
|
||||
ansible.builtin.command:
|
||||
cmd: >
|
||||
{{ mysql_command }}
|
||||
|
@ -93,7 +95,7 @@
|
|||
register: output
|
||||
failed_when: '"latin1_swedish_ci" not in output.stdout'
|
||||
|
||||
- name: remove database
|
||||
- name: Encoding | Clean up database
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
|
|
@ -398,13 +398,13 @@
|
|||
target: '{{ dump1_file }}'
|
||||
register: dump_result
|
||||
|
||||
- name: assert successful completion of dump operation
|
||||
- name: Assert successful completion of dump operation (existing database)
|
||||
assert:
|
||||
that:
|
||||
- dump_result is changed
|
||||
- dump_result.db_list == ['{{ db1_name }}', '{{ db2_name }}', '{{ db3_name }}']
|
||||
|
||||
- name: run command to list databases like specified database name
|
||||
- name: Run command to list databases like specified database name
|
||||
command: "{{ mysql_command }} \"-e show databases like 'database%'\""
|
||||
register: mysql_result
|
||||
|
||||
|
@ -415,7 +415,7 @@
|
|||
- "'{{ db2_name }}' in mysql_result.stdout"
|
||||
- "'{{ db3_name }}' in mysql_result.stdout"
|
||||
|
||||
- name: state dump - file name should exist
|
||||
- name: State dump - file name should exist (dump1_file)
|
||||
file:
|
||||
name: '{{ dump1_file }}'
|
||||
state: file
|
||||
|
@ -466,7 +466,7 @@
|
|||
- "'{{ db4_name }}' not in mysql_result.stdout"
|
||||
- "'{{ db5_name }}' not in mysql_result.stdout"
|
||||
|
||||
- name: state dump - file name should exist
|
||||
- name: state dump - file name should exist (dump2_file)
|
||||
file:
|
||||
name: '{{ dump2_file }}'
|
||||
state: file
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# ============================================================
|
||||
- set_fact:
|
||||
- name: Dump and Import | Set facts
|
||||
set_fact:
|
||||
db_file_name: "{{ tmp_dir }}/{{ file }}"
|
||||
wrong_sql_file: "{{ tmp_dir }}/wrong.sql"
|
||||
dump_file1: "{{ tmp_dir }}/{{ file2 }}"
|
||||
|
@ -26,10 +27,10 @@
|
|||
db_user_unsafe_password: "pass!word"
|
||||
config_file: "{{ playbook_dir }}/root/.my.cnf"
|
||||
|
||||
- name: create custom config file
|
||||
- name: Dump and Import | Create custom config file
|
||||
shell: 'echo "[client]" > {{ config_file }}'
|
||||
|
||||
- name: create user for test unsafe_login_password parameter
|
||||
- name: Dump and Import | Create user for test unsafe_login_password parameter
|
||||
mysql_user:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -41,7 +42,7 @@
|
|||
priv: '*.*:ALL'
|
||||
state: present
|
||||
|
||||
- name: state dump/import - create database
|
||||
- name: Dump and Import | State dump/import - create database
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -51,7 +52,7 @@
|
|||
state: present
|
||||
check_implicit_admin: yes
|
||||
|
||||
- name: create database
|
||||
- name: Dump and Import | Create database
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -61,29 +62,29 @@
|
|||
state: present
|
||||
check_implicit_admin: no
|
||||
|
||||
- name: state dump/import - create table department
|
||||
- name: Dump and Import | State dump/import - create table department
|
||||
command: "{{ mysql_command }} {{ db_name }} \"-e create table department(id int, name varchar(100))\""
|
||||
|
||||
- name: state dump/import - create table employee
|
||||
- name: Dump and Import | State dump/import - create table employee
|
||||
command: "{{ mysql_command }} {{ db_name }} \"-e create table employee(id int, name varchar(100))\""
|
||||
|
||||
- name: state dump/import - insert data into table employee
|
||||
- name: Dump and Import | State dump/import - insert data into table employee
|
||||
command: "{{ mysql_command }} {{ db_name }} \"-e insert into employee value(47,'Joe Smith')\""
|
||||
|
||||
- name: state dump/import - insert data into table department
|
||||
- name: Dump and Import | State dump/import - insert data into table department
|
||||
command: "{{ mysql_command }} {{ db_name }} \"-e insert into department value(2,'Engineering')\""
|
||||
|
||||
- name: state dump/import - file name should not exist
|
||||
- name: Dump and Import | State dump/import - file name should not exist
|
||||
file:
|
||||
name: '{{ db_file_name }}'
|
||||
state: absent
|
||||
|
||||
- name: database dump file1 should not exist
|
||||
- name: Dump and Import | Database dump file1 should not exist
|
||||
file:
|
||||
name: '{{ dump_file1 }}'
|
||||
state: absent
|
||||
|
||||
- name: database dump file2 should not exist
|
||||
- name: Dump and Import | Database dump file2 should not exist
|
||||
file:
|
||||
name: '{{ dump_file2 }}'
|
||||
state: absent
|
||||
|
@ -109,13 +110,13 @@
|
|||
check_implicit_admin: no
|
||||
register: result
|
||||
|
||||
- name: assert successful completion of dump operation
|
||||
- name: Dump and Import | Assert successful completion of dump operation
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.executed_commands[0] is search(".department --master-data=1 --skip-triggers")
|
||||
|
||||
- name: state dump/import - file name should exist
|
||||
- name: Dump and Import | State dump/import - file name should exist (db_file_name)
|
||||
file:
|
||||
name: '{{ db_file_name }}'
|
||||
state: file
|
||||
|
@ -132,13 +133,13 @@
|
|||
check_implicit_admin: yes
|
||||
register: dump_result1
|
||||
|
||||
- name: assert successful completion of dump operation (with multiple databases in comma separated form)
|
||||
- name: Dump and Import | Assert successful completion of dump operation (with multiple databases in comma separated form)
|
||||
assert:
|
||||
that:
|
||||
- dump_result1 is changed
|
||||
- dump_result1.executed_commands[0] is search(" --user=root --password=\*\*\*\*\*\*\*\*")
|
||||
|
||||
- name: state dump - dump file1 should exist
|
||||
- name: Dump and Import | State dump - dump file1 should exist
|
||||
file:
|
||||
name: '{{ dump_file1 }}'
|
||||
state: file
|
||||
|
@ -157,17 +158,17 @@
|
|||
register: dump_result
|
||||
check_mode: yes
|
||||
|
||||
- name: assert successful completion of dump operation (with multiple databases in list form) via check mode
|
||||
- name: Dump and Import | Assert successful completion of dump operation (with multiple databases in list form) via check mode
|
||||
assert:
|
||||
that:
|
||||
- dump_result is changed
|
||||
|
||||
- name: database dump file2 should not exist
|
||||
- name: Dump and Import | Database dump file2 should not exist
|
||||
stat:
|
||||
path: '{{ dump_file2 }}'
|
||||
register: stat_result
|
||||
|
||||
- name: assert that check_mode does not create dump file for databases
|
||||
- name: Dump and Import | Assert that check_mode does not create dump file for databases
|
||||
assert:
|
||||
that:
|
||||
- stat_result.stat.exists is defined and not stat_result.stat.exists
|
||||
|
@ -185,17 +186,17 @@
|
|||
target: '{{ dump_file2 }}'
|
||||
register: dump_result2
|
||||
|
||||
- name: assert successful completion of dump operation (with multiple databases in list form)
|
||||
- name: Dump and Import | Assert successful completion of dump operation (with multiple databases in list form)
|
||||
assert:
|
||||
that:
|
||||
- dump_result2 is changed
|
||||
|
||||
- name: state dump - dump file2 should exist
|
||||
- name: Dump and Import | State dump - dump file2 should exist
|
||||
file:
|
||||
name: '{{ dump_file2 }}'
|
||||
state: file
|
||||
|
||||
- name: state dump/import - remove database
|
||||
- name: Dump and Import | State dump/import - remove database
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -204,7 +205,7 @@
|
|||
name: '{{ db_name }}'
|
||||
state: absent
|
||||
|
||||
- name: remove database
|
||||
- name: Dump and Import | Remove database
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -213,7 +214,7 @@
|
|||
name: '{{ db_name2 }}'
|
||||
state: absent
|
||||
|
||||
- name: test state=import to restore the database of type {{ format_type }} (expect changed=true)
|
||||
- name: Dump and Import | Test state=import to restore the database of type {{ format_type }} (expect changed=true)
|
||||
mysql_db:
|
||||
login_user: '{{ db_user }}'
|
||||
login_password: '{{ db_user_unsafe_password }}'
|
||||
|
@ -226,16 +227,16 @@
|
|||
use_shell: yes
|
||||
register: result
|
||||
|
||||
- name: show the tables
|
||||
- name: Dump and Import | Show the tables
|
||||
command: "{{ mysql_command }} {{ db_name }} \"-e show tables\""
|
||||
register: result
|
||||
|
||||
- name: assert that the department table is absent.
|
||||
- name: Dump and Import | Assert that the department table is absent.
|
||||
assert:
|
||||
that:
|
||||
- "'department' not in result.stdout"
|
||||
|
||||
- name: test state=import to restore a database from multiple database dumped file1
|
||||
- name: Dump and Import | Test state=import to restore a database from multiple database dumped file1
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -247,12 +248,12 @@
|
|||
use_shell: no
|
||||
register: import_result
|
||||
|
||||
- name: assert output message restored a database from dump file1
|
||||
- name: Dump and Import | Assert output message restored a database from dump file1
|
||||
assert:
|
||||
that:
|
||||
- import_result is changed
|
||||
|
||||
- name: remove database
|
||||
- name: Dump and Import | Remove database
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -261,16 +262,16 @@
|
|||
name: '{{ db_name2 }}'
|
||||
state: absent
|
||||
|
||||
- name: run command to list databases
|
||||
- name: Dump and Import | Run command to list databases
|
||||
command: "{{ mysql_command }} \"-e show databases like 'data%'\""
|
||||
register: mysql_result
|
||||
|
||||
- name: assert that db_name2 database does not exist
|
||||
- name: Dump and Import | Assert that db_name2 database does not exist
|
||||
assert:
|
||||
that:
|
||||
- "'{{ db_name2 }}' not in mysql_result.stdout"
|
||||
|
||||
- name: test state=import to restore a database from dumped file2 (check mode)
|
||||
- name: Dump and Import | Test state=import to restore a database from dumped file2 (check mode)
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -282,21 +283,21 @@
|
|||
register: check_import_result
|
||||
check_mode: yes
|
||||
|
||||
- name: assert output message restored a database from dump file2 (check mode)
|
||||
- name: Dump and Import | Assert output message restored a database from dump file2 (check mode)
|
||||
assert:
|
||||
that:
|
||||
- check_import_result is changed
|
||||
|
||||
- name: run command to list databases
|
||||
- name: Dump and Import | Run command to list databases
|
||||
command: "{{ mysql_command }} \"-e show databases like 'data%'\""
|
||||
register: mysql_result
|
||||
|
||||
- name: assert that db_name2 database does not exist (check mode)
|
||||
- name: Dump and Import | Assert that db_name2 database does not exist (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "'{{ db_name2 }}' not in mysql_result.stdout"
|
||||
|
||||
- name: test state=import to restore a database from multiple database dumped file2
|
||||
- name: Dump and Import | Test state=import to restore a database from multiple database dumped file2
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -307,17 +308,17 @@
|
|||
target: '{{ dump_file2 }}'
|
||||
register: import_result2
|
||||
|
||||
- name: assert output message restored a database from dump file2
|
||||
- name: Dump and Import | Assert output message restored a database from dump file2
|
||||
assert:
|
||||
that:
|
||||
- import_result2 is changed
|
||||
- import_result2.db_list == ['{{ db_name2 }}']
|
||||
|
||||
- name: run command to list databases
|
||||
- name: Dump and Import | Run command to list databases
|
||||
command: "{{ mysql_command }} \"-e show databases like 'data%'\""
|
||||
register: mysql_result
|
||||
|
||||
- name: assert that db_name2 database does exist after import
|
||||
- name: Dump and Import | Assert that db_name2 database does exist after import
|
||||
assert:
|
||||
that:
|
||||
- "'{{ db_name2 }}' in mysql_result.stdout"
|
||||
|
@ -333,25 +334,25 @@
|
|||
target: '{{ db_file_name }}'
|
||||
register: result
|
||||
|
||||
- name: assert output message backup the database
|
||||
- name: Dump and Import | Assert output message backup the database
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- "result.db =='{{ db_name }}'"
|
||||
|
||||
# - name: assert database was backed up successfully
|
||||
# - name: Dump and Import | Assert database was backed up successfully
|
||||
# command: "file {{ db_file_name }}"
|
||||
# register: result
|
||||
#
|
||||
# - name: assert file format type
|
||||
# - name: Dump and Import | Assert file format type
|
||||
# assert:
|
||||
# that:
|
||||
# - "'{{ format_msg_type }}' in result.stdout"
|
||||
|
||||
- name: update database table employee
|
||||
- name: Dump and Import | Update database table employee
|
||||
command: "{{ mysql_command }} {{ db_name }} \"-e update employee set name='John Doe' where id=47\""
|
||||
|
||||
- name: test state=import to restore the database of type {{ format_type }} (expect changed=true)
|
||||
- name: Dump and Import | Test state=import to restore the database of type {{ format_type }} (expect changed=true)
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -362,16 +363,16 @@
|
|||
target: '{{ db_file_name }}'
|
||||
register: result
|
||||
|
||||
- name: assert output message restore the database
|
||||
- name: Dump and Import | Assert output message restore the database
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: select data from table employee
|
||||
- name: Dump and Import | Select data from table employee
|
||||
command: "{{ mysql_command }} {{ db_name }} \"-e select * from employee\""
|
||||
register: result
|
||||
|
||||
- name: assert data in database is from the restore database
|
||||
- name: Dump and Import | Assert data in database is from the restore database
|
||||
assert:
|
||||
that:
|
||||
- "'47' in result.stdout"
|
||||
|
@ -381,10 +382,10 @@
|
|||
# Test ``force`` parameter
|
||||
##########################
|
||||
|
||||
- name: create wrong sql file
|
||||
- name: Dump and Import | Create wrong sql file
|
||||
shell: echo 'CREATE TABLE hello (id int); CREATE ELBAT ehlo (int id);' >> '{{ wrong_sql_file }}'
|
||||
|
||||
- name: try to import without force parameter, must fail
|
||||
- name: Dump and Import | Try to import without force parameter, must fail
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -401,7 +402,7 @@
|
|||
that:
|
||||
- result is failed
|
||||
|
||||
- name: try to import with force parameter
|
||||
- name: Dump and Import | Try to import with force parameter
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -420,18 +421,18 @@
|
|||
########################
|
||||
# Test import with chdir
|
||||
|
||||
- name: Create dir
|
||||
- name: Dump and Import | Create dir
|
||||
file:
|
||||
path: ~/subdir
|
||||
state: directory
|
||||
|
||||
- name: Create test dump
|
||||
- name: Dump and Import | Create test dump
|
||||
shell: 'echo "SOURCE ./subdir_test.sql" > ~/original_test.sql'
|
||||
|
||||
- name: Create test source
|
||||
- name: Dump and Import | Create test source
|
||||
shell: 'echo "SELECT 1" > ~/subdir/subdir_test.sql'
|
||||
|
||||
- name: Try to restore without chdir argument, must fail
|
||||
- name: Dump and Import | Try to restore without chdir argument, must fail
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -447,7 +448,7 @@
|
|||
- result is failed
|
||||
- result.msg is search('Failed to open file')
|
||||
|
||||
- name: Restore with chdir argument, must pass
|
||||
- name: Dump and Import | Restore with chdir argument, must pass
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
@ -466,7 +467,7 @@
|
|||
# Clean up
|
||||
##########
|
||||
|
||||
- name: remove database name
|
||||
- name: Dump and Import | Clean up databases
|
||||
mysql_db:
|
||||
login_user: '{{ mysql_user }}'
|
||||
login_password: '{{ mysql_password }}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue