Make other tests resilient to CDB_SyncTable test failures

Use a transaction to avoid leaving stuff after our tests, that affect
Quota and User Tables tests.
This commit is contained in:
Rafa de la Torre 2019-05-28 15:15:57 +02:00
parent f442c21fa4
commit 45c21d7f42
2 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,6 @@
-- Setup: create and populate a table to test the syncs
\set QUIET on
BEGIN;
SET client_min_messages TO error;
CREATE TABLE test_sync_source (
cartodb_id bigint,
@ -15,6 +16,7 @@ INSERT INTO test_sync_source VALUES
SET client_min_messages TO notice;
\set QUIET off
\echo 'First table sync: it should be simply just copied to the destination'
SELECT cartodb.CDB_SyncTable('test_sync_source', 'public', 'test_sync_dest');
@ -37,8 +39,6 @@ SELECT cartodb.CDB_SyncTable('test_sync_source', 'public', 'test_sync_dest');
SELECT * FROM test_sync_source ORDER BY cartodb_id;
SELECT * FROM test_sync_dest ORDER BY cartodb_id;
-- Cleanup
\set QUIET on
DROP TABLE IF EXISTS test_sync_source;
DROP TABLE IF EXISTS test_sync_dest;
\set QUIET off
ROLLBACK;

View File

@ -37,3 +37,4 @@ Sanity check: the end result is the same source table
2|2|2|bar
4|4|4|cantaloupe
5|5|5|sandia
ROLLBACK