timescaledb/test/sql/updates/setup.databases.sql
Mats Kindahl 231549184c Break out superuser operations in update tests
In order to support smoke-testing with a single server, the update
tests are refactored to not require a `postgres` user with full
privileges.

To support both running smoke tests and update tests, the following
changes where made:

- Database creation code was factored out of tests and is only executed
  for update tests.
- Since the default for `docker_pgscript` was to use the `postgres`
  database and the database creation code also switched database to
  `single` as part of the exection, the default of `docker_pgscript` is
  now changed to `single`.
- Parts of tests that changes roles during execution was removed since
  it is more suitable for a regression test. Some `GRANT` statements
  were kept for the update tests since they test that non-superuser
  privileges are propagated correctly.
- Operations that require escalated privileges are factored out into
  support functions that execute the original code for update tests and
  are no-ops for smoke tests.
- A dedicated `test_update_smoke` script was added that can run a smoke
  test against a single server.
2021-03-05 17:50:14 +01:00

22 lines
908 B
SQL

-- 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.
CREATE DATABASE single;
-- Always pre-create the data node database 'dn1' so that we can dump
-- and restore it even on TimescaleDB versions that don't support
-- multinode. Otherwise, we'd have to create version-dependent scripts
-- to specifically handle multinode tests. We use template0, or
-- otherwise dn1 will have the same UUID as 'single' since template1
-- has the extension pre-installed.
CREATE DATABASE dn1 TEMPLATE template0;
\c dn1
-- Make sure the extension is installed so that extension versions
-- that don't support multinode will still be able to update the
-- extension with ALTER EXTENSION ... UPDATE.
CREATE EXTENSION IF NOT EXISTS timescaledb;
\c single
CREATE EXTENSION IF NOT EXISTS timescaledb;