mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
New module postgresql_ping: Checks remote PostgreSQL server availability. (#51477)
* New module postgresql_ping: simple module to check remote PostgreSQL server availability. * New module postgresql_ping: simple module to check remote PostgreSQL server availability, doc fixes * postgresql_ping: added integration tests * New module postgresql_ping: misc changes * New module postgresql_ping: change return suit * New module postgresql_ping: tests reformatting, return value * Various cosmetic/documentation fixes * A few more fixes * And even more cleanups * Fix PEP8 issue
This commit is contained in:
committed by
John R Barker
parent
61abbfc269
commit
e246e74843
@@ -0,0 +1,35 @@
|
||||
# Test code for the postgresql_ping 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_ping - test return values
|
||||
become_user: "{{ pg_user }}"
|
||||
become: yes
|
||||
postgresql_ping:
|
||||
db: "{{ db_default }}"
|
||||
login_user: "{{ pg_user }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.is_available == true
|
||||
- result.server_version != {}
|
||||
- result.server_version.major != false
|
||||
- result.server_version.minor != false
|
||||
- result.changed == false
|
||||
|
||||
- name: postgresql_ping - check ping of non-existing database doesn't return anything
|
||||
become_user: "{{ pg_user }}"
|
||||
become: yes
|
||||
postgresql_ping:
|
||||
db: "{{ db_name_nonexist }}"
|
||||
login_user: "{{ pg_user }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.is_available == false
|
||||
- result.server_version == {}
|
||||
- result.changed == false
|
||||
Reference in New Issue
Block a user