mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
2.7 KiB
YAML
109 lines
2.7 KiB
YAML
6 years ago
|
# Test code for the postgresql_info module
|
||
6 years ago
|
# Copyright: (c) 2019, Andrew Klychkov (@Andersson007) <aaklychkov@mail.ru>
|
||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||
|
|
||
6 years ago
|
- name: postgresql_info - create role to check session_role
|
||
6 years ago
|
become_user: "{{ pg_user }}"
|
||
|
become: yes
|
||
|
postgresql_user:
|
||
|
db: "{{ db_default }}"
|
||
|
login_user: "{{ pg_user }}"
|
||
|
name: session_superuser
|
||
|
role_attr_flags: SUPERUSER
|
||
|
|
||
6 years ago
|
- name: postgresql_info - test return values and session_role param
|
||
6 years ago
|
become_user: "{{ pg_user }}"
|
||
|
become: yes
|
||
6 years ago
|
postgresql_info:
|
||
6 years ago
|
db: "{{ db_default }}"
|
||
|
login_user: "{{ pg_user }}"
|
||
|
session_role: session_superuser
|
||
|
register: result
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- result.version != {}
|
||
|
- result.databases.{{ db_default }}.collate
|
||
|
- result.databases.{{ db_default }}.languages
|
||
|
- result.databases.{{ db_default }}.namespaces
|
||
|
- result.databases.{{ db_default }}.extensions
|
||
|
- result.settings
|
||
|
- result.tablespaces
|
||
|
- result.roles
|
||
|
|
||
6 years ago
|
- name: postgresql_info - check filter param passed by list
|
||
6 years ago
|
become_user: "{{ pg_user }}"
|
||
|
become: yes
|
||
6 years ago
|
postgresql_info:
|
||
6 years ago
|
db: "{{ db_default }}"
|
||
|
login_user: "{{ pg_user }}"
|
||
|
filter:
|
||
|
- ver*
|
||
|
- rol*
|
||
|
register: result
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- result.version != {}
|
||
|
- result.roles
|
||
|
- result.databases == {}
|
||
|
- result.repl_slots == {}
|
||
|
- result.replications == {}
|
||
|
- result.settings == {}
|
||
|
- result.tablespaces == {}
|
||
|
|
||
6 years ago
|
- name: postgresql_info - check filter param passed by string
|
||
6 years ago
|
become_user: "{{ pg_user }}"
|
||
|
become: yes
|
||
6 years ago
|
postgresql_info:
|
||
6 years ago
|
db: "{{ db_default }}"
|
||
|
filter: ver*,role*
|
||
|
login_user: "{{ pg_user }}"
|
||
|
register: result
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- result.version != {}
|
||
|
- result.roles
|
||
|
- result.databases == {}
|
||
|
- result.repl_slots == {}
|
||
|
- result.replications == {}
|
||
|
- result.settings == {}
|
||
|
- result.tablespaces == {}
|
||
|
|
||
6 years ago
|
- name: postgresql_info - check filter param passed by string
|
||
6 years ago
|
become_user: "{{ pg_user }}"
|
||
|
become: yes
|
||
6 years ago
|
postgresql_info:
|
||
6 years ago
|
db: "{{ db_default }}"
|
||
|
filter: ver*
|
||
|
login_user: "{{ pg_user }}"
|
||
|
register: result
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- result.version
|
||
|
- result.roles == {}
|
||
|
|
||
6 years ago
|
- name: postgresql_info - check excluding filter param passed by list
|
||
6 years ago
|
become_user: "{{ pg_user }}"
|
||
|
become: yes
|
||
6 years ago
|
postgresql_info:
|
||
6 years ago
|
db: "{{ db_default }}"
|
||
|
filter:
|
||
|
- "!ver*"
|
||
|
- "!rol*"
|
||
|
login_user: "{{ pg_user }}"
|
||
|
register: result
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- result.version == {}
|
||
|
- result.roles == {}
|
||
|
- result.databases
|