2019-07-17 17:00:40 +02:00
|
|
|
# Unsorted tests that were moved from here to unsorted.yml
|
|
|
|
- import_tasks: unsorted.yml
|
2014-12-02 03:57:40 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# 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', '>=')
|
|
|
|
|
|
|
|
- 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', '>=')
|
2014-12-02 03:57:40 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
- include_tasks: '{{ loop_item }}'
|
|
|
|
loop:
|
|
|
|
# Test postgresql_user module
|
|
|
|
- postgresql_user.yml
|
2019-03-22 13:51:39 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Verify different session_role scenarios
|
|
|
|
- session_role.yml
|
2019-03-22 13:51:39 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Test postgresql_idx module
|
|
|
|
- postgresql_idx.yml
|
2019-03-22 13:51:39 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Test postgresql_query module
|
|
|
|
- postgresql_query.yml
|
2019-03-22 13:51:39 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Test postgresql_tablespace module
|
|
|
|
- postgresql_tablespace.yml
|
2014-12-02 03:57:40 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Test postgresql_db module, specific options
|
|
|
|
- postgresql_db.yml
|
2014-12-02 03:57:40 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Test postgresql_privs
|
|
|
|
- postgresql_privs.yml
|
2014-12-02 03:57:40 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Test postgresql_info module
|
|
|
|
- postgresql_info.yml
|
2014-12-02 03:57:40 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Test postgresql_schema module
|
|
|
|
- postgresql_schema.yml
|
2014-12-02 03:57:40 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Test postgresql_membership module
|
|
|
|
- postgresql_membership.yml
|
2018-10-17 06:01:11 +02:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Test postgresql_table module
|
|
|
|
- postgresql_table.yml
|
2018-10-17 06:01:11 +02:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Test postgresql_owner module
|
|
|
|
- postgresql_owner.yml
|
2018-10-17 06:01:11 +02:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Test postgres_pg_hba module
|
|
|
|
- postgresql_pg_hba.yml
|
|
|
|
loop_control:
|
|
|
|
loop_var: loop_item
|
2014-12-02 03:57:40 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
# Test postgresql_ping module
|
|
|
|
- import_tasks: postgresql_ping.yml
|
2017-06-11 23:48:39 +02:00
|
|
|
vars:
|
2019-07-17 17:00:40 +02:00
|
|
|
db_name_nonexist: fake_db
|
2019-03-18 12:31:32 +01:00
|
|
|
|
2019-03-21 14:26:44 +01:00
|
|
|
# Test default_privs with target_role
|
2019-07-17 17:00:40 +02:00
|
|
|
- import_tasks: test_target_role.yml
|
2019-03-21 14:26:44 +01:00
|
|
|
when: postgres_version_resp.stdout is version('9.1', '>=')
|
|
|
|
|
2019-06-07 13:34:57 +02:00
|
|
|
# Test postgresql_sequence module
|
2019-07-17 17:00:40 +02:00
|
|
|
- import_tasks: postgresql_sequence.yml
|
2019-06-07 13:34:57 +02:00
|
|
|
when: postgres_version_resp.stdout is version('9.0', '>=')
|
|
|
|
|
2019-03-22 13:39:33 +01:00
|
|
|
# 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.
|
2019-07-17 17:00:40 +02:00
|
|
|
- import_tasks: postgresql_ext.yml
|
|
|
|
when:
|
|
|
|
- postgres_version_resp.stdout is version('9.1', '>=')
|
|
|
|
- ansible_distribution == 'Fedora'
|
2019-03-22 13:39:33 +01:00
|
|
|
|
2019-07-17 17:00:40 +02:00
|
|
|
- import_tasks: postgresql_ext_version_opt.yml
|
2019-07-02 15:24:46 +02:00
|
|
|
when: ansible_distribution == 'Ubuntu'
|
|
|
|
|
2019-04-01 15:39:00 +02:00
|
|
|
# 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):
|
2019-07-17 17:00:40 +02:00
|
|
|
- import_tasks: postgresql_lang.yml
|
2019-04-01 15:39:00 +02:00
|
|
|
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.
2017-07-10 09:05:42 +02:00
|
|
|
# dump/restore tests per format
|
|
|
|
# ============================================================
|
2019-07-17 17:00:40 +02:00
|
|
|
- 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.
2017-07-10 09:05:42 +02:00
|
|
|
|
|
|
|
# dump/restore tests per other logins
|
|
|
|
# ============================================================
|
2019-07-17 17:00:40 +02:00
|
|
|
- import_tasks: state_dump_restore.yml
|
|
|
|
vars:
|
|
|
|
file: dbdata.tar
|
|
|
|
test_fixture: admin
|