Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - support/testing for postgres 11 and 12 #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: attach build build_tester clean coverage create_network docs psql release_pypi release_pypitest release_quay remove_network start_postgres stop_postgres test test_one_pg_version test27 test36 view_docs wait_for_postgres

SUPPORTED_PG_VERSIONS ?= 9.5.13 9.6.4 10.4
SUPPORTED_PG_VERSIONS ?= 9.5.13 9.6.4 10.4 11.6 12.1
# The default Postgres that will be used in individual targets
POSTGRES_VERSION ?= 10.4

Expand Down
2 changes: 1 addition & 1 deletion pgbedrock/spec_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,4 +490,4 @@ def ensure_no_except_on_schema(spec):
if config and config.get('privileges'):
if config['privileges'].get('schemas') and config['privileges']['schemas'].get('except') and config['privileges']['schemas']['excepted']:
error_messages.append(EXCEPTED_SCHEMAS_MSG.format(rolename))
return error_messages
return error_messages
23 changes: 20 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ def drop_users_and_objects(cursor):
WHERE rolname NOT IN (
'test_user', 'postgres', 'pg_signal_backend',
-- Roles introduced in Postgres 10:
'pg_monitor', 'pg_read_all_settings', 'pg_read_all_stats', 'pg_stat_scan_tables'
'pg_monitor', 'pg_read_all_settings', 'pg_read_all_stats', 'pg_stat_scan_tables',
-- Roles introduced in Postgres 11:
'pg_execute_server_program', 'pg_read_server_files', 'pg_write_server_files'
);
""")
users = [u[0] for u in cursor.fetchall()]
Expand Down Expand Up @@ -96,12 +98,19 @@ def base_spec(cursor):
tables:
- information_schema.*
- pg_catalog.*

privileges:
schemas:
write:
- information_schema
- pg_catalog
- public
tables:
write:
- information_schema.*
except:
- information_schema.pg_replication_origin
- information_schema.sql_languages

test_user:
attributes:
Expand All @@ -112,8 +121,8 @@ def base_spec(cursor):

# Postgres 10 introduces several new roles that we have to account for
cursor.execute("SELECT substring(version from 'PostgreSQL ([0-9.]*) ') FROM version()")
pg_version = cursor.fetchone()[0]
if pg_version.startswith('10.'):
pg_version = int(cursor.fetchone()[0].split('.')[0])
if pg_version >= 10:
spec += dedent("""

pg_read_all_settings:
Expand All @@ -128,6 +137,14 @@ def base_spec(cursor):
- pg_stat_scan_tables
- pg_read_all_stats
""")
if pg_version >= 11:
spec += dedent("""
pg_execute_server_program:

pg_read_server_files:

pg_write_server_files:
""")

return spec

Expand Down