Adapt tests to work with other ports (not 5432)

This commit is contained in:
Raúl Marín
2020-03-26 16:37:58 +01:00
parent 2fcdd56338
commit f790dc1872
3 changed files with 17 additions and 18 deletions
+6 -5
View File
@@ -99,11 +99,12 @@ FROM latency;
\echo '%% It raises an error if the wrong port is provided' \echo '%% It raises an error if the wrong port is provided'
SELECT '3.0', cartodb.CDB_Federated_Server_Diagnostics(server => 'wrong-port'); SELECT '3.0', cartodb.CDB_Federated_Server_Diagnostics(server => 'wrong-port');
\echo '%% Latency stats: can get them on default PG port 5432 when not provided' -- Disabled: It's not compatibly with Travis since the target database (self) might be in a different port
WITH latency AS ( -- \echo '%% Latency stats: can get them on default PG port 5432 when not provided'
SELECT CDB_Federated_Server_Diagnostics('loopback-no-port')->'server_latency_ms' ms -- WITH latency AS (
) SELECT '2.4', 0.0 <= (latency.ms->'min')::text::float, (latency.ms->'max')::text::float <= 1000.0 -- SELECT CDB_Federated_Server_Diagnostics('loopback-no-port')->'server_latency_ms' ms
FROM latency; -- ) SELECT '2.4', 0.0 <= (latency.ms->'min')::text::float, (latency.ms->'max')::text::float <= 1000.0
-- FROM latency;
-- =================================================================== -- ===================================================================
@@ -21,8 +21,6 @@ ERROR: Server "doesNotExist" does not exist
2.3|t 2.3|t
%% It raises an error if the wrong port is provided %% It raises an error if the wrong port is provided
ERROR: could not connect to server "cdb_fs_wrong-port" ERROR: could not connect to server "cdb_fs_wrong-port"
%% Latency stats: can get them on default PG port 5432 when not provided
2.4|t|t
D1| D1|
D2| D2|
D3| D3|
+11 -11
View File
@@ -2,20 +2,20 @@
## List non-existent server shows nothing ## List non-existent server shows nothing
## Create and list a server works ## Create and list a server works
1.3| 1.3|
1.4|(myRemote,postgres_fdw,localhost,5432,,read-only,fdw_user) 1.4|(myRemote,postgres_fdw,localhost,@@PGPORT@@,,read-only,fdw_user)
## Create and list a second server works ## Create and list a second server works
2.1| 2.1|
2.2|(myRemote,postgres_fdw,localhost,5432,,read-only,fdw_user) 2.2|(myRemote,postgres_fdw,localhost,@@PGPORT@@,,read-only,fdw_user)
2.2|(myRemote2,postgres_fdw,localhost,5432,fdw_target,read-only,fdw_user) 2.2|(myRemote2,postgres_fdw,localhost,@@PGPORT@@,fdw_target,read-only,fdw_user)
## List server by name works ## List server by name works
2.3|(myRemote,postgres_fdw,localhost,5432,,read-only,fdw_user) 2.3|(myRemote,postgres_fdw,localhost,@@PGPORT@@,,read-only,fdw_user)
## Re-register a second server works ## Re-register a second server works
3.1| 3.1|
3.2|(myRemote,postgres_fdw,localhost,5432,,read-only,fdw_user) 3.2|(myRemote,postgres_fdw,localhost,@@PGPORT@@,,read-only,fdw_user)
3.2|(myRemote2,postgres_fdw,localhost,5432,fdw_target,read-only,other_remote_user) 3.2|(myRemote2,postgres_fdw,localhost,@@PGPORT@@,fdw_target,read-only,other_remote_user)
## Unregister server 1 works ## Unregister server 1 works
4.1| 4.1|
4.2|(myRemote2,postgres_fdw,localhost,5432,fdw_target,read-only,other_remote_user) 4.2|(myRemote2,postgres_fdw,localhost,@@PGPORT@@,fdw_target,read-only,other_remote_user)
## Unregistering a server that does not exist fails ## Unregistering a server that does not exist fails
ERROR: Server "doesNotExist" does not exist ERROR: Server "doesNotExist" does not exist
## Unregister the second server works ## Unregister the second server works
@@ -30,25 +30,25 @@ ERROR: Server information is mandatory
ERROR: Credentials are mandatory ERROR: Credentials are mandatory
## Create a server with empty credentials works ## Create a server with empty credentials works
7.3| 7.3|
7.4|(empty,postgres_fdw,localhost,5432,fdw_target,read-only,) 7.4|(empty,postgres_fdw,localhost,@@PGPORT@@,fdw_target,read-only,)
7.5| 7.5|
## Create a server without options fails ## Create a server without options fails
ERROR: Server information is mandatory ERROR: Server information is mandatory
## Create a server with special characters works ## Create a server with special characters works
8.1| 8.1|
8.2|("myRemote"" or'not",postgres_fdw,localhost,5432,"fdw target",read-only,"fdw user") 8.2|("myRemote"" or'not",postgres_fdw,localhost,@@PGPORT@@,"fdw target",read-only,"fdw user")
8.3| 8.3|
9.1| 9.1|
You are now connected to database "contrib_regression" as user "cdb_fs_tester". You are now connected to database "contrib_regression" as user "cdb_fs_tester".
## All users are able to list servers ## All users are able to list servers
9.2|(myRemote3,postgres_fdw,localhost,5432,,read-only,) 9.2|(myRemote3,postgres_fdw,localhost,@@PGPORT@@,,read-only,)
## Only superadmins can create servers ## Only superadmins can create servers
ERROR: Could not create server myRemote4: permission denied for foreign-data wrapper postgres_fdw ERROR: Could not create server myRemote4: permission denied for foreign-data wrapper postgres_fdw
You are now connected to database "contrib_regression" as user "postgres". You are now connected to database "contrib_regression" as user "postgres".
## Granting access to a user works ## Granting access to a user works
9.5| 9.5|
You are now connected to database "contrib_regression" as user "cdb_fs_tester". You are now connected to database "contrib_regression" as user "cdb_fs_tester".
9.55|(myRemote3,postgres_fdw,localhost,5432,,read-only,fdw_user) 9.55|(myRemote3,postgres_fdw,localhost,@@PGPORT@@,,read-only,fdw_user)
You are now connected to database "contrib_regression" as user "postgres". You are now connected to database "contrib_regression" as user "postgres".
ERROR: Server "does not exist" does not exist ERROR: Server "does not exist" does not exist
ERROR: Could not grant access on "myRemote3" to "does not exist": role "does not exist" does not exist ERROR: Could not grant access on "myRemote3" to "does not exist": role "does not exist" does not exist