From a4127864d40051d3a6c7d1d32d73fc9f25e9a285 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Wed, 20 Nov 2024 14:34:25 -0600 Subject: [PATCH] add support for redshift testing --- .github/workflows/ci.yml | 7 +++++++ integration_tests/profiles.yml | 14 +++++++------- supported_adapters.env | 2 +- tox.ini | 22 ++++++++++++++++++++++ 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7497bc..e9c5724 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,13 @@ jobs: SNOWFLAKE_DATABASE: ${{ vars.SNOWFLAKE_DATABASE }} SNOWFLAKE_WAREHOUSE: ${{ vars.SNOWFLAKE_WAREHOUSE }} SNOWFLAKE_SCHEMA: "integration_tests_snowflake_${{ github.run_number }}" + # redshift + REDSHIFT_HOST: ${{ vars.REDSHIFT_HOST }} + REDSHIFT_USER: ${{ vars.REDSHIFT_USER }} + REDSHIFT_DATABASE: ${{ vars.REDSHIFT_DATABASE }} + REDSHIFT_SCHEMA: "integration_tests_redshift_${{ github.run_number }}" + REDSHIFT_PORT: ${{ vars.REDSHIFT_PORT }} secrets: SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} DBT_ENV_SECRET_SNOWFLAKE_PASS: ${{ secrets.SNOWFLAKE_PASS }} + DBT_ENV_SECRET_REDSHIFT_PASS: ${{ secrets.REDSHIFT_PASS }} diff --git a/integration_tests/profiles.yml b/integration_tests/profiles.yml index f2ddf18..d14af9c 100644 --- a/integration_tests/profiles.yml +++ b/integration_tests/profiles.yml @@ -17,13 +17,13 @@ integration_tests: threads: 5 redshift: - type: redshift - host: "{{ env_var('REDSHIFT_TEST_HOST') }}" - user: "{{ env_var('REDSHIFT_TEST_USER') }}" - pass: "{{ env_var('REDSHIFT_TEST_PASS') }}" - dbname: "{{ env_var('REDSHIFT_TEST_DBNAME') }}" - port: "{{ env_var('REDSHIFT_TEST_PORT') | as_number }}" - schema: codegen_integration_tests_redshift + type: "redshift" + host: "{{ env_var('REDSHIFT_HOST') }}" + user: "{{ env_var('REDSHIFT_USER') }}" + pass: "{{ env_var('DBT_ENV_SECRET_REDSHIFT_PASS') }}" + dbname: "{{ env_var('REDSHIFT_DATABASE') }}" + port: "{{ env_var('REDSHIFT_PORT') | as_number }}" + schema: "{{ env_var('REDSHIFT_SCHEMA') }}" threads: 1 bigquery: diff --git a/supported_adapters.env b/supported_adapters.env index 8d18434..7e73438 100644 --- a/supported_adapters.env +++ b/supported_adapters.env @@ -1 +1 @@ -SUPPORTED_ADAPTERS=postgres,snowflake +SUPPORTED_ADAPTERS=postgres,snowflake,redshift diff --git a/tox.ini b/tox.ini index d10286b..69c6b44 100644 --- a/tox.ini +++ b/tox.ini @@ -19,6 +19,13 @@ passenv = SNOWFLAKE_DATABASE SNOWFLAKE_WAREHOUSE SNOWFLAKE_SCHEMA + # redshift env vars + REDSHIFT_HOST + REDSHIFT_USER + DBT_ENV_SECRET_REDSHIFT_PASS + REDSHIFT_DATABASE + REDSHIFT_SCHEMA + REDSHIFT_PORT # Postgres integration tests for centralized dbt testing # run dbt commands directly, assumes dbt is already installed in environment @@ -49,3 +56,18 @@ commands = dbt --warn-error seed --target snowflake --full-refresh dbt --warn-error run --target snowflake dbt --warn-error test --target snowflake + +# redshift integration tests for centralized dbt testing +# run dbt commands directly, assumes dbt is already installed in environment +[testenv:dbt_integration_redshift] +changedir = integration_tests +allowlist_externals = + dbt +skip_install = true +commands = + dbt --version + dbt --warn-error deps --target redshift + dbt --warn-error run-operation create_source_table --target redshift + dbt --warn-error seed --target redshift --full-refresh + dbt --warn-error run --target redshift + dbt --warn-error test --target redshift