Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce Postgres logs noise on regression tests #7043

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion test/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ TEST_PGUSER=${TEST_PGUSER:-postgres}
TEST_INPUT_DIR=${TEST_INPUT_DIR:-${EXE_DIR}}
TEST_OUTPUT_DIR=${TEST_OUTPUT_DIR:-${EXE_DIR}}
TEST_SUPPORT_FILE=${CURRENT_DIR}/sql/utils/testsupport.sql
TEST_SUPPORT_FILE_INIT=${CURRENT_DIR}/sql/utils/testsupport_init.sql

# PGAPPNAME will be 'pg_regress/test' so we cut off the prefix
# to get the name of the test
Expand Down Expand Up @@ -86,6 +87,13 @@ if mkdir ${TEST_OUTPUT_DIR}/.pg_init 2>/dev/null; then
ALTER USER ${TEST_ROLE_3} WITH CREATEDB PASSWORD '${TEST_ROLE_3_PASS}';
ALTER USER ${TEST_ROLE_4} WITH CREATEDB PASSWORD '${TEST_ROLE_4_PASS}';
EOF
${PSQL} "$@" -U $TEST_ROLE_SUPERUSER -d template1 \
-v ECHO=none \
-v MODULE_PATHNAME="'timescaledb-${EXT_VERSION}'" \
-v TSL_MODULE_PATHNAME="'timescaledb-tsl-${EXT_VERSION}'" \
-v TEST_SPINWAIT_ITERS=${TEST_SPINWAIT_ITERS} \
-f ${TEST_SUPPORT_FILE} >/dev/null 2>&1

${PSQL} "$@" -U ${USER} -d postgres -v ECHO=none -c "ALTER USER ${TEST_ROLE_SUPERUSER} WITH SUPERUSER;" >/dev/null
touch ${TEST_OUTPUT_DIR}/.pg_init/done
fi
Expand All @@ -104,7 +112,7 @@ ${PSQL} "$@" -U $TEST_ROLE_SUPERUSER -d ${TEST_DBNAME} \
-v MODULE_PATHNAME="'timescaledb-${EXT_VERSION}'" \
-v TSL_MODULE_PATHNAME="'timescaledb-tsl-${EXT_VERSION}'" \
-v TEST_SPINWAIT_ITERS=${TEST_SPINWAIT_ITERS} \
-f ${TEST_SUPPORT_FILE} >/dev/null 2>&1
-f ${TEST_SUPPORT_FILE_INIT} >/dev/null 2>&1
export TEST_DBNAME

# we strip out any output between <exclude_from_test></exclude_from_test>
Expand Down Expand Up @@ -139,6 +147,7 @@ ${PSQL} -U ${TEST_PGUSER} \
-v MODULE_PATHNAME="'timescaledb-${EXT_VERSION}'" \
-v TSL_MODULE_PATHNAME="'timescaledb-tsl-${EXT_VERSION}'" \
-v TEST_SUPPORT_FILE=${TEST_SUPPORT_FILE} \
-v TEST_SUPPORT_FILE_INIT=${TEST_SUPPORT_FILE_INIT} \
"$@" -d ${TEST_DBNAME} 2>&1 | \
sed -e '/<exclude_from_test>/,/<\/exclude_from_test>/d' \
-e 's! Memory: [0-9]\{1,\}kB!!' \
Expand Down
2 changes: 2 additions & 0 deletions test/runner_shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ TEST_PGUSER=${TEST_PGUSER:-postgres}
TEST_INPUT_DIR=${TEST_INPUT_DIR:-${EXE_DIR}}
TEST_OUTPUT_DIR=${TEST_OUTPUT_DIR:-${EXE_DIR}}
TEST_SUPPORT_FILE=${CURRENT_DIR}/sql/utils/testsupport.sql
TEST_SUPPORT_FILE_INIT=${CURRENT_DIR}/sql/utils/testsupport_init.sql

# Read the extension version from version.config
read -r VERSION < ${CURRENT_DIR}/../version.config
Expand Down Expand Up @@ -50,6 +51,7 @@ if mkdir ${TEST_OUTPUT_DIR}/.pg_init 2>/dev/null; then
-v TEST_INPUT_DIR=${TEST_INPUT_DIR} \
-v TEST_OUTPUT_DIR=${TEST_OUTPUT_DIR} \
-v TEST_SUPPORT_FILE=${TEST_SUPPORT_FILE} \
-v TEST_SUPPORT_FILE_INIT=${TEST_SUPPORT_FILE_INIT} \
-v TSL_MODULE_PATHNAME="'timescaledb-tsl-${EXT_VERSION}'" \
"$@" -d ${TEST_DBNAME} < ${TEST_INPUT_DIR}/shared/sql/include/shared_setup.sql >/dev/null
touch ${TEST_OUTPUT_DIR}/.pg_init/done
Expand Down
7 changes: 0 additions & 7 deletions test/sql/utils/testsupport.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.


SELECT _timescaledb_functions.stop_background_workers();

-- Cleanup any system job stats that can lead to flaky test
DELETE FROM _timescaledb_internal.bgw_job_stat_history WHERE job_id < 1000;
DELETE FROM _timescaledb_internal.bgw_job_stat WHERE job_id < 1000;

CREATE SCHEMA IF NOT EXISTS test;
GRANT USAGE ON SCHEMA test TO PUBLIC;

Expand Down
9 changes: 9 additions & 0 deletions test/sql/utils/testsupport_init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.

SELECT _timescaledb_functions.stop_background_workers();

-- Cleanup any system job stats that can lead to flaky test
DELETE FROM _timescaledb_internal.bgw_job_stat_history WHERE job_id < 1000;
DELETE FROM _timescaledb_internal.bgw_job_stat WHERE job_id < 1000;
10 changes: 5 additions & 5 deletions tsl/test/expected/exp_cagg_next_gen.out
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ NOTICE: drop cascades to table _timescaledb_internal._hyper_6_20_chunk
\c :TEST_DBNAME :ROLE_SUPERUSER
CREATE DATABASE test;
\c test :ROLE_SUPERUSER
CREATE SCHEMA test;
CREATE SCHEMA test1;
SET client_min_messages TO ERROR;
CREATE EXTENSION timescaledb SCHEMA test;
CREATE EXTENSION timescaledb SCHEMA test1;
CREATE TABLE conditions(
tstamp TIMESTAMP NOT NULL,
city text NOT NULL,
temperature INT NOT NULL);
SELECT test.create_hypertable(
SELECT test1.create_hypertable(
'conditions', 'tstamp',
chunk_time_interval => INTERVAL '1 day'
);
Expand All @@ -182,7 +182,7 @@ RESET timescaledb.debug_allow_cagg_with_deprecated_funcs;
CREATE MATERIALIZED VIEW conditions_summary_yearly
WITH (timescaledb.continuous) AS
SELECT city,
test.time_bucket('1 year', tstamp) AS bucket,
test1.time_bucket('1 year', tstamp) AS bucket,
MIN(temperature),
MAX(temperature)
FROM conditions
Expand All @@ -192,7 +192,7 @@ SELECT bucket_func, bucket_width, bucket_origin, bucket_timezone, bucket_fixed_w
FROM _timescaledb_catalog.continuous_aggs_bucket_function ORDER BY 1;
bucket_func | bucket_width | bucket_origin | bucket_timezone | bucket_fixed_width
-------------------------------------------------------------------------------+--------------+---------------+-----------------+--------------------
test.time_bucket(interval,timestamp without time zone) | @ 1 year | | | f
test1.time_bucket(interval,timestamp without time zone) | @ 1 year | | | f
timescaledb_experimental.time_bucket_ng(interval,timestamp without time zone) | @ 1 mon | | | f
(2 rows)

Expand Down
8 changes: 4 additions & 4 deletions tsl/test/sql/exp_cagg_next_gen.sql
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,16 @@ DROP TABLE conditions CASCADE;

CREATE DATABASE test;
\c test :ROLE_SUPERUSER
CREATE SCHEMA test;
CREATE SCHEMA test1;
SET client_min_messages TO ERROR;
CREATE EXTENSION timescaledb SCHEMA test;
CREATE EXTENSION timescaledb SCHEMA test1;

CREATE TABLE conditions(
tstamp TIMESTAMP NOT NULL,
city text NOT NULL,
temperature INT NOT NULL);

SELECT test.create_hypertable(
SELECT test1.create_hypertable(
'conditions', 'tstamp',
chunk_time_interval => INTERVAL '1 day'
);
Expand All @@ -153,7 +153,7 @@ RESET timescaledb.debug_allow_cagg_with_deprecated_funcs;
CREATE MATERIALIZED VIEW conditions_summary_yearly
WITH (timescaledb.continuous) AS
SELECT city,
test.time_bucket('1 year', tstamp) AS bucket,
test1.time_bucket('1 year', tstamp) AS bucket,
MIN(temperature),
MAX(temperature)
FROM conditions
Expand Down
Loading