Source

htsql / test / input / pgsql.yaml

#
# Copyright (c) 2006-2013, Prometheus Research, LLC
#

title: PostgreSQL regression tests
suite: pgsql
output: test/output/pgsql.yaml
tests:

- title: Remove any existing regression database
  suite: dropdb
  tests:
  - connect: &admin-connect
      engine: pgsql
      database: postgres
      username: ${PGSQL_USERNAME}
      password: ${PGSQL_PASSWORD}
      host: ${PGSQL_HOST}
      port: ${PGSQL_PORT}
    sql: |
        DROP DATABASE IF EXISTS "htsql_demo";
        DROP ROLE IF EXISTS "htsql_demo";
        DROP DATABASE IF EXISTS "htsql_edge";
        DROP ROLE IF EXISTS "htsql_edge";
        DROP DATABASE IF EXISTS "htsql_etl";
        DROP ROLE IF EXISTS "htsql_etl";
        DROP DATABASE IF EXISTS "htsql_sandbox";
        DROP ROLE IF EXISTS "htsql_sandbox";
    autocommit: true

- title: Deploy the regression database
  suite: createdb
  tests:
  # Create the `demo` database
  - connect: *admin-connect
    sql: |
        CREATE DATABASE "htsql_demo" WITH ENCODING = 'UTF-8';
        CREATE ROLE "htsql_demo" WITH LOGIN PASSWORD 'secret';
        ALTER DATABASE "htsql_demo" OWNER TO "htsql_demo";
    autocommit: true
  - connect: &connect-demo
      engine: pgsql
      database: htsql_demo
      username: htsql_demo
      password: secret
      host: ${PGSQL_HOST}
      port: ${PGSQL_PORT}
    sql: test/sql/demo-pgsql.sql
  - db: *connect-demo
  - py: test/sql/demo-load.py
  # Create the `edge` database
  - connect: *admin-connect
    sql: |
        CREATE DATABASE "htsql_edge" WITH ENCODING = 'UTF-8';
        CREATE ROLE "htsql_edge" WITH LOGIN PASSWORD 'secret';
        ALTER DATABASE "htsql_edge" OWNER TO "htsql_edge";
    autocommit: true
  - connect: &connect-edge
      engine: pgsql
      database: htsql_edge
      username: htsql_edge
      password: secret
      host: ${PGSQL_HOST}
      port: ${PGSQL_PORT}
    sql: test/sql/edge-pgsql.sql
  # Create the `etl` database
  - connect: *admin-connect
    sql: |
        CREATE DATABASE "htsql_etl" WITH ENCODING = 'UTF-8';
        CREATE ROLE "htsql_etl" WITH LOGIN PASSWORD 'secret';
        ALTER DATABASE "htsql_etl" OWNER TO "htsql_etl";
    autocommit: true
  - connect: &connect-etl
      engine: pgsql
      database: htsql_etl
      username: htsql_etl
      password: secret
      host: ${PGSQL_HOST}
      port: ${PGSQL_PORT}
    sql: test/sql/etl-pgsql.sql
  # Create the `sandbox` database
  - connect: *admin-connect
    sql: |
        CREATE DATABASE "htsql_sandbox" WITH ENCODING = 'UTF-8';
        CREATE ROLE "htsql_sandbox" WITH LOGIN PASSWORD 'secret';
        ALTER DATABASE "htsql_sandbox" OWNER TO "htsql_sandbox";
    autocommit: true
  - connect: &connect-sandbox
      engine: pgsql
      database: htsql_sandbox
      username: htsql_sandbox
      password: secret
      host: ${PGSQL_HOST}
      port: ${PGSQL_PORT}
    sql: |
        -- The `sandbox` database is populated by the tests.

- title: Run the test collection
  suite: test
  tests:
  - set: pgsql
  - db: *connect-sandbox
    extensions:
      htsql: {debug: true}
      tweak.pool: {}
    save: sandbox
  - db: *connect-edge
    extensions:
      htsql: {debug: true}
      tweak.pool: {}
    save: edge
  - db: *connect-etl
    extensions:
      htsql: {debug: true}
      tweak.etl: {}
      tweak.pool: {}
    save: etl
  - db: *connect-demo
    extensions:
      htsql: {debug: true}
      tweak.pool: {}
    save: demo
  # The Regression Schema
  - include: test/input/schema.yaml
  # Examples from the Tutorial
  - include: test/input/tutorial.yaml
  # Standard Data Types, Functions, and Operations
  - include: test/input/library.yaml
  # Edge Cases of HTSQL-to-SQL Translation
  - include: test/input/translation.yaml
  # Formatting Output Data
  - include: test/input/format.yaml
  # Extensions
  - include: test/input/addon.yaml
  # Error Reporting
  - include: test/input/error.yaml
  # Embedding HTSQL
  - include: test/input/embedding.yaml
  # ETL/CRUD
  - include: test/input/etl.yaml