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.
Fix
make test
for running integration tests locally (dbt-labs#591)
* Remove venv from CircleCI * Utilize latest minor version of Python 3.9 for CircleCI (rather than pinned patch version) * Align local environment variables with CircleCI * Ignore changes related to running integration tests * Move the make file to the project root * Refactor make commands to run integration tests * Update instructions for running tests * Implementation guidelines * Switch order of testing all models vs. a single model in the instructions
- Loading branch information
Showing
13 changed files
with
175 additions
and
112 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
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,24 @@ | ||
.DEFAULT_GOAL:=help | ||
|
||
.PHONY: test | ||
test: ## Run the integration tests. | ||
@./run_test.sh $(target) $(models) $(seeds) | ||
|
||
.PHONY: dev | ||
dev: ## Installs dbt-* packages in develop mode along with development dependencies. | ||
@\ | ||
echo "Install dbt-$(target)..."; \ | ||
pip install --upgrade pip setuptools; \ | ||
pip install --pre "dbt-$(target)" -r dev-requirements.txt; | ||
|
||
.PHONY: setup-db | ||
setup-db: ## Setup Postgres database with docker-compose for system testing. | ||
@\ | ||
docker-compose up --detach postgres | ||
|
||
.PHONY: help | ||
help: ## Show this help message. | ||
@echo 'usage: make [target]' | ||
@echo | ||
@echo 'targets:' | ||
@grep -E '^[8+a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
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,32 +1,8 @@ | ||
version: "3.7" | ||
services: | ||
|
||
dbt: | ||
image: circleci/python:3.6.3-stretch | ||
depends_on: | ||
- ${TARGET} | ||
env_file: "./integration_tests/.env/${TARGET}.env" | ||
entrypoint: "/repo/run_test.sh ${TARGET} ${MODELS} ${SEEDS}" | ||
working_dir: /repo | ||
volumes: | ||
- ".:/repo" | ||
|
||
postgres: | ||
image: circleci/postgres:9.6.5-alpine-ram | ||
image: cimg/postgres:9.6 | ||
environment: | ||
- POSTGRES_USER=root | ||
ports: | ||
- "5432:5432" | ||
|
||
# dummy container, since snowflake is a managed service | ||
snowflake: | ||
image: circleci/python:3.6.3-stretch | ||
entrypoint: "/bin/true" | ||
|
||
# dummy container, since bigquery is a managed service | ||
bigquery: | ||
image: circleci/python:3.6.3-stretch | ||
entrypoint: "/bin/true" | ||
|
||
# dummy container, since redshift is a managed service | ||
redshift: | ||
image: circleci/python:3.6.3-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 |
---|---|---|
@@ -1 +1,2 @@ | ||
GCLOUD_SERVICE_KEY_PATH= | ||
BIGQUERY_SERVICE_KEY_PATH= | ||
BIGQUERY_TEST_DATABASE= |
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,5 +1,5 @@ | ||
CI_DBT_HOST=postgres | ||
CI_DBT_USER=root | ||
CI_DBT_PASS='' | ||
CI_DBT_PORT=5432 | ||
CI_DBT_DBNAME=circle_test | ||
POSTGRES_TEST_HOST=localhost | ||
POSTGRES_TEST_USER=root | ||
POSTGRES_TEST_PASS='' | ||
POSTGRES_TEST_PORT=5432 | ||
POSTGRES_TEST_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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
CI_REDSHIFT_DBT_HOST= | ||
CI_REDSHIFT_DBT_USER= | ||
CI_REDSHIFT_DBT_PASS= | ||
CI_REDSHIFT_DBT_DBNAME= | ||
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 |
---|---|---|
@@ -1,6 +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= | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
target/ | ||
dbt_modules/ | ||
logs/ | ||
.env/ | ||
profiles.yml |
This file was deleted.
Oops, something went wrong.
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,13 +1,3 @@ | ||
#!/bin/bash | ||
VENV="venv/bin/activate" | ||
|
||
if [[ ! -f $VENV ]]; then | ||
python3 -m venv venv | ||
. $VENV | ||
|
||
pip install --upgrade pip setuptools | ||
pip install --pre "dbt-$1" -r dev-requirements.txt | ||
fi | ||
|
||
. $VENV | ||
python3 -m pytest tests/functional --profile $1 |
Oops, something went wrong.