-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update testing structure for dbt Labs testing support - postgres (#181)
* add tox * add postgres/redshift/bq * add more wh, update var names * fix profiles key * move supported adapters * Add CI workflow * update to allow circleci to keep working * fix BQ var name * remove config from profile * move to just support postgres * fix vars * use premade workflow * add newline * use merged version * add comments about future adapters * use tag * update readme * Add lines * reowkr profile so it can be reused * add sample env files and fix comment * Update .circleci/config.yml Co-authored-by: Doug Beatty <[email protected]> * let circleCI set the schema * fix readme instructions * undo non-postgres changes --------- Co-authored-by: Doug Beatty <[email protected]>
- Loading branch information
Showing
12 changed files
with
119 additions
and
51 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
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,33 @@ | ||
# **what?** | ||
# Run tests for dbt-codegen against supported adapters | ||
|
||
# **why?** | ||
# To ensure that dbt-codegen 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 | ||
# this just tests with postgres so no variables need to be passed through. | ||
# When it's time to add more adapters you will need to pass through inputs for | ||
# the other adapters as shown in the below example for redshift | ||
# with: | ||
# # 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: | ||
# DBT_ENV_SECRET_REDSHIFT_PASS: ${{ secrets.DBT_ENV_SECRET_REDSHIFT_PASS }} |
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,3 @@ | ||
BIGQUERY_PROJECT= | ||
BIGQUERY_SCHEMA= | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
POSTGRES_HOST=localhost | ||
POSTGRES_USER=root | ||
DBT_ENV_SECRET_POSTGRES_PASS=password | ||
POSTGRES_PORT=5432 | ||
POSTGRES_DATABASE=codegen_test | ||
POSTGRES_SCHEMA=codegen_integration_tests_postgres |
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,5 @@ | ||
REDSHIFT_TEST_HOST= | ||
REDSHIFT_TEST_USER= | ||
REDSHIFT_TEST_PASS= | ||
REDSHIFT_TEST_DBNAME= | ||
REDSHIFT_TEST_PORT= |
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,6 @@ | ||
SNOWFLAKE_TEST_ACCOUNT= | ||
SNOWFLAKE_TEST_USER= | ||
SNOWFLAKE_TEST_PASSWORD= | ||
SNOWFLAKE_TEST_ROLE= | ||
SNOWFLAKE_TEST_DATABASE= | ||
SNOWFLAKE_TEST_WAREHOUSE= |
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
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=postgres |
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,27 @@ | ||
[tox] | ||
skipsdist = True | ||
envlist = lint_all, testenv | ||
|
||
[testenv] | ||
passenv = | ||
# postgres env vars | ||
POSTGRES_HOST | ||
POSTGRES_USER | ||
DBT_ENV_SECRET_POSTGRES_PASS | ||
POSTGRES_PORT | ||
POSTGRES_DATABASE | ||
POSTGRES_SCHEMA | ||
|
||
# Postgres integration tests for centralized dbt testing | ||
# run dbt commands directly, assumes dbt is already installed in environment | ||
[testenv:dbt_integration_postgres] | ||
changedir = integration_tests | ||
allowlist_externals = | ||
dbt | ||
skip_install = true | ||
commands = | ||
dbt --warn-error deps --target postgres | ||
dbt --warn-error run-operation create_source_table --target postgres | ||
dbt --warn-error seed --target postgres --full-refresh | ||
dbt --warn-error run --target postgres | ||
dbt --warn-error test --target postgres |