From f55d789c4171e78f456536342d533046f7ae4585 Mon Sep 17 00:00:00 2001 From: Mario de Frutos Dieguez Date: Thu, 4 Jul 2019 17:40:00 +0200 Subject: [PATCH] Make some tests to have different expects for different PG versions --- Makefile | 8 +++- test/CDB_OAuth_expect.pg11 | 90 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 test/CDB_OAuth_expect.pg11 diff --git a/Makefile b/Makefile index 4c3d15a..8e51b0f 100644 --- a/Makefile +++ b/Makefile @@ -130,6 +130,8 @@ PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) +PG_VERSION := $(shell $(PG_CONFIG) --version | $(AWK) '{split($$2,a,"."); print a[1]}') + $(EXTENSION)--$(EXTVERSION).sql: $(CDBSCRIPTS) cartodb_version.sql Makefile echo '\echo Use "CREATE EXTENSION $(EXTENSION)" to load this file. \quit' > $@ cat $(CDBSCRIPTS) | \ @@ -171,7 +173,11 @@ legacy_regress: $(REGRESS_OLD) Makefile $(SED) -e 's/@@VERSION@@/$(EXTVERSION)/' -e 's/@extschema@/cartodb/g' -e "s/@postgisschema@/public/g" >> $${of}; \ exp=expected/test/$${tn}.out; \ echo '\set ECHO none' > $${exp}; \ - cat test/$${tn}_expect >> $${exp}; \ + if [[ -f "test/$${tn}_expect.pg$(PG_VERSION)" ]]; then \ + cat test/$${tn}_expect.pg$(PG_VERSION) >> $${exp}; \ + else \ + cat test/$${tn}_expect >> $${exp}; \ + fi \ done test_organization: diff --git a/test/CDB_OAuth_expect.pg11 b/test/CDB_OAuth_expect.pg11 new file mode 100644 index 0000000..73767d2 --- /dev/null +++ b/test/CDB_OAuth_expect.pg11 @@ -0,0 +1,90 @@ + +CREATE TABLE +INSERT 0 1 +SELECT 1 +CREATE VIEW +SELECT 1 +SELECT 1 +1 +1 +1 +1 +1 +ERROR: permission denied for table test +ERROR: permission denied for table test_tablesas +ERROR: permission denied for view test_view +ERROR: permission denied for materialized view test_mview +ERROR: permission denied for table test_selectinto +DROP TABLE +DROP VIEW +DROP MATERIALIZED VIEW +DROP TABLE +DROP TABLE +NOTICE: event trigger "oauth_reassign_tables_trigger" does not exist, skipping + +CREATE TABLE +INSERT 0 1 +SELECT 1 +CREATE VIEW +SELECT 1 +SELECT 1 +1 +1 +1 +1 +1 +ERROR: permission denied for table test2 +ERROR: permission denied for table test2_tablesas +ERROR: permission denied for view test2_view +ERROR: permission denied for materialized view test2_mview +ERROR: permission denied for table test2_selectinto +DROP TABLE +DROP VIEW +DROP MATERIALIZED VIEW +DROP TABLE +DROP TABLE + +CREATE TABLE +INSERT 0 1 +SELECT 1 +CREATE VIEW +SELECT 1 +SELECT 1 +1 +1 +1 +1 +1 +ERROR: permission denied for table test3 +ERROR: permission denied for table test3_tablesas +ERROR: permission denied for view test3_view +ERROR: permission denied for materialized view test3_mview +ERROR: permission denied for table test3_selectinto +DROP TABLE +DROP VIEW +DROP MATERIALIZED VIEW +DROP TABLE +DROP TABLE + +CREATE TABLE +INSERT 0 1 +SELECT 1 +CREATE VIEW +SELECT 1 +SELECT 1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +DROP TABLE +DROP VIEW +DROP MATERIALIZED VIEW +DROP TABLE +DROP TABLE +