From 3abb5e57154ae293b35ed09c4c31071bf6563e69 Mon Sep 17 00:00:00 2001 From: Nils Dijk Date: Tue, 13 Nov 2018 16:10:36 +0100 Subject: [PATCH] Description: Fix failures of tests on recent postgres builds In recent postgres builds you cannot set client_min_messages to values higher then ERROR, if will silently set it to ERROR if so. During some tests we would set it to fatal to hide random values (eg. pid's of processes) from the test output. This patch will use different tactics for hiding these values. --- src/test/regress/.gitignore | 3 +++ src/test/regress/expected/multi_task_string_size.out | 6 +++++- src/test/regress/expected/multi_test_helpers.out | 10 ++++++++++ src/test/regress/sql/multi_task_string_size.sql | 4 +++- src/test/regress/sql/multi_test_helpers.sql | 11 +++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/test/regress/.gitignore b/src/test/regress/.gitignore index 477bd27cc..6e3048cce 100644 --- a/src/test/regress/.gitignore +++ b/src/test/regress/.gitignore @@ -9,3 +9,6 @@ # Regression test output /regression.diffs /regression.out + +# Failure test side effets +/proxy.output diff --git a/src/test/regress/expected/multi_task_string_size.out b/src/test/regress/expected/multi_task_string_size.out index 57d527c07..7660e4329 100644 --- a/src/test/regress/expected/multi_task_string_size.out +++ b/src/test/regress/expected/multi_task_string_size.out @@ -225,8 +225,12 @@ ERROR: parameter "citus.max_task_string_size" cannot be changed without restart -- error message may vary between executions -- hiding warning and error message -- no output means the query has failed -SET client_min_messages to FATAL; +SET client_min_messages to ERROR; +SELECT raise_failed_execution(' SELECT u.* FROM wide_table u JOIN wide_table v ON (u.long_column_002 = v.long_column_003); +'); +ERROR: Task failed to execute +CONTEXT: PL/pgSQL function raise_failed_execution(text) line 6 at RAISE -- following will succeed since it fetches few columns SELECT u.long_column_001, u.long_column_002, u.long_column_003 FROM wide_table u JOIN wide_table v ON (u.long_column_002 = v.long_column_003); long_column_001 | long_column_002 | long_column_003 diff --git a/src/test/regress/expected/multi_test_helpers.out b/src/test/regress/expected/multi_test_helpers.out index 7f8b92503..77dff55ba 100644 --- a/src/test/regress/expected/multi_test_helpers.out +++ b/src/test/regress/expected/multi_test_helpers.out @@ -84,3 +84,13 @@ $desc_views$ (1 row) +-- Create a function to make sure that queries returning the same result +CREATE FUNCTION raise_failed_execution(query text) RETURNS void AS $$ +BEGIN + EXECUTE query; + EXCEPTION WHEN OTHERS THEN + IF SQLERRM LIKE 'failed to execute task%' THEN + RAISE 'Task failed to execute'; + END IF; +END; +$$LANGUAGE plpgsql; diff --git a/src/test/regress/sql/multi_task_string_size.sql b/src/test/regress/sql/multi_task_string_size.sql index c650902a0..a1c104b6e 100644 --- a/src/test/regress/sql/multi_task_string_size.sql +++ b/src/test/regress/sql/multi_task_string_size.sql @@ -220,9 +220,11 @@ SET citus.max_task_string_size TO 20000; -- error message may vary between executions -- hiding warning and error message -- no output means the query has failed -SET client_min_messages to FATAL; +SET client_min_messages to ERROR; +SELECT raise_failed_execution(' SELECT u.* FROM wide_table u JOIN wide_table v ON (u.long_column_002 = v.long_column_003); +'); -- following will succeed since it fetches few columns SELECT u.long_column_001, u.long_column_002, u.long_column_003 FROM wide_table u JOIN wide_table v ON (u.long_column_002 = v.long_column_003); diff --git a/src/test/regress/sql/multi_test_helpers.sql b/src/test/regress/sql/multi_test_helpers.sql index d63ab6529..ea1180884 100644 --- a/src/test/regress/sql/multi_test_helpers.sql +++ b/src/test/regress/sql/multi_test_helpers.sql @@ -81,3 +81,14 @@ WHERE cc.constraint_schema = ccu.constraint_schema AND ORDER BY cc.constraint_name ASC; $desc_views$ ); + +-- Create a function to make sure that queries returning the same result +CREATE FUNCTION raise_failed_execution(query text) RETURNS void AS $$ +BEGIN + EXECUTE query; + EXCEPTION WHEN OTHERS THEN + IF SQLERRM LIKE 'failed to execute task%' THEN + RAISE 'Task failed to execute'; + END IF; +END; +$$LANGUAGE plpgsql;