From 2bce771488a47d3d689fcd422ee008533da7d187 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Tue, 9 Feb 2016 18:50:50 +0100 Subject: [PATCH] Add some tests Tests for: * CDB_QueryTables_Updated_At * CDB_Last_Updated_Time --- test/extension/test.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/extension/test.sh b/test/extension/test.sh index 949cbe4..cf9f830 100755 --- a/test/extension/test.sh +++ b/test/extension/test.sh @@ -487,6 +487,19 @@ test_fdw|foo|test_fdw" sql postgres "SELECT a from test_fdw.foo LIMIT 1;" should 42 + # Check function CDB_QueryTables_Updated_At + sql postgres 'CREATE TABLE local (b int);' + sql postgres 'INSERT INTO local (b) VALUES (43);' + sql postgres "SELECT cdb_tablemetadatatouch('public.local'::regclass);" + local query='$query$ SELECT * FROM test_fdw.foo, local $query$::text' + sql postgres "SELECT dbname, schema_name, table_name FROM cartodb.CDB_QueryTables_Updated_At(${query}) ORDER BY dbname;" should 'fdw_target|test_fdw|foo +test_extension|public|local' + sql postgres "SELECT table_name FROM cartodb.CDB_QueryTables_Updated_At(${query}) order by updated_at;" should 'foo +local' + + # Check function CDB_Last_Updated_Time + sql postgres "SELECT cartodb.CDB_Last_Updated_Time('{test_fdw.foo,public.local}'::text[]) < now()" should 't' + sql postgres "SELECT cartodb.CDB_Last_Updated_Time('{test_fdw.foo,public.local}'::text[]) > (now() - interval '1 minute')" should 't' DATABASE=fdw_target sql postgres 'REVOKE USAGE ON SCHEMA test_fdw FROM fdw_user;' DATABASE=fdw_target sql postgres 'REVOKE SELECT ON test_fdw.foo FROM fdw_user;'