db17e88fd2
* New module postgresql_facts: Gathers facts about remote PostgreSQL instances * New module postgresql_facts: fix default values of function * New module postgresql_facts: add extension support * New module postgresql_facts: fixed typo * New module postgresql_facts: added integration test * New module postgresql_facts: fix test error * New module postgresql_facts: add info about min server version * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: added repl stat tables checks * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: ansible_facts -> postgresql_facts * New module postgresql_facts: fix ci New module postgresql_facts: revision for review New module postgresql_facts: revision for review, fix * fix doc * New module postgresql_facts: add data types to param dict * New module postgresql_facts: code refactoring * # This is a combination of 3 commits. # The first commit's message is: New module postgresql_facts: incl_subset => filter # This is the 2nd commit message: New module postgresql_facts: fix a typo # This is the 3rd commit message: New module postgresql_facts: fixes * New module postgresql_facts: incl_subset => filter New module postgresql_facts: fix a typo New module postgresql_facts: fixes Various cosmetic and doc changes * New module postgresql_facts: fix filter type * New module postgresql_facts: fix sanity * New module postgresql_facts: change ansible_facts to postgresql_facts * New module postgresql_facts: fix tests * New module postgresql_facts: fixes * New module postgresql_facts: fixes * New module postgresql_facts: fixes * New module postgresql_facts: doc fixes * New module postgresql_facts: added pretty_val * New module postgresql_facts: added pending restart * New module postgresql_facts: fix documentation * New module postgresql_facts: fix documentation * New module postgresql_facts: fixes by KN * New module postgresql_facts: fixed sanity * New module postgresql_facts: fixed tests
108 lines
2.7 KiB
YAML
108 lines
2.7 KiB
YAML
# Test code for the postgresql_facts module
|
|
# 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)
|
|
|
|
- name: postgresql_facts - create role to check session_role
|
|
become_user: "{{ pg_user }}"
|
|
become: yes
|
|
postgresql_user:
|
|
db: "{{ db_default }}"
|
|
login_user: "{{ pg_user }}"
|
|
name: session_superuser
|
|
role_attr_flags: SUPERUSER
|
|
|
|
- name: postgresql_facts - test return values and session_role param
|
|
become_user: "{{ pg_user }}"
|
|
become: yes
|
|
postgresql_facts:
|
|
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
|
|
|
|
- name: postgresql_facts - check filter param passed by list
|
|
become_user: "{{ pg_user }}"
|
|
become: yes
|
|
postgresql_facts:
|
|
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 == {}
|
|
|
|
- name: postgresql_facts - check filter param passed by string
|
|
become_user: "{{ pg_user }}"
|
|
become: yes
|
|
postgresql_facts:
|
|
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 == {}
|
|
|
|
- name: postgresql_facts - check filter param passed by string
|
|
become_user: "{{ pg_user }}"
|
|
become: yes
|
|
postgresql_facts:
|
|
db: "{{ db_default }}"
|
|
filter: ver*
|
|
login_user: "{{ pg_user }}"
|
|
register: result
|
|
ignore_errors: yes
|
|
|
|
- assert:
|
|
that:
|
|
- result.version
|
|
- result.roles == {}
|
|
|
|
- name: postgresql_facts - check excluding filter param passed by list
|
|
become_user: "{{ pg_user }}"
|
|
become: yes
|
|
postgresql_facts:
|
|
db: "{{ db_default }}"
|
|
filter:
|
|
- "!ver*"
|
|
- "!rol*"
|
|
login_user: "{{ pg_user }}"
|
|
register: result
|
|
ignore_errors: yes
|
|
|
|
- assert:
|
|
that:
|
|
- result.version == {}
|
|
- result.roles == {}
|
|
- result.databases
|