Skip to content

Commit

Permalink
Update test files by removing set_config calls (babelfish-for-postgre…
Browse files Browse the repository at this point in the history
…sql#3313)

As part of babelfish-for-postgresql#3096, we restricted setting of few configurations like role, migration mode etc. We ignored few files temporarily to get us unblocked.
This commit fixes 2 such test files:

BABEL-1435
BABEL-1446
Signed-off-by: Shameem Ahmed [email protected]

Signed-off-by: Shameem Ahmed <[email protected]>
  • Loading branch information
ahmed-shameem authored Dec 30, 2024
1 parent c5a9268 commit 3e8a46f
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 298 deletions.
121 changes: 0 additions & 121 deletions test/JDBC/expected/BABEL-1435.out
Original file line number Diff line number Diff line change
Expand Up @@ -159,124 +159,3 @@ GO

DROP DATABASE db1;
GO

-- Set current_user for testing db mode
IF (SELECT 1 FROM pg_roles WHERE rolname='jdbc_user') = 1
BEGIN
WITH SET_CTE
AS
(SELECT set_config('role', 'jdbc_user', false))
SELECT NULL
FROM SET_CTE
END
ELSE
BEGIN
WITH SET_CTE
AS
(SELECT set_config('role', 'babeltestuser', false))
SELECT NULL
FROM SET_CTE
END
GO
~~START~~
int
<NULL>
~~END~~


-- test multi-db mode
SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false);
GO
~~START~~
text
multi-db
~~END~~


SELECT name FROM sys.sysdatabases ORDER BY name;
GO
~~START~~
text
master
msdb
tempdb
~~END~~


CREATE DATABASE db1;
GO

-- test error
CREATE DATABASE db1;
GO
~~ERROR (Code: 33557097)~~

~~ERROR (Message: Database 'db1' already exists. Choose a different database name.)~~


CREATE DATABASE db2;
GO

SELECT COUNT(*) FROM pg_roles where rolname = 'db1_dbo';
SELECT COUNT(*) FROM pg_roles where rolname = 'db1_db_owner';
SELECT COUNT(*) FROM pg_namespace where nspname = 'db1_dbo';
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


SELECT COUNT(*) FROM pg_roles where rolname = 'db2_dbo';
SELECT COUNT(*) FROM pg_roles where rolname = 'db2_db_owner';
SELECT COUNT(*) FROM pg_namespace where nspname = 'db2_dbo';
GO
~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~

~~START~~
int
1
~~END~~


DROP DATABASE db1;
GO

DROP DATABASE db2;
GO

SELECT name FROM sys.sysdatabases ORDER BY name;
GO
~~START~~
text
master
msdb
tempdb
~~END~~


SELECT set_config('babelfishpg_tsql.migration_mode', 'single-db', false);
GO
~~START~~
text
single-db
~~END~~

76 changes: 0 additions & 76 deletions test/JDBC/expected/BABEL-1446.out
Original file line number Diff line number Diff line change
Expand Up @@ -85,79 +85,3 @@ int
0
~~END~~


-- test multi-db mode
SELECT set_config('role', 'jdbc_user', false);
GO
~~START~~
text
jdbc_user
~~END~~

SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false);
GO
~~START~~
text
multi-db
~~END~~


CREATE DATABASE db1;
GO

SELECT COUNT(*) FROM pg_auth_members
WHERE roleid = (SELECT oid FROM pg_roles WHERE rolname = 'db1_guest')
AND "member" = (SELECT oid FROM pg_roles WHERE rolname = 'db1_db_owner');
GO
~~START~~
int
1
~~END~~


CREATE DATABASE db2;
GO

SELECT COUNT(*) FROM pg_auth_members
WHERE roleid = (SELECT oid FROM pg_roles WHERE rolname = 'db2_guest')
AND "member" = (SELECT oid FROM pg_roles WHERE rolname = 'db2_db_owner');
GO
~~START~~
int
1
~~END~~


DROP DATABASE db1;
GO

SELECT COUNT(*) FROM pg_auth_members
WHERE roleid = (SELECT oid FROM pg_roles WHERE rolname = 'db1_guest')
AND "member" = (SELECT oid FROM pg_roles WHERE rolname = 'db1_db_owner');
GO
~~START~~
int
0
~~END~~


DROP DATABASE db2;
GO

SELECT COUNT(*) FROM pg_auth_members
WHERE roleid = (SELECT oid FROM pg_roles WHERE rolname = 'db2_guest')
AND "member" = (SELECT oid FROM pg_roles WHERE rolname = 'db2_db_owner');
GO
~~START~~
int
0
~~END~~


SELECT set_config('babelfishpg_tsql.migration_mode', 'single-db', false);
GO
~~START~~
text
single-db
~~END~~

58 changes: 0 additions & 58 deletions test/JDBC/input/BABEL-1435.sql
Original file line number Diff line number Diff line change
Expand Up @@ -57,61 +57,3 @@ GO

DROP DATABASE db1;
GO

-- Set current_user for testing db mode
IF (SELECT 1 FROM pg_roles WHERE rolname='jdbc_user') = 1
BEGIN
WITH SET_CTE
AS
(SELECT set_config('role', 'jdbc_user', false))
SELECT NULL
FROM SET_CTE
END
ELSE
BEGIN
WITH SET_CTE
AS
(SELECT set_config('role', 'babeltestuser', false))
SELECT NULL
FROM SET_CTE
END
GO

-- test multi-db mode
SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false);
GO

SELECT name FROM sys.sysdatabases ORDER BY name;
GO

CREATE DATABASE db1;
GO

-- test error
CREATE DATABASE db1;
GO

CREATE DATABASE db2;
GO

SELECT COUNT(*) FROM pg_roles where rolname = 'db1_dbo';
SELECT COUNT(*) FROM pg_roles where rolname = 'db1_db_owner';
SELECT COUNT(*) FROM pg_namespace where nspname = 'db1_dbo';
GO

SELECT COUNT(*) FROM pg_roles where rolname = 'db2_dbo';
SELECT COUNT(*) FROM pg_roles where rolname = 'db2_db_owner';
SELECT COUNT(*) FROM pg_namespace where nspname = 'db2_dbo';
GO

DROP DATABASE db1;
GO

DROP DATABASE db2;
GO

SELECT name FROM sys.sysdatabases ORDER BY name;
GO

SELECT set_config('babelfishpg_tsql.migration_mode', 'single-db', false);
GO
41 changes: 0 additions & 41 deletions test/JDBC/input/BABEL-1446.sql
Original file line number Diff line number Diff line change
Expand Up @@ -50,44 +50,3 @@ SELECT COUNT(*) FROM pg_auth_members
WHERE roleid = (SELECT oid FROM pg_roles WHERE rolname = 'guest')
AND "member" = (SELECT oid FROM pg_roles WHERE rolname = 'db_owner');
GO

-- test multi-db mode
SELECT set_config('role', 'jdbc_user', false);
GO
SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false);
GO

CREATE DATABASE db1;
GO

SELECT COUNT(*) FROM pg_auth_members
WHERE roleid = (SELECT oid FROM pg_roles WHERE rolname = 'db1_guest')
AND "member" = (SELECT oid FROM pg_roles WHERE rolname = 'db1_db_owner');
GO

CREATE DATABASE db2;
GO

SELECT COUNT(*) FROM pg_auth_members
WHERE roleid = (SELECT oid FROM pg_roles WHERE rolname = 'db2_guest')
AND "member" = (SELECT oid FROM pg_roles WHERE rolname = 'db2_db_owner');
GO

DROP DATABASE db1;
GO

SELECT COUNT(*) FROM pg_auth_members
WHERE roleid = (SELECT oid FROM pg_roles WHERE rolname = 'db1_guest')
AND "member" = (SELECT oid FROM pg_roles WHERE rolname = 'db1_db_owner');
GO

DROP DATABASE db2;
GO

SELECT COUNT(*) FROM pg_auth_members
WHERE roleid = (SELECT oid FROM pg_roles WHERE rolname = 'db2_guest')
AND "member" = (SELECT oid FROM pg_roles WHERE rolname = 'db2_db_owner');
GO

SELECT set_config('babelfishpg_tsql.migration_mode', 'single-db', false);
GO
2 changes: 0 additions & 2 deletions test/JDBC/jdbc_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

all

ignore#!#BABEL-1435
ignore#!#BABEL-1446
ignore#!#BABEL-4279
ignore#!#babelfish_migration_mode-vu-prepare
ignore#!#babelfish_migration_mode-vu-verify
Expand Down

0 comments on commit 3e8a46f

Please sign in to comment.