Break out multinode update tests

This commit is part of a longer sequence to refactor the update tests
for use with smoke testing.

The multinode parts of the tests are broken out into a new version to
make the logic simpler.

- All multinode tests are now added to a new version, `v7` which allow
  us to create multinode objects only for versions that support
  multinode.
- Test script `test_updates_pg11` and `test_updates_pg12` are changed
  to use `v6` for updates from versions preceeding 2.0 and `v7` for
  versions 2.0 and later.
- Setup file `post.update.sql` is not needed any more since it was used
  to "fix" a pre-2.0 updated version to add data nodes so that it
  matched the clean setup. This is not necessary any more since v6 does
  not add data nodes for some versions and not for others.
This commit is contained in:
Mats Kindahl 2021-03-01 14:48:44 +01:00 committed by Mats Kindahl
parent f0675be2e2
commit 10b3da03ec
7 changed files with 48 additions and 41 deletions

View File

@ -200,19 +200,13 @@ docker_pgcmd ${CONTAINER_UPDATED} "ALTER EXTENSION timescaledb UPDATE" "dn1"
# which is available in the image.
docker_pgcmd ${CONTAINER_UPDATED} "ALTER EXTENSION timescaledb UPDATE" "postgres"
# Post update script. Needed for multi-node tests when updating from a
# version that doesn't support multi-node to a multi-node capable
# version.
if [[ "${TEST_VERSION}" > "v6" ]] || [[ "${TEST_VERSION}" = "v6" ]]; then
echo "Executing post update scripts"
docker_pgscript ${CONTAINER_UPDATED} /src/test/sql/updates/post.update.sql "single"
if [[ "${TEST_REPAIR}" = "true" ]]; then
echo "Executing post update repair script"
docker_pgscript ${CONTAINER_UPDATED} /src/test/sql/updates/post.repair.sql "single"
fi
fi
# Check that there is nothing wrong before taking a backup
echo "Checking that there are no missing dimension slices"
docker_pgscript ${CONTAINER_UPDATED} /src/test/sql/updates/setup.check.sql

View File

@ -32,7 +32,7 @@ if [ $EXIT_CODE -ne 0 ]; then
exit $EXIT_CODE
fi
TAGS="1.7.0-pg11 1.7.1-pg11 1.7.2-pg11 1.7.3-pg11 1.7.4-pg11 1.7.5-pg11 2.0.0-rc1-pg11 2.0.0-rc2-pg11 2.0.0-rc3-pg11 2.0.0-rc4-pg11 2.0.0-pg11 2.0.1-pg11 2.0.2-pg11 2.1.0-pg11"
TAGS="1.7.0-pg11 1.7.1-pg11 1.7.2-pg11 1.7.3-pg11 1.7.4-pg11 1.7.5-pg11"
TEST_VERSION="v6"
TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh "$@"
@ -40,3 +40,12 @@ EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
exit $EXIT_CODE
fi
TAGS="2.0.0-rc1-pg11 2.0.0-rc2-pg11 2.0.0-rc3-pg11 2.0.0-rc4-pg11 2.0.0-pg11 2.0.1-pg11 2.0.2-pg11 2.1.0-pg11"
TEST_VERSION="v7"
TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh "$@"
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
exit $EXIT_CODE
fi

View File

@ -6,7 +6,7 @@ set -o pipefail
SCRIPT_DIR=$(dirname $0)
echo $SCRIPT_DIR
TAGS="1.7.0-pg12 1.7.1-pg12 1.7.2-pg12 1.7.3-pg12 1.7.4-pg12 1.7.5-pg12 2.0.0-rc1-pg12 2.0.0-rc2-pg12 2.0.0-rc3-pg12 2.0.0-rc4-pg12 2.0.0-pg12 2.0.1-pg12 2.0.2-pg12 2.1.0-pg12"
TAGS="1.7.0-pg12 1.7.1-pg12 1.7.2-pg12 1.7.3-pg12 1.7.4-pg12 1.7.5-pg12"
TEST_VERSION="v6"
TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh "$@"
@ -14,3 +14,12 @@ EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
exit $EXIT_CODE
fi
TAGS="2.0.0-rc1-pg12 2.0.0-rc2-pg12 2.0.0-rc3-pg12 2.0.0-rc4-pg12 2.0.0-pg12 2.0.1-pg12 2.0.2-pg12 2.1.0-pg12"
TEST_VERSION="v7"
TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh "$@"
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
exit $EXIT_CODE
fi

View File

@ -1,23 +0,0 @@
-- 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.
DO LANGUAGE PLPGSQL $$
DECLARE
relid regclass = NULL;
ts_version TEXT;
BEGIN
SELECT oid INTO relid FROM pg_class WHERE relname='disthyper';
SELECT extversion INTO ts_version FROM pg_extension WHERE extname = 'timescaledb';
-- Can only run multinode on 2.0.0+
IF relid IS NULL AND ts_version >= '2.0.0' THEN
RAISE NOTICE 'creating multinode setup for version % on database %',
ts_version, current_database();
PERFORM add_data_node('dn1', host=>'localhost', database=>'dn1');
CREATE TABLE disthyper (time timestamptz, device int, temp float);
PERFORM create_distributed_hypertable('disthyper', 'time', 'device');
INSERT INTO disthyper VALUES ('2020-12-20 12:18', 1, 27.9);
END IF;
END
$$;

View File

@ -0,0 +1,13 @@
-- 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.
\ir post.catalog.sql
\ir post.insert.sql
\ir post.integrity_test.sql
\ir catalog_missing_columns.sql
\ir post.compression.sql
\ir post.continuous_aggs.v2.sql
\ir post.policies.sql
\ir post.sequences.sql
\ir post.functions.sql

View File

@ -9,4 +9,3 @@
\if :TEST_REPAIR
\ir setup.repair.sql
\endif
\ir setup.multinode.sql

View File

@ -0,0 +1,6 @@
-- 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.
\ir setup.v6.sql
\ir setup.multinode.sql