-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #320 from dbt-labs/er/support-tox
Add tox support for testing redshift, bigquery and snowflake
- Loading branch information
Showing
11 changed files
with
203 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# **what?** | ||
# Run tests for dbt-external-tables against supported adapters | ||
|
||
# **why?** | ||
# To ensure that dbt-external-tables works as expected with all supported adapters | ||
|
||
# **when?** | ||
# On every PR, and every push to main and when manually triggered | ||
|
||
name: Package Integration Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
run-tests: | ||
uses: dbt-labs/dbt-package-testing/.github/workflows/run_tox.yml@v1 | ||
with: | ||
# redshift | ||
REDSHIFT_HOST: ${{ vars.REDSHIFT_HOST }} | ||
REDSHIFT_USER: ${{ vars.REDSHIFT_USER }} | ||
REDSHIFT_PORT: ${{ vars.REDSHIFT_PORT }} | ||
REDSHIFT_DATABASE: ${{ vars.REDSHIFT_DATABASE }} | ||
REDSHIFT_SCHEMA: "integration_tests_redshift_${{ github.run_number }}" | ||
# snowflake | ||
SNOWFLAKE_USER: ${{ vars.SNOWFLAKE_USER }} | ||
SNOWFLAKE_WAREHOUSE: ${{ vars.SNOWFLAKE_WAREHOUSE }} | ||
SNOWFLAKE_ROLE: ${{ vars.SNOWFLAKE_ROLE }} | ||
SNOWFLAKE_DATABASE: ${{ vars.SNOWFLAKE_DATABASE }} | ||
SNOWFLAKE_SCHEMA: "integration_tests_snowflake_${{ github.run_number }}" | ||
# bigquery | ||
BIGQUERY_PROJECT: ${{ vars.BIGQUERY_PROJECT }} | ||
BIGQUERY_SCHEMA: "integration_tests_bigquery_${{ github.run_number }}" | ||
|
||
secrets: | ||
DBT_ENV_SECRET_REDSHIFT_PASS: ${{ secrets.DBT_ENV_SECRET_REDSHIFT_PASS }} | ||
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} | ||
DBT_ENV_SECRET_SNOWFLAKE_PASS: ${{ secrets.DBT_ENV_SECRET_SNOWFLAKE_PASS }} | ||
BIGQUERY_KEYFILE_JSON: ${{ secrets.BIGQUERY_KEYFILE_JSON }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
**/env/ | ||
**/venv/ | ||
**/test.env | ||
integration_tests/vars.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
packages: | ||
- local: ../ | ||
- package: dbt-labs/dbt_utils | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# gh variable set -f integration_tests/vars.env | ||
|
||
# redshift | ||
REDSHIFT_HOST= | ||
REDSHIFT_USER= | ||
REDSHIFT_DATABASE= | ||
REDSHIFT_PORT= | ||
REDSHIFT_SPECTRUM_IAM_ROLE= | ||
|
||
# snowflake | ||
SNOWFLAKE_ACCOUNT= | ||
SNOWFLAKE_USER= | ||
SNOWFLAKE_ROLE= | ||
SNOWFLAKE_DATABASE= | ||
SNOWFLAKE_WAREHOUSE= | ||
|
||
# bigquery | ||
BIGQUERY_PROJECT= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SUPPORTED_ADAPTERS=snowflake,redshift,bigquery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
[tox] | ||
skipsdist = True | ||
envlist = lint_all, testenv | ||
|
||
[testenv] | ||
passenv = | ||
# redshift | ||
REDSHIFT_HOST | ||
REDSHIFT_USER | ||
DBT_ENV_SECRET_REDSHIFT_PASS | ||
REDSHIFT_DATABASE | ||
REDSHIFT_SCHEMA | ||
REDSHIFT_PORT | ||
REDSHIFT_SPECTRUM_IAM_ROLE | ||
# snowflake | ||
SNOWFLAKE_ACCOUNT | ||
SNOWFLAKE_USER | ||
DBT_ENV_SECRET_SNOWFLAKE_PASS | ||
SNOWFLAKE_ROLE | ||
SNOWFLAKE_DATABASE | ||
SNOWFLAKE_WAREHOUSE | ||
SNOWFLAKE_SCHEMA | ||
# bigquery | ||
BIGQUERY_KEYFILE_JSON | ||
BIGQUERY_PROJECT | ||
BIGQUERY_SCHEMA | ||
|
||
# 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 deps --target redshift | ||
dbt seed --full-refresh --target redshift | ||
dbt run --target redshift | ||
dbt run-operation prep_external --target redshift | ||
dbt run-operation dbt_external_tables.stage_external_sources --vars 'ext_full_refresh: true' --target redshift | ||
dbt run-operation dbt_external_tables.stage_external_sources --target redshift | ||
dbt test --target redshift | ||
|
||
# run dbt commands directly, assumes dbt is already installed in environment | ||
[testenv:dbt_integration_snowflake] | ||
changedir = integration_tests | ||
allowlist_externals = | ||
dbt | ||
skip_install = true | ||
commands = | ||
dbt deps --target snowflake | ||
dbt seed --full-refresh --target snowflake | ||
dbt run --target snowflake | ||
dbt run-operation prep_external --target snowflake | ||
dbt run-operation dbt_external_tables.stage_external_sources --vars 'ext_full_refresh: true' --target snowflake | ||
dbt run-operation dbt_external_tables.stage_external_sources --target snowflake | ||
dbt test --target snowflake | ||
|
||
# run dbt commands directly, assumes dbt is already installed in environment | ||
[testenv:dbt_integration_bigquery] | ||
changedir = integration_tests | ||
allowlist_externals = | ||
dbt | ||
skip_install = true | ||
commands = | ||
dbt deps --target bigquery | ||
dbt seed --full-refresh --target bigquery | ||
dbt run --target bigquery | ||
dbt run-operation prep_external --target bigquery | ||
dbt run-operation dbt_external_tables.stage_external_sources --vars 'ext_full_refresh: true' --target bigquery | ||
dbt run-operation dbt_external_tables.stage_external_sources --target bigquery | ||
dbt test --target bigquery |