Added an EPAS 17 resql test case for builtin locale provider. #8095

This commit is contained in:
Pravesh Sharma 2024-11-21 11:21:05 +05:30 committed by GitHub
parent f23fe38e0b
commit 4dbfdd8740
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 613 additions and 0 deletions

View File

@ -0,0 +1,15 @@
-- Database: test_database_builtin_$%{}[]()&*^!@""""'`\/#
-- DROP DATABASE IF EXISTS "test_database_builtin_$%{}[]()&*^!@""""""""'`\/#";
CREATE DATABASE "test_database_builtin_$%{}[]()&*^!@""""""""'`\/#"
WITH
OWNER = enterprisedb
ENCODING = 'UTF8'
LC_COLLATE = '<LC_COLLATE>'
LC_CTYPE = '<LC_CTYPE>'
BUILTIN_LOCALE = 'C.UTF-8'
LOCALE_PROVIDER = 'builtin'
TABLESPACE = pg_default
CONNECTION LIMIT = -1
IS_TEMPLATE = False;

View File

@ -0,0 +1,13 @@
CREATE DATABASE "test_database_builtin_$%{}[]()&*^!@""""""""'`\/#"
TEMPLATE = template0
ENCODING = 'UTF8'
BUILTIN_LOCALE = 'C.UTF-8'
LOCALE_PROVIDER = 'builtin'
IS_TEMPLATE = False;
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON TABLES FROM PUBLIC;
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON SEQUENCES FROM PUBLIC;
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;

View File

@ -0,0 +1,585 @@
{
"scenarios": [
{
"type": "alter",
"name": "Alert default priviliges for functions",
"endpoint": "NODE-database.obj_id",
"sql_endpoint": "NODE-database.sql_id",
"msql_endpoint": "NODE-database.msql_id",
"TEST_DB_NAME": "<TEST_DB_NAME>",
"REPLACE_LOCALE": true,
"data": {
"deffuncacl": {
"deleted": [
{
"grantor": "enterprisedb",
"grantee": "PUBLIC",
"privileges": [
{
"privilege_type": "X",
"privilege": true,
"with_grant": false
}
],
"acltype": "defaultacls"
}
]
}
},
"expected_sql_file": "alter_default_db_privileges_function.sql",
"expected_msql_file": "alter_default_db_privileges_function_msql.sql"
},
{
"type": "alter",
"name": "Alert default privileges for tables",
"endpoint": "NODE-database.obj_id",
"sql_endpoint": "NODE-database.sql_id",
"TEST_DB_NAME": "<TEST_DB_NAME>",
"REPLACE_LOCALE": true,
"data": {
"deftblacl": {
"deleted": [
{
"grantor": "enterprisedb",
"grantee": "enterprisedb",
"privileges": [
{"privilege_type":"D","privilege":true,"with_grant":false},
{"privilege_type":"w","privilege":true,"with_grant":false}
],
"acltype": "deftblacl"
}
],
"added": [
{
"grantee": "PUBLIC",
"privileges": [
{
"privilege_type": "r",
"privilege": true,
"with_grant": false
}
],
"grantor": "enterprisedb"
}
]
}
},
"expected_sql_file": "alter_default_db_privileges_tables.sql"
},
{
"type": "alter",
"name": "Alert default privileges for sequences",
"endpoint": "NODE-database.obj_id",
"sql_endpoint": "NODE-database.sql_id",
"msql_endpoint": "NODE-database.msql_id",
"TEST_DB_NAME": "<TEST_DB_NAME>",
"REPLACE_LOCALE": true,
"data": {
"defseqacl": {
"deleted": [
{
"grantor": "enterprisedb",
"grantee": "enterprisedb",
"privileges": [
{
"privilege_type": "w",
"privilege": true,
"with_grant": false
}
],
"acltype": "defaultacls"
}
],
"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false},
{"privilege_type":"r","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]
},
"deftblacl": {"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
},
"expected_sql_file": "alter_default_db_privileges_sequences.sql",
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql"
},
{
"type": "alter",
"name": "Alert default privileges for types",
"endpoint": "NODE-database.obj_id",
"sql_endpoint": "NODE-database.sql_id",
"TEST_DB_NAME": "<TEST_DB_NAME>",
"REPLACE_LOCALE": true,
"data": {
"deftypeacl": {
"deleted": [
{
"grantor": "enterprisedb",
"grantee": "PUBLIC",
"privileges": [
{
"privilege_type": "U",
"privilege": true,
"with_grant": false
}
],
"acltype": "defaultacls"
}
]
}
},
"expected_sql_file": "alter_default_db_privileges_types.sql"
},
{
"type": "alter",
"name": "Alert default privileges reset all",
"endpoint": "NODE-database.obj_id",
"sql_endpoint": "NODE-database.sql_id",
"TEST_DB_NAME": "<TEST_DB_NAME>",
"REPLACE_LOCALE": true,
"data": {
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
"deftblacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false,"cid":"nn626"},{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn627"},{"privilege_type":"w","privilege":true,"with_grant":false,"cid":"nn628"},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
"defseqacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn673"},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
},
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
},
{
"type": "create",
"name": "Create Database with new options and libc",
"endpoint": "NODE-database.obj",
"sql_endpoint": "NODE-database.sql_id",
"msql_endpoint": "NODE-database.msql",
"REPLACE_LOCALE": true,
"data": {
"name": "test_database_$%{}[]()&*^!@\"\"\"\"'`\\/#",
"description": "This is a test comment",
"is_template": false,
"encoding": "UTF8",
"schema_res": [],
"nspacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "C",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
}],
"seclabels": [],
"deftblacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "a",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "r",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "w",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "d",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "D",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "x",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "t",
"privilege": true,
"with_grant": false
}]
}],
"defseqacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "r",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "w",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
}],
"deffuncacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "X",
"privilege": true,
"with_grant": false
}]
}],
"deftypeacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
}]
},
"expected_sql_file": "create_database_new_options_libc.sql",
"expected_msql_file": "create_database_new_options_libc_msql.sql"
},
{
"type": "delete",
"name": "Drop Database",
"endpoint": "NODE-database.delete_id",
"data": {
"name": "test_database_$%{}[]()&*^!@\"\"\"\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Database with icu options",
"endpoint": "NODE-database.obj",
"sql_endpoint": "NODE-database.sql_id",
"msql_endpoint": "NODE-database.msql",
"REPLACE_LOCALE": true,
"data": {
"name": "test_database_icu_$%{}[]()&*^!@\"\"\"\"'`\\/#",
"description": "This is a test comment",
"is_template": false,
"template": "template0",
"encoding": "UTF8",
"schema_res": [],
"datlocaleprovider": "icu",
"daticulocale": "en-US",
"nspacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "C",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
}],
"seclabels": [],
"deftblacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "a",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "r",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "w",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "d",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "D",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "x",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "t",
"privilege": true,
"with_grant": false
}]
}],
"defseqacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "r",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "w",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
}],
"deffuncacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "X",
"privilege": true,
"with_grant": false
}]
}],
"deftypeacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
}]
},
"expected_sql_file": "create_database_icu.sql",
"expected_msql_file": "create_database_icu_msql.sql"
},
{
"type": "delete",
"name": "Drop Database",
"endpoint": "NODE-database.delete_id",
"data": {
"name": "test_database_icu_$%{}[]()&*^!@\"\"\"\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Database with icu rules options",
"endpoint": "NODE-database.obj",
"sql_endpoint": "NODE-database.sql_id",
"msql_endpoint": "NODE-database.msql",
"REPLACE_LOCALE": true,
"data": {
"name": "test_database_icu_rules_$%{}[]()&*^!@\"\"\"\"'`\\/#",
"description": "This is a test comment",
"is_template": false,
"template": "template0",
"encoding": "UTF8",
"schema_res": [],
"datlocaleprovider": "icu",
"daticulocale": "und",
"daticurules": "&V << w <<< W",
"nspacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "C",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
}],
"seclabels": [],
"deftblacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "a",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "r",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "w",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "d",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "D",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "x",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "t",
"privilege": true,
"with_grant": false
}]
}],
"defseqacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "r",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "w",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
}],
"deffuncacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "X",
"privilege": true,
"with_grant": false
}]
}],
"deftypeacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
}]
},
"expected_sql_file": "create_database_icu_rules.sql",
"expected_msql_file": "create_database_icu_rules_msql.sql"
},
{
"type": "delete",
"name": "Drop Database",
"endpoint": "NODE-database.delete_id",
"data": {
"name": "test_database_icu_rules_$%{}[]()&*^!@\"\"\"\"'`\\/#"
}
},
{
"type": "create",
"name": "Create Database with builtin option",
"endpoint": "NODE-database.obj",
"sql_endpoint": "NODE-database.sql_id",
"msql_endpoint": "NODE-database.msql",
"REPLACE_LOCALE": true,
"data": {
"name": "test_database_builtin_$%{}[]()&*^!@\"\"\"\"'`\\/#",
"description": "This is a test comment",
"is_template": false,
"template": "template0",
"encoding": "UTF8",
"schema_res": [],
"datlocaleprovider": "builtin",
"datbuiltinlocale": "C.UTF-8",
"nspacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "C",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
}],
"seclabels": [],
"deftblacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "a",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "r",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "w",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "d",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "D",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "x",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "t",
"privilege": true,
"with_grant": false
}]
}],
"defseqacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "r",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "w",
"privilege": true,
"with_grant": false
}, {
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
}],
"deffuncacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "X",
"privilege": true,
"with_grant": false
}]
}],
"deftypeacl": [{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [{
"privilege_type": "U",
"privilege": true,
"with_grant": false
}]
}]
},
"expected_sql_file": "create_database_builtin.sql",
"expected_msql_file": "create_database_builtin_msql.sql"
},
{
"type": "delete",
"name": "Drop Database",
"endpoint": "NODE-database.delete_id",
"data": {
"name": "test_database_builtin_$%{}[]()&*^!@\"\"\"\"'`\\/#"
}
}
]
}