Add RE-SQL tests for Roles and Resource Groups. Fixes #4415

This commit is contained in:
Murtuza Zabuawala
2019-07-03 14:38:29 +01:00
committed by Dave Page
parent f4bc4475cd
commit 588e3814d1
33 changed files with 612 additions and 27 deletions

View File

@@ -0,0 +1,12 @@
-- Role: test_resql_role_pg91
-- DROP ROLE test_resql_role_pg91;
CREATE ROLE test_resql_role_pg91 WITH
NOLOGIN
NOSUPERUSER
INHERIT
NOCREATEDB
NOCREATEROLE
NOREPLICATION;
COMMENT ON ROLE test_resql_role_pg91 IS 'This is detailed description';

View File

@@ -0,0 +1,12 @@
-- Role: new_test_resql_role_pg91
-- DROP ROLE new_test_resql_role_pg91;
CREATE ROLE new_test_resql_role_pg91 WITH
NOLOGIN
NOSUPERUSER
INHERIT
NOCREATEDB
NOCREATEROLE
NOREPLICATION;
COMMENT ON ROLE new_test_resql_role_pg91 IS 'This is detailed description';

View File

@@ -0,0 +1,15 @@
-- Role: new_test_resql_role_pg91
-- DROP ROLE new_test_resql_role_pg91;
CREATE ROLE new_test_resql_role_pg91 WITH
NOLOGIN
SUPERUSER
INHERIT
CREATEDB
NOCREATEROLE
NOREPLICATION;
UPDATE pg_authid SET rolcatupdate=false WHERE rolname = new_test_resql_role_pg91;
COMMENT ON ROLE new_test_resql_role_pg91 IS 'This is detailed description';

View File

@@ -0,0 +1,15 @@
-- User: test_resql_user_pg91
-- DROP USER test_resql_user_pg91;
CREATE USER test_resql_user_pg91 WITH
LOGIN
SUPERUSER
INHERIT
CREATEDB
CREATEROLE
REPLICATION;
UPDATE pg_authid SET rolcatupdate=false WHERE rolname = test_resql_user_pg91;
COMMENT ON ROLE test_resql_user_pg91 IS 'This is detailed description';

View File

@@ -0,0 +1,15 @@
-- User: new_test_resql_user_pg91
-- DROP USER new_test_resql_user_pg91;
CREATE USER new_test_resql_user_pg91 WITH
LOGIN
SUPERUSER
INHERIT
CREATEDB
CREATEROLE
REPLICATION;
UPDATE pg_authid SET rolcatupdate=false WHERE rolname = new_test_resql_user_pg91;
COMMENT ON ROLE new_test_resql_user_pg91 IS 'This is detailed description';

View File

@@ -0,0 +1,12 @@
-- User: new_test_resql_user_pg91
-- DROP USER new_test_resql_user_pg91;
CREATE USER new_test_resql_user_pg91 WITH
LOGIN
NOSUPERUSER
INHERIT
NOCREATEDB
CREATEROLE
REPLICATION;
COMMENT ON ROLE new_test_resql_user_pg91 IS 'This is detailed description';

View File

@@ -0,0 +1,10 @@
-- Role: test_resql_role_pg91
-- DROP ROLE test_resql_role_pg91;
CREATE ROLE test_resql_role_pg91 WITH
NOLOGIN
NOSUPERUSER
INHERIT
NOCREATEDB
NOCREATEROLE
NOREPLICATION;

View File

@@ -0,0 +1,13 @@
-- User: test_resql_user_pg91
-- DROP USER test_resql_user_pg91;
CREATE USER test_resql_user_pg91 WITH
LOGIN
SUPERUSER
INHERIT
CREATEDB
CREATEROLE
REPLICATION;
UPDATE pg_authid SET rolcatupdate=false WHERE rolname = test_resql_user_pg91;

View File

@@ -0,0 +1,124 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Role",
"endpoint": "NODE-role.obj",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"rolname": "test_resql_role_pg91",
"rolcanlogin": false,
"rolpassword": null,
"rolconnlimit": -1,
"rolsuper": false,
"rolcreaterole": false,
"rolcreatedb": false,
"rolinherit": true,
"rolcatupdate": false,
"rolreplication": false,
"rolmembership": [],
"rolvaliduntil": null,
"seclabels": [],
"variables": []
},
"expected_sql_file": "create_role.sql"
},
{
"type": "alter",
"name": "Alter Role description",
"endpoint": "NODE-role.obj_id",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"description": "This is detailed description"
},
"expected_sql_file": "alter_role_description.sql"
},
{
"type": "alter",
"name": "Alter Role name",
"endpoint": "NODE-role.obj_id",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"rolname": "new_test_resql_role_pg91"
},
"expected_sql_file": "alter_role_name.sql"
},
{
"type": "alter",
"name": "Alter Role superuser, createdb etc options",
"endpoint": "NODE-role.obj_id",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"rolsuper": true,
"rolcreatedb": true
},
"expected_sql_file": "alter_role_options.sql"
},
{
"type": "delete",
"name": "Drop Role",
"endpoint": "NODE-role.obj_id",
"data": {}
},
{
"type": "create",
"name": "Create User",
"endpoint": "NODE-role.obj",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"rolname": "test_resql_user_pg91",
"rolcanlogin": true,
"rolpassword": null,
"rolconnlimit": -1,
"rolsuper": true,
"rolcreaterole": true,
"rolcreatedb": true,
"rolinherit": true,
"rolcatupdate": true,
"rolreplication": true,
"rolmembership": [],
"rolvaliduntil": null,
"seclabels": [],
"variables": []
},
"expected_sql_file": "create_user.sql"
},
{
"type": "alter",
"name": "Alter User description",
"endpoint": "NODE-role.obj_id",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"description": "This is detailed description"
},
"expected_sql_file": "alter_user_description.sql"
},
{
"type": "alter",
"name": "Alter User name",
"endpoint": "NODE-role.obj_id",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"rolname": "new_test_resql_user_pg91"
},
"expected_sql_file": "alter_user_name.sql"
},
{
"type": "alter",
"name": "Alter User superuser, createdb etc options",
"endpoint": "NODE-role.obj_id",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"rolsuper": false,
"rolcreatedb": false
},
"expected_sql_file": "alter_user_options.sql"
},
{
"type": "delete",
"name": "Drop User",
"endpoint": "NODE-role.obj_id",
"data": {}
}
]
}

View File

@@ -0,0 +1,12 @@
-- Role: test_resql_role_pg95
-- DROP ROLE test_resql_role_pg95;
CREATE ROLE test_resql_role_pg95 WITH
NOLOGIN
NOSUPERUSER
INHERIT
NOCREATEDB
NOCREATEROLE
NOREPLICATION;
COMMENT ON ROLE test_resql_role_pg95 IS 'This is detailed description';

View File

@@ -0,0 +1,12 @@
-- Role: new_test_resql_role_pg95
-- DROP ROLE new_test_resql_role_pg95;
CREATE ROLE new_test_resql_role_pg95 WITH
NOLOGIN
NOSUPERUSER
INHERIT
NOCREATEDB
NOCREATEROLE
NOREPLICATION;
COMMENT ON ROLE new_test_resql_role_pg95 IS 'This is detailed description';

View File

@@ -0,0 +1,12 @@
-- Role: new_test_resql_role_pg95
-- DROP ROLE new_test_resql_role_pg95;
CREATE ROLE new_test_resql_role_pg95 WITH
NOLOGIN
SUPERUSER
INHERIT
CREATEDB
NOCREATEROLE
NOREPLICATION;
COMMENT ON ROLE new_test_resql_role_pg95 IS 'This is detailed description';

View File

@@ -0,0 +1,12 @@
-- User: test_resql_user_pg95
-- DROP USER test_resql_user_pg95;
CREATE USER test_resql_user_pg95 WITH
LOGIN
SUPERUSER
INHERIT
CREATEDB
CREATEROLE
REPLICATION;
COMMENT ON ROLE test_resql_user_pg95 IS 'This is detailed description';

View File

@@ -0,0 +1,12 @@
-- User: new_test_resql_user_pg95
-- DROP USER new_test_resql_user_pg95;
CREATE USER new_test_resql_user_pg95 WITH
LOGIN
SUPERUSER
INHERIT
CREATEDB
CREATEROLE
REPLICATION;
COMMENT ON ROLE new_test_resql_user_pg95 IS 'This is detailed description';

View File

@@ -0,0 +1,12 @@
-- User: new_test_resql_user_pg95
-- DROP USER new_test_resql_user_pg95;
CREATE USER new_test_resql_user_pg95 WITH
LOGIN
NOSUPERUSER
INHERIT
NOCREATEDB
CREATEROLE
REPLICATION;
COMMENT ON ROLE new_test_resql_user_pg95 IS 'This is detailed description';

View File

@@ -0,0 +1,10 @@
-- Role: test_resql_role_pg95
-- DROP ROLE test_resql_role_pg95;
CREATE ROLE test_resql_role_pg95 WITH
NOLOGIN
NOSUPERUSER
INHERIT
NOCREATEDB
NOCREATEROLE
NOREPLICATION;

View File

@@ -0,0 +1,10 @@
-- User: test_resql_user_pg95
-- DROP USER test_resql_user_pg95;
CREATE USER test_resql_user_pg95 WITH
LOGIN
SUPERUSER
INHERIT
CREATEDB
CREATEROLE
REPLICATION;

View File

@@ -0,0 +1,124 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Role",
"endpoint": "NODE-role.obj",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"rolname": "test_resql_role_pg95",
"rolcanlogin": false,
"rolpassword": null,
"rolconnlimit": -1,
"rolsuper": false,
"rolcreaterole": false,
"rolcreatedb": false,
"rolinherit": true,
"rolcatupdate": false,
"rolreplication": false,
"rolmembership": [],
"rolvaliduntil": null,
"seclabels": [],
"variables": []
},
"expected_sql_file": "create_role.sql"
},
{
"type": "alter",
"name": "Alter Role description",
"endpoint": "NODE-role.obj_id",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"description": "This is detailed description"
},
"expected_sql_file": "alter_role_description.sql"
},
{
"type": "alter",
"name": "Alter Role name",
"endpoint": "NODE-role.obj_id",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"rolname": "new_test_resql_role_pg95"
},
"expected_sql_file": "alter_role_name.sql"
},
{
"type": "alter",
"name": "Alter Role superuser, createdb etc options",
"endpoint": "NODE-role.obj_id",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"rolsuper": true,
"rolcreatedb": true
},
"expected_sql_file": "alter_role_options.sql"
},
{
"type": "delete",
"name": "Drop Role",
"endpoint": "NODE-role.obj_id",
"data": {}
},
{
"type": "create",
"name": "Create User",
"endpoint": "NODE-role.obj",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"rolname": "test_resql_user_pg95",
"rolcanlogin": true,
"rolpassword": null,
"rolconnlimit": -1,
"rolsuper": true,
"rolcreaterole": true,
"rolcreatedb": true,
"rolinherit": true,
"rolcatupdate": true,
"rolreplication": true,
"rolmembership": [],
"rolvaliduntil": null,
"seclabels": [],
"variables": []
},
"expected_sql_file": "create_user.sql"
},
{
"type": "alter",
"name": "Alter User description",
"endpoint": "NODE-role.obj_id",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"description": "This is detailed description"
},
"expected_sql_file": "alter_user_description.sql"
},
{
"type": "alter",
"name": "Alter User name",
"endpoint": "NODE-role.obj_id",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"rolname": "new_test_resql_user_pg95"
},
"expected_sql_file": "alter_user_name.sql"
},
{
"type": "alter",
"name": "Alter User superuser, createdb etc options",
"endpoint": "NODE-role.obj_id",
"sql_endpoint": "NODE-role.sql_id",
"data": {
"rolsuper": false,
"rolcreatedb": false
},
"expected_sql_file": "alter_user_options.sql"
},
{
"type": "delete",
"name": "Drop User",
"endpoint": "NODE-role.obj_id",
"data": {}
}
]
}