Skip to content

Commit

Permalink
Update test files by removing set_config calls (#3307)
Browse files Browse the repository at this point in the history
As part of #3096, we restricted setting of few configurations like role, migration mode etc. We ignored few files temporarily to get us unblocked.
This commit fixes 3 such test files:
1. BABEL-1435
2. BABEL-1446
3. babelfish_migration-mode-vu-*

Signed-off-by: Shameem Ahmed <[email protected]>
  • Loading branch information
ahmed-shameem authored Dec 30, 2024
1 parent 6a98c1c commit 75c7a80
Show file tree
Hide file tree
Showing 38 changed files with 27 additions and 213 deletions.
23 changes: 0 additions & 23 deletions test/JDBC/expected/BABEL-1435.out
Original file line number Diff line number Diff line change
Expand Up @@ -175,29 +175,6 @@ 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~~


SELECT name FROM sys.sysdatabases ORDER BY name;
GO
Expand Down
8 changes: 0 additions & 8 deletions test/JDBC/expected/BABEL-1446.out
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ int


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


CREATE DATABASE db1;
GO

Expand Down
51 changes: 0 additions & 51 deletions test/JDBC/expected/babelfish_migration_mode-vu-verify.out
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ GO
~~ROW COUNT: 1~~


SELECT set_config('role', 'jdbc_user', false)
GO
~~START~~
text
jdbc_user
~~END~~


SELECT current_setting('babelfishpg_tsql.migration_mode')
GO
~~START~~
Expand Down Expand Up @@ -240,28 +232,12 @@ int
USE master
GO

SELECT set_config('role', 'jdbc_user', false)
GO
~~START~~
text
jdbc_user
~~END~~




-- should fail in single-db
USE babelfish_migration_mode_db2
GO

SELECT set_config('role', 'jdbc_user', false)
GO
~~START~~
text
jdbc_user
~~END~~


SELECT current_setting('babelfishpg_tsql.migration_mode')
GO
~~START~~
Expand Down Expand Up @@ -291,14 +267,6 @@ GO
DROP DATABASE babelfish_migration_mode_db2
GO

SELECT set_config('role', 'jdbc_user', false)
GO
~~START~~
text
jdbc_user
~~END~~




INSERT INTO babelfish_migration_mode_catalog_status2
Expand Down Expand Up @@ -333,25 +301,6 @@ varchar#!#int
TRUNCATE TABLE babelfish_migration_mode_catalog_status2
GO

SELECT set_config('role', 'jdbc_user', false)
GO
~~START~~
text
jdbc_user
~~END~~


-- Reset migration mode to default
DECLARE @mig_mode VARCHAR(10)
SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_tbl WHERE id_num = 1)
SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END
GO
~~START~~
int
1
~~END~~


INSERT INTO babelfish_migration_mode_catalog_status2
SELECT 'sys.babelfish_sysdatabases', COUNT(*) FROM sys.babelfish_sysdatabases
GO
Expand Down
23 changes: 0 additions & 23 deletions test/JDBC/expected/single_db/BABEL-1435.out
Original file line number Diff line number Diff line change
Expand Up @@ -183,29 +183,6 @@ 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~~


SELECT name FROM sys.sysdatabases ORDER BY name;
GO
Expand Down
8 changes: 0 additions & 8 deletions test/JDBC/expected/single_db/BABEL-1446.out
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ int


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


CREATE DATABASE db1;
GO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ GO
~~ROW COUNT: 1~~


SELECT set_config('role', 'jdbc_user', false)
GO
~~START~~
text
jdbc_user
~~END~~


SELECT current_setting('babelfishpg_tsql.migration_mode')
GO
~~START~~
Expand Down Expand Up @@ -247,14 +239,6 @@ int
USE master
GO

SELECT set_config('role', 'jdbc_user', false)
GO
~~START~~
text
jdbc_user
~~END~~




-- should fail in single-db
Expand All @@ -265,14 +249,6 @@ GO
~~ERROR (Message: database "babelfish_migration_mode_db2" does not exist)~~


SELECT set_config('role', 'jdbc_user', false)
GO
~~START~~
text
jdbc_user
~~END~~


SELECT current_setting('babelfishpg_tsql.migration_mode')
GO
~~START~~
Expand Down Expand Up @@ -310,14 +286,6 @@ GO
~~ERROR (Message: database "babelfish_migration_mode_db2" does not exist)~~


SELECT set_config('role', 'jdbc_user', false)
GO
~~START~~
text
jdbc_user
~~END~~




INSERT INTO babelfish_migration_mode_catalog_status2
Expand Down Expand Up @@ -352,25 +320,6 @@ varchar#!#int
TRUNCATE TABLE babelfish_migration_mode_catalog_status2
GO

SELECT set_config('role', 'jdbc_user', false)
GO
~~START~~
text
jdbc_user
~~END~~


-- Reset migration mode to default
DECLARE @mig_mode VARCHAR(10)
SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_tbl WHERE id_num = 1)
SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END
GO
~~START~~
int
1
~~END~~


INSERT INTO babelfish_migration_mode_catalog_status2
SELECT 'sys.babelfish_sysdatabases', COUNT(*) FROM sys.babelfish_sysdatabases
GO
Expand Down
18 changes: 0 additions & 18 deletions test/JDBC/input/BABEL-1435.sql
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,6 @@ 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

SELECT name FROM sys.sysdatabases ORDER BY name;
GO
Expand Down
3 changes: 0 additions & 3 deletions test/JDBC/input/BABEL-1446.sql
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ AND "member" = (SELECT oid FROM pg_roles WHERE rolname = 'db_owner');
GO

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

CREATE DATABASE db1;
GO

Expand Down
21 changes: 0 additions & 21 deletions test/JDBC/input/ownership/babelfish_migration_mode-vu-verify.mix
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ INSERT INTO babelfish_migration_mode_catalog_status
SELECT 'sys.babelfish_authid_user_ext', COUNT(*) FROM sys.babelfish_authid_user_ext
GO

SELECT set_config('role', 'jdbc_user', false)
GO

SELECT current_setting('babelfishpg_tsql.migration_mode')
GO

Expand Down Expand Up @@ -109,18 +106,12 @@ GO
USE master
GO

SELECT set_config('role', 'jdbc_user', false)
GO



-- should fail in single-db
USE babelfish_migration_mode_db2
GO

SELECT set_config('role', 'jdbc_user', false)
GO

SELECT current_setting('babelfishpg_tsql.migration_mode')
GO

Expand All @@ -140,9 +131,6 @@ GO
DROP DATABASE babelfish_migration_mode_db2
GO

SELECT set_config('role', 'jdbc_user', false)
GO



INSERT INTO babelfish_migration_mode_catalog_status2
Expand All @@ -165,15 +153,6 @@ GO
TRUNCATE TABLE babelfish_migration_mode_catalog_status2
GO

SELECT set_config('role', 'jdbc_user', false)
GO

-- Reset migration mode to default
DECLARE @mig_mode VARCHAR(10)
SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_tbl WHERE id_num = 1)
SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END
GO

INSERT INTO babelfish_migration_mode_catalog_status2
SELECT 'sys.babelfish_sysdatabases', COUNT(*) FROM sys.babelfish_sysdatabases
GO
Expand Down
6 changes: 0 additions & 6 deletions test/JDBC/jdbc_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@

all

ignore#!#BABEL-1435
ignore#!#BABEL-1446
ignore#!#babelfish_migration_mode-vu-prepare
ignore#!#babelfish_migration_mode-vu-verify
ignore#!#babelfish_migration_mode-vu-cleanup

# BABEL-SP_FKEYS test is very slow and causing github action timeout.

# JDBC bulk insert API seems to call SET FMTONLY ON without calling SET FMTONLY OFF, causing some spurious test failures.
Expand Down
1 change: 0 additions & 1 deletion test/JDBC/singledb_jdbc_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
ignore#!#Test-sp_reset_connection
ignore#!#test_search_path


1 change: 1 addition & 0 deletions test/JDBC/upgrade/13_4/schedule
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ babel_datatype_sqlvariant
BABEL-EXTENDEDPROPERTY-before-15_4
babelfish_authid_login_ext
babelfish_cast_floor
babelfish_migration_mode
babelfish_namespace_ext
babelfish_sysdatabases
babel_function_string-before-15-5-or-14-10
Expand Down
1 change: 1 addition & 0 deletions test/JDBC/upgrade/13_5/schedule
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ babel_datatype_sqlvariant
BABEL-EXTENDEDPROPERTY-before-15_4
babelfish_authid_login_ext
babelfish_cast_floor
babelfish_migration_mode
babelfish_namespace_ext
babelfish_sysdatabases
babel_function_string-before-15-5-or-14-10
Expand Down
1 change: 1 addition & 0 deletions test/JDBC/upgrade/13_6/schedule
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ babelfish_authid_login_ext
babelfish_authid_user_ext
babelfish_cast_floor
babelfish_inconsistent_metadata
babelfish_migration_mode
babelfish_namespace_ext
babelfish_sysdatabases
babel_function_string-before-15-5-or-14-10
Expand Down
Loading

0 comments on commit 75c7a80

Please sign in to comment.