mirror of
https://github.com/dbt-labs/dbt-core
synced 2025-12-20 23:31:27 +00:00
Compare commits
5 Commits
adding-sem
...
pr/2741
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
662e30eea1 | ||
|
|
c93bc9cecb | ||
|
|
c086f3c331 | ||
|
|
b794f7e242 | ||
|
|
253bc56e17 |
@@ -2,7 +2,7 @@ version: 2.1
|
|||||||
jobs:
|
jobs:
|
||||||
unit:
|
unit:
|
||||||
docker: &test_only
|
docker: &test_only
|
||||||
- image: fishtownanalytics/test-container:7
|
- image: fishtownanalytics/test-container:9
|
||||||
environment:
|
environment:
|
||||||
DBT_INVOCATION_ENV: circle
|
DBT_INVOCATION_ENV: circle
|
||||||
steps:
|
steps:
|
||||||
@@ -30,7 +30,7 @@ jobs:
|
|||||||
destination: dist
|
destination: dist
|
||||||
integration-postgres-py36:
|
integration-postgres-py36:
|
||||||
docker: &test_and_postgres
|
docker: &test_and_postgres
|
||||||
- image: fishtownanalytics/test-container:7
|
- image: fishtownanalytics/test-container:9
|
||||||
environment:
|
environment:
|
||||||
DBT_INVOCATION_ENV: circle
|
DBT_INVOCATION_ENV: circle
|
||||||
- image: postgres
|
- image: postgres
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -43,6 +43,7 @@ htmlcov/
|
|||||||
.coverage
|
.coverage
|
||||||
.coverage.*
|
.coverage.*
|
||||||
.cache
|
.cache
|
||||||
|
.env
|
||||||
nosetests.xml
|
nosetests.xml
|
||||||
coverage.xml
|
coverage.xml
|
||||||
*,cover
|
*,cover
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
### Under the hood
|
### Under the hood
|
||||||
- If column config says quote, use quoting in SQL for adding a comment. ([#2539](https://github.com/fishtown-analytics/dbt/issues/2539), [#2733](https://github.com/fishtown-analytics/dbt/pull/2733))
|
- If column config says quote, use quoting in SQL for adding a comment. ([#2539](https://github.com/fishtown-analytics/dbt/issues/2539), [#2733](https://github.com/fishtown-analytics/dbt/pull/2733))
|
||||||
|
- Added support for running docker-based tests under Linux. ([#2739](https://github.com/fishtown-analytics/dbt/issues/2739))
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
- Specify all three logging levels (`INFO`, `WARNING`, `ERROR`) in result logs for commands `test`, `seed`, `run`, `snapshot` and `source snapshot-freshness` ([#2680](https://github.com/fishtown-analytics/dbt/pull/2680), [#2723](https://github.com/fishtown-analytics/dbt/pull/2723))
|
- Specify all three logging levels (`INFO`, `WARNING`, `ERROR`) in result logs for commands `test`, `seed`, `run`, `snapshot` and `source snapshot-freshness` ([#2680](https://github.com/fishtown-analytics/dbt/pull/2680), [#2723](https://github.com/fishtown-analytics/dbt/pull/2723))
|
||||||
|
|||||||
26
Dockerfile
26
Dockerfile
@@ -1,7 +1,6 @@
|
|||||||
FROM ubuntu:18.04
|
FROM ubuntu:18.04
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
ARG DOCKERIZE_VERSION=v0.6.1
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get dist-upgrade -y && \
|
apt-get dist-upgrade -y && \
|
||||||
@@ -19,20 +18,33 @@ RUN apt-get update && \
|
|||||||
python3.9 python3.9-dev python3.9-venv && \
|
python3.9 python3.9-dev python3.9-venv && \
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
RUN useradd -mU dbt_test_user
|
ARG DOCKERIZE_VERSION=v0.6.1
|
||||||
RUN mkdir /usr/app && chown dbt_test_user /usr/app
|
|
||||||
RUN mkdir /home/tox && chown dbt_test_user /home/tox
|
|
||||||
RUN curl -LO https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
|
RUN curl -LO https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
|
||||||
tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
|
tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
|
||||||
rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
|
rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
|
||||||
|
|
||||||
WORKDIR /usr/app
|
|
||||||
VOLUME /usr/app
|
|
||||||
|
|
||||||
RUN pip3 install -U "tox==3.14.4" wheel "six>=1.14.0,<1.15.0" "virtualenv==20.0.3" setuptools
|
RUN pip3 install -U "tox==3.14.4" wheel "six>=1.14.0,<1.15.0" "virtualenv==20.0.3" setuptools
|
||||||
# tox fails if the 'python' interpreter (python2) doesn't have `tox` installed
|
# tox fails if the 'python' interpreter (python2) doesn't have `tox` installed
|
||||||
RUN pip install -U "tox==3.14.4" "six>=1.14.0,<1.15.0" "virtualenv==20.0.3" setuptools
|
RUN pip install -U "tox==3.14.4" "six>=1.14.0,<1.15.0" "virtualenv==20.0.3" setuptools
|
||||||
|
|
||||||
|
# These args are passed in via docker-compose, which reads then from the .env file.
|
||||||
|
# On Linux, run `make .env` to create the .env file for the current user.
|
||||||
|
# On MacOS and Windows, these can stay unset.
|
||||||
|
ARG USER_ID
|
||||||
|
ARG GROUP_ID
|
||||||
|
|
||||||
|
RUN if [ ${USER_ID:-0} -ne 0 ] && [ ${GROUP_ID:-0} -ne 0 ]; then \
|
||||||
|
groupadd -g ${GROUP_ID} dbt_test_user && \
|
||||||
|
useradd -m -l -u ${USER_ID} -g ${GROUP_ID} dbt_test_user; \
|
||||||
|
else \
|
||||||
|
useradd -mU -l dbt_test_user; \
|
||||||
|
fi
|
||||||
|
RUN mkdir /usr/app && chown dbt_test_user /usr/app
|
||||||
|
RUN mkdir /home/tox && chown dbt_test_user /home/tox
|
||||||
|
|
||||||
|
WORKDIR /usr/app
|
||||||
|
VOLUME /usr/app
|
||||||
|
|
||||||
USER dbt_test_user
|
USER dbt_test_user
|
||||||
|
|
||||||
ENV PYTHONIOENCODING=utf-8
|
ENV PYTHONIOENCODING=utf-8
|
||||||
|
|||||||
15
Makefile
15
Makefile
@@ -5,25 +5,32 @@ changed_tests := `git status --porcelain | grep '^\(M\| M\|A\| A\)' | awk '{ pri
|
|||||||
install:
|
install:
|
||||||
pip install -e .
|
pip install -e .
|
||||||
|
|
||||||
test:
|
test: .env
|
||||||
@echo "Full test run starting..."
|
@echo "Full test run starting..."
|
||||||
@time docker-compose run test tox
|
@time docker-compose run test tox
|
||||||
|
|
||||||
test-unit:
|
test-unit: .env
|
||||||
@echo "Unit test run starting..."
|
@echo "Unit test run starting..."
|
||||||
@time docker-compose run test tox -e unit-py36,flake8
|
@time docker-compose run test tox -e unit-py36,flake8
|
||||||
|
|
||||||
test-integration:
|
test-integration: .env
|
||||||
@echo "Integration test run starting..."
|
@echo "Integration test run starting..."
|
||||||
@time docker-compose run test tox -e integration-postgres-py36,integration-redshift-py36,integration-snowflake-py36,integration-bigquery-py36
|
@time docker-compose run test tox -e integration-postgres-py36,integration-redshift-py36,integration-snowflake-py36,integration-bigquery-py36
|
||||||
|
|
||||||
test-quick:
|
test-quick: .env
|
||||||
@echo "Integration test run starting..."
|
@echo "Integration test run starting..."
|
||||||
@time docker-compose run test tox -e integration-postgres-py36 -- -x
|
@time docker-compose run test tox -e integration-postgres-py36 -- -x
|
||||||
|
|
||||||
|
# This rule creates a file named .env that is used by docker-compose for passing
|
||||||
|
# the USER_ID and GROUP_ID arguments to the Docker image.
|
||||||
|
.env:
|
||||||
|
@echo USER_ID=$(shell id -u) > .env
|
||||||
|
@echo GROUP_ID=$(shell id -g) >> .env
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f .coverage
|
rm -f .coverage
|
||||||
rm -rf .eggs/
|
rm -rf .eggs/
|
||||||
|
rm -f .env
|
||||||
rm -rf .tox/
|
rm -rf .tox/
|
||||||
rm -rf build/
|
rm -rf build/
|
||||||
rm -rf dbt.egg-info/
|
rm -rf dbt.egg-info/
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
# Run `make .env` to set $USER_ID and $GROUP_ID
|
||||||
|
USER_ID: ${USER_ID}
|
||||||
|
GROUP_ID: ${GROUP_ID}
|
||||||
command: "/root/.virtualenvs/dbt/bin/pytest"
|
command: "/root/.virtualenvs/dbt/bin/pytest"
|
||||||
env_file:
|
env_file:
|
||||||
- ./test.env
|
- ./test.env
|
||||||
|
|||||||
Reference in New Issue
Block a user