Skip to content

Commit 8269c67

Browse files
authored
Merge pull request #195 from dbt-labs/add-new-tests
Add new tests
2 parents b00894a + d02ee00 commit 8269c67

20 files changed

+161
-4
lines changed

integration_tests_2/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Test dbt Project
2+
3+
The models within this folder are used for testing use cases that can't be checked as part of the other `integration_tests` project. No tests are defined as the main purpose is to ensure that all models run properly in specific situations.
4+
5+
Currently, this project is used to test the package behavior when:
6+
- there is no exposure
7+
- there is no metric
8+
- people don't override the default seed for `dbt_project_evaluator_exceptions`
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
# HEY! This file is used in the integration tests with CircleCI.
3+
# You should __NEVER__ check credentials into version control. Thanks for reading :)
4+
5+
config:
6+
send_anonymous_usage_stats: False
7+
use_colors: True
8+
9+
integration_tests:
10+
target: postgres
11+
outputs:
12+
postgres:
13+
type: postgres
14+
host: "{{ env_var('POSTGRES_TEST_HOST') }}"
15+
user: "{{ env_var('POSTGRES_TEST_USER') }}"
16+
pass: "{{ env_var('POSTGRES_TEST_PASS') }}"
17+
port: "{{ env_var('POSTGRES_TEST_PORT') | as_number }}"
18+
dbname: "{{ env_var('POSTGRES_TEST_DBNAME') }}"
19+
schema: dbt_project_evaluator_integration_tests_postgres
20+
threads: 5
21+
22+
redshift:
23+
type: redshift
24+
host: "{{ env_var('REDSHIFT_TEST_HOST') }}"
25+
user: "{{ env_var('REDSHIFT_TEST_USER') }}"
26+
pass: "{{ env_var('REDSHIFT_TEST_PASS') }}"
27+
dbname: "{{ env_var('REDSHIFT_TEST_DBNAME') }}"
28+
port: "{{ env_var('REDSHIFT_TEST_PORT') | as_number }}"
29+
schema: dbt_project_evaluator_integration_tests_redshift
30+
threads: 5
31+
32+
bigquery:
33+
type: bigquery
34+
method: service-account
35+
keyfile: "{{ env_var('BIGQUERY_SERVICE_KEY_PATH') }}"
36+
project: "{{ env_var('BIGQUERY_TEST_DATABASE') }}"
37+
schema: dbt_project_evaluator_integration_tests_bigquery
38+
threads: 10
39+
40+
snowflake:
41+
type: snowflake
42+
account: "{{ env_var('SNOWFLAKE_TEST_ACCOUNT') }}"
43+
user: "{{ env_var('SNOWFLAKE_TEST_USER') }}"
44+
password: "{{ env_var('SNOWFLAKE_TEST_PASSWORD') }}"
45+
role: "{{ env_var('SNOWFLAKE_TEST_ROLE') }}"
46+
database: "{{ env_var('SNOWFLAKE_TEST_DATABASE') }}"
47+
warehouse: "{{ env_var('SNOWFLAKE_TEST_WAREHOUSE') }}"
48+
schema: dbt_project_evaluator_integration_tests_snowflake
49+
threads: 10
50+
51+
databricks:
52+
type: databricks
53+
schema: dbt_project_evaluator_integration_tests_databricks
54+
host: "{{ env_var('DATABRICKS_TEST_HOST') }}"
55+
http_path: "{{ env_var('DATABRICKS_TEST_HTTP_PATH') }}"
56+
token: "{{ env_var('DATABRICKS_TEST_ACCESS_TOKEN') }}"
57+
threads: 10

integration_tests_2/dbt_project.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
# Name your project! Project names should contain only lowercase characters
3+
# and underscores. A good package name should reflect your organization's
4+
# name or the intended use of these models
5+
name: 'dbt_project_evaluator_integration_tests_2'
6+
version: '1.0.0'
7+
config-version: 2
8+
9+
# This setting configures which "profile" dbt uses for this project.
10+
profile: 'integration_tests'
11+
12+
# These configurations specify where dbt should look for different types of files.
13+
# The `source-paths` config, for example, states that models in this project can be
14+
# found in the "models/" directory. You probably won't need to change these!
15+
model-paths: ["models"]
16+
analysis-paths: ["analysis"]
17+
test-paths: ["tests"]
18+
seed-paths: ["seeds"]
19+
macro-paths: ["macros"]
20+
snapshot-paths: ["snapshots"]
21+
22+
target-path: "target" # directory which will store compiled SQL files
23+
clean-targets: # directories to be removed by `dbt clean`
24+
- "target"
25+
- "dbt_packages"
26+
27+
dispatch:
28+
- macro_namespace: dbt_utils
29+
search_order: ['dbt_project_evaluator', 'spark_utils', 'dbt_utils']
30+
31+
models:
32+
dbt_project_evaluator_integration_tests_2:
33+
# materialize as ephemeral to prevent the fake models from executing, but keep them enabled
34+
+materialized: ephemeral
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{
2+
config(
3+
materialized = 'table',
4+
)
5+
}}
6+
7+
select 1 as id
8+
-- depends on: {{ ref('stg_model_3') }}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ source('source_1', 'table_5') }}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- depends on: {{ ref('stg_model_1') }}
2+
-- depends on: {{ source('source_1', 'table_2') }}
3+
4+
select 1 as id
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{ ref('int_model_4') }}
2+
{{ ref('stg_model_1') }}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{ ref('stg_model_4') }}
2+
{{ ref('int_model_5') }}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- a model with no upstream parent resources
2+
-- aka a model that is not using the source or ref function
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ ref('fct_model_6') }}

0 commit comments

Comments
 (0)