From 73ee4107d4e30be4b675f4a4aafdce5538313c10 Mon Sep 17 00:00:00 2001 From: Raul Marin Date: Tue, 5 Nov 2019 14:48:52 +0100 Subject: [PATCH] CDB_FederatedServerTables: Improve tests readability --- test/CDB_FederatedServerTables.sql | 18 +++++++++++++++++- test/CDB_FederatedServerTables_expect | 4 ++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/test/CDB_FederatedServerTables.sql b/test/CDB_FederatedServerTables.sql index 460252d..7ed7630 100644 --- a/test/CDB_FederatedServerTables.sql +++ b/test/CDB_FederatedServerTables.sql @@ -54,6 +54,7 @@ SET client_min_messages TO error; \set VERBOSITY terse \set QUIET off +\echo '## Registering an existing table works' SELECT 'R1', cartodb.CDB_Federated_Table_Register( server => 'loopback', remote_schema => 'remote_schema', @@ -70,6 +71,7 @@ Select 'list_remotes1', CDB_Federated_Server_List_Registered_Tables( remote_schema => 'remote_schema' ); +\echo '## Registering another existing table works' SELECT 'R2', cartodb.CDB_Federated_Table_Register( server => 'loopback', remote_schema => 'remote_schema', @@ -88,7 +90,8 @@ Select 'list_remotes2', CDB_Federated_Server_List_Registered_Tables( remote_schema => 'remote_schema' ); --- Reregistering R2 with different parameters should work + +\echo '## Re-registering a table works' SELECT 'R3', cartodb.CDB_Federated_Table_Register( server => 'loopback', remote_schema => 'remote_schema', @@ -103,6 +106,7 @@ SELECT 'S3_old', cartodb_id, ST_AsText(the_geom), another_field FROM "myFullTabl -- And the new appear SELECT 'S3_new', cartodb_id, ST_AsText(the_geom), another_field FROM different_name; +\echo '## Unregistering works' -- Deregistering the first table SELECT 'U1', CDB_Federated_Table_Unregister( server => 'loopback', @@ -117,6 +121,18 @@ Select 'list_remotes3', CDB_Federated_Server_List_Registered_Tables( remote_schema => 'remote_schema' ); +-- Try to register with invalid / NULL server +-- Try to register with invalid / NULL schema +-- Try to register with invalid / NULL table +-- Try to register with invalid / NULL id +-- Try to register with invalid / NULL geom_column +-- Try to register with invalid / NULL webmercator_column +-- Try to register the same table twice (different name) should fail +-- Check that conflict is handled nicely (target view already exists) + +-- Try permissions tricks + + -- =================================================================== -- Cleanup -- =================================================================== diff --git a/test/CDB_FederatedServerTables_expect b/test/CDB_FederatedServerTables_expect index 21229d3..7298a72 100644 --- a/test/CDB_FederatedServerTables_expect +++ b/test/CDB_FederatedServerTables_expect @@ -1,4 +1,5 @@ C1| +## Registering an existing table works R1| V1| SELECT t.id AS cartodb_id, t.geom AS the_geom, @@ -8,6 +9,7 @@ V1| SELECT t.id AS cartodb_id, S1|1|POINT(1 1)|patata S1|2|POINT(2 2)|patata2 list_remotes1|(remote_geom,public.remote_geom) +## Registering another existing table works R2| V2| SELECT t.id AS cartodb_id, t.geom AS the_geom, @@ -17,9 +19,11 @@ V2| SELECT t.id AS cartodb_id, S2|3|POINT(3 3)|patata list_remotes2|(remote_geom2,"public.""myFullTable""") list_remotes2|(remote_geom,public.remote_geom) +## Re-registering a table works R3| ERROR: relation "myFullTable" does not exist at character 70 S3_new|3|POINT(3 3)|patata +## Unregistering works U1| ERROR: relation "remote_geom" does not exist at character 71 list_remotes3|(remote_geom2,public.different_name)