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.
ansible/test/integration/targets/postgresql/tasks/main.yml

136 lines
3.7 KiB
YAML

# Unsorted tests that were moved from here to unsorted.yml
- import_tasks: unsorted.yml
# Test ssl.
# Restricted using Debian family because of there are errors on other distributions
# that not related with PostgreSQL or psycopg2 SSL support.
# The tests' key point is to be sure that ssl options work in general
- import_tasks: ssl.yml
when:
- ansible_os_family == 'Debian'
- postgres_version_resp.stdout is version('9.4', '>=')
# Test postgresql_publication
- import_tasks: postgresql_publication.yml
when: postgres_version_resp.stdout is version('10', '>=')
- include_tasks: '{{ loop_item }}'
loop:
# Test postgresql_set
- postgresql_set.yml
# Test postgresql_copy module
- postgresql_copy.yml
# Test postgresql_slot module.
# Physical replication slots are available from PostgreSQL 9.4
- postgresql_slot.yml
loop_control:
loop_var: loop_item
when: postgres_version_resp.stdout is version('9.4', '>=')
- include_tasks: '{{ loop_item }}'
loop:
# Test postgresql_user module
- postgresql_user.yml
# Verify different session_role scenarios
- session_role.yml
# Test postgresql_idx module
- postgresql_idx.yml
# Test postgresql_query module
- postgresql_query.yml
# Test postgresql_tablespace module
- postgresql_tablespace.yml
# Test postgresql_db module, specific options
- postgresql_db.yml
# Test postgresql_privs
- postgresql_privs.yml
# Test postgresql_info module
- postgresql_info.yml
# Test postgresql_schema module
- postgresql_schema.yml
# Test postgresql_membership module
- postgresql_membership.yml
# Test postgresql_table module
- postgresql_table.yml
# Test postgresql_owner module
- postgresql_owner.yml
# Test postgres_pg_hba module
- postgresql_pg_hba.yml
loop_control:
loop_var: loop_item
# Test postgresql_ping module
- import_tasks: postgresql_ping.yml
vars:
db_name_nonexist: fake_db
New module postgresql_facts: Gathers facts about PostgreSQL servers. (#51164) * 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
6 years ago
# Test default_privs with target_role
- import_tasks: test_target_role.yml
when: postgres_version_resp.stdout is version('9.1', '>=')
# Test postgresql_sequence module
- import_tasks: postgresql_sequence.yml
when: postgres_version_resp.stdout is version('9.0', '>=')
# Test postgresql_ext.
# pg_extension system view is available from PG 9.1.
# The tests are restricted by Fedora because there will be errors related with
# attempts to change the environment during postgis installation or
# missing postgis package in repositories.
# Anyway, these tests completely depend on Postgres version,
# not specific distributions.
- import_tasks: postgresql_ext.yml
when:
- postgres_version_resp.stdout is version('9.1', '>=')
- ansible_distribution == 'Fedora'
- import_tasks: postgresql_ext_version_opt.yml
when: ansible_distribution == 'Ubuntu'
# Test postgresql_lang module.
# To implement tests, it needs to install some additional packages
# that may cause problems on different distributions,
# so I restricted the tests using CentOS because the results
# depend only on Postgres version
# (CentOS 6 repo contains the oldest PG version in these tests - 9.0):
- import_tasks: postgresql_lang.yml
when: ansible_distribution == 'CentOS'
postgres_db: add dump and restore support (#20627) * Feature #2731: added postgres import and dump * Feature #2731: be more permissive of arguments ``` hacking/test-module -m ./ppostgresql_db.py -a "db=example state=dump target=/tmp/out"` ``` failed previously since host, user, and port were required as keywords in the pg_dump / pg_import methods. * Feature #2731: fixed doc string for validate-modules ``` $ ansible-validate-modules database/postgresql/ ``` now passes. * Feature #2731: disable 'password' for dump/restore * Feature #2731: bump added version to 2.3 * Feature #2731: replace db_import with db_restore * Feature #2731: add missing version description * Feature #2731: fix 'state' description * Feature #2731: fix pep8 issues * Feature #2731: put state documentation in a single string * Bump added version from 2.3 to 2.4 * Fix pep8 and pylint errors * Attempt yaml formatting of documentation string * Add integration tests for postgres_db:dump/restore * Update dump/restore logic to support new kw-args Also attempt to support password; integration tests are still failing. * Revert to postgres user for dump/restore Passing PGPASSWORD is not working for subprocesses. For the moment, reverting to the strategy of failing if login_password is set and using `postgres` for all testing of dump/restore. * Various cleanups to have tests passing * Working tests for {sql,tar} x {,bz2,gz,xz} * Use pg_user to support FreeBSD * Revert login_ prefixes and re-enable password support All `login_` keywords are mapped to their non-prefix versions so the previous changes were effectively using `postgres` for all actions. With the proper keywords, PGPASSWORD-passing to the subprocess is now working. * Optionally add password environ_update doesn't handle None values in the dictionary to be added to the environment. Adding check. * Quick fixes * Refactor login arguments after fixes from pchauncey The fixes introduced by pchaunchy pointed to further issues (like no --dbname on PG<=9.2) with the login parameters. This refactors them and adds further tests. Note: this will still not pass integration tests due to a further issue with pg_dump as a non-admin user: pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 1925; 0 0 COMMENT EXTENSION plpgsql pg_restore: [archiver (db)] could not execute query: ERROR: must be owner of extension plpgsql * Introduce target_opts for passing limiting dumped/restored schemas The current integration tests (PG version and template DBs) don't permit a regular user (`{{ db_user1 }}`) access to plpgsql causing restores to fail. By adding an option for passing arbitrary args to pg_dump and pg_restore, testing is made easier. This also paves the way for `-j` usage, once the PG version is bumped.
7 years ago
# dump/restore tests per format
# ============================================================
- include_tasks: state_dump_restore.yml
vars:
test_fixture: user
file: '{{ loop_item }}'
loop:
- dbdata.sql
- dbdata.sql.gz
- dbdata.sql.bz2
- dbdata.sql.xz
- dbdata.tar
- dbdata.tar.gz
- dbdata.tar.bz2
- dbdata.tar.xz
loop_control:
loop_var: loop_item
postgres_db: add dump and restore support (#20627) * Feature #2731: added postgres import and dump * Feature #2731: be more permissive of arguments ``` hacking/test-module -m ./ppostgresql_db.py -a "db=example state=dump target=/tmp/out"` ``` failed previously since host, user, and port were required as keywords in the pg_dump / pg_import methods. * Feature #2731: fixed doc string for validate-modules ``` $ ansible-validate-modules database/postgresql/ ``` now passes. * Feature #2731: disable 'password' for dump/restore * Feature #2731: bump added version to 2.3 * Feature #2731: replace db_import with db_restore * Feature #2731: add missing version description * Feature #2731: fix 'state' description * Feature #2731: fix pep8 issues * Feature #2731: put state documentation in a single string * Bump added version from 2.3 to 2.4 * Fix pep8 and pylint errors * Attempt yaml formatting of documentation string * Add integration tests for postgres_db:dump/restore * Update dump/restore logic to support new kw-args Also attempt to support password; integration tests are still failing. * Revert to postgres user for dump/restore Passing PGPASSWORD is not working for subprocesses. For the moment, reverting to the strategy of failing if login_password is set and using `postgres` for all testing of dump/restore. * Various cleanups to have tests passing * Working tests for {sql,tar} x {,bz2,gz,xz} * Use pg_user to support FreeBSD * Revert login_ prefixes and re-enable password support All `login_` keywords are mapped to their non-prefix versions so the previous changes were effectively using `postgres` for all actions. With the proper keywords, PGPASSWORD-passing to the subprocess is now working. * Optionally add password environ_update doesn't handle None values in the dictionary to be added to the environment. Adding check. * Quick fixes * Refactor login arguments after fixes from pchauncey The fixes introduced by pchaunchy pointed to further issues (like no --dbname on PG<=9.2) with the login parameters. This refactors them and adds further tests. Note: this will still not pass integration tests due to a further issue with pg_dump as a non-admin user: pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 1925; 0 0 COMMENT EXTENSION plpgsql pg_restore: [archiver (db)] could not execute query: ERROR: must be owner of extension plpgsql * Introduce target_opts for passing limiting dumped/restored schemas The current integration tests (PG version and template DBs) don't permit a regular user (`{{ db_user1 }}`) access to plpgsql causing restores to fail. By adding an option for passing arbitrary args to pg_dump and pg_restore, testing is made easier. This also paves the way for `-j` usage, once the PG version is bumped.
7 years ago
# dump/restore tests per other logins
# ============================================================
- import_tasks: state_dump_restore.yml
vars:
file: dbdata.tar
test_fixture: admin