forked from dbt-labs/dbt-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify running the integration tests
- Loading branch information
Bas Beelen
committed
Apr 16, 2020
1 parent
e49ced6
commit 114cec0
Showing
11 changed files
with
106 additions
and
69 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
target/ | ||
dbt_modules/ | ||
logs/ | ||
venv/ |
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,32 @@ | ||
version: "3.7" | ||
services: | ||
|
||
dbt: | ||
image: circleci/python:3.6.2-stretch | ||
depends_on: | ||
- ${TARGET} | ||
env_file: "./integration_tests/.env/${TARGET}.env" | ||
entrypoint: "/repo/run_test.sh ${TARGET}" | ||
working_dir: /repo | ||
volumes: | ||
- ".:/repo" | ||
|
||
postgres: | ||
image: circleci/postgres:9.6.5-alpine-ram | ||
ports: | ||
- "5432:5432" | ||
|
||
# dummy container, since snowflake is a managed service | ||
snowflake: | ||
image: circleci/python:3.6.2-stretch | ||
entrypoint: "/bin/true" | ||
|
||
# dummy container, since bigquery is a managed service | ||
bigquery: | ||
image: circleci/python:3.6.2-stretch | ||
entrypoint: "/bin/true" | ||
|
||
# dummy container, since redshift is a managed service | ||
redshift: | ||
image: circleci/python:3.6.2-stretch | ||
entrypoint: "/bin/true" |
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 @@ | ||
GCLOUD_SERVICE_KEY_PATH= |
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 @@ | ||
CI_DBT_HOST=postgres | ||
CI_DBT_USER=root | ||
CI_DBT_PASS='' | ||
CI_DBT_PORT=5432 | ||
CI_DBT_DBNAME=circle_test |
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,4 @@ | ||
CI_REDSHIFT_DBT_HOST= | ||
CI_REDSHIFT_DBT_USER= | ||
CI_REDSHIFT_DBT_PASS= | ||
CI_REDSHIFT_DBT_DBNAME= |
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 @@ | ||
CI_SNOWFLAKE_DBT_ACCOUNT= | ||
CI_SNOWFLAKE_DBT_USER= | ||
CI_SNOWFLAKE_DBT_PASS= | ||
CI_SNOWFLAKE_DBT_ROLE= | ||
CI_SNOWFLAKE_DBT_DATABASE= | ||
CI_SNOWFLAKE_DBT_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
TARGETS = postgres redshift snowflake bigquery | ||
.PHONY : test test-all $(TARGETS) | ||
|
||
test-postgres: | ||
dbt seed --target postgres --full-refresh | ||
dbt run --target postgres --full-refresh --exclude test_insert_by_period | ||
dbt test --target postgres --exclude test_insert_by_period | ||
test: export TARGET = $(target) | ||
test: | ||
docker-compose -f ../docker-compose.yml up dbt | ||
|
||
test-redshift: | ||
dbt seed --target redshift --full-refresh | ||
dbt run --target redshift --full-refresh | ||
dbt test --target redshift | ||
$(TARGETS): | ||
$(MAKE) test target=$@ | ||
|
||
test-snowflake: | ||
dbt seed --target snowflake --full-refresh | ||
dbt run --target snowflake --full-refresh | ||
dbt test --target snowflake | ||
|
||
test-bigquery: | ||
dbt seed --target bigquery --full-refresh | ||
dbt run --target bigquery --full-refresh | ||
dbt test --target bigquery | ||
|
||
test-all: test-postgres test-redshift test-snowflake test-bigquery | ||
echo "Completed successfully" | ||
test-all: $(TARGETS) | ||
echo "Tested all targets" |
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,21 @@ | ||
#!/bin/bash | ||
VENV="venv/bin/activate" | ||
|
||
if [[ ! -f $VENV ]]; then | ||
python3 -m venv venv | ||
. $VENV | ||
|
||
pip install --upgrade pip setuptools | ||
pip install dbt | ||
fi | ||
|
||
. $VENV | ||
cd integration_tests | ||
|
||
mkdir -p ~/.dbt | ||
cp ci/sample.profiles.yml ~/.dbt/profiles.yml | ||
|
||
dbt deps --target $1 | ||
dbt seed --target $1 --full-refresh | ||
dbt run --target $1 | ||
dbt test --target $1 |