Skip to content

Commit

Permalink
Merge pull request #46 from dbt-labs/add-to-CI-tests
Browse files Browse the repository at this point in the history
Add to ci tests
  • Loading branch information
dave-connors-3 authored Mar 2, 2023
2 parents 35fc756 + 62e4af0 commit 195c63b
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@ jobs:
node-version: 16
- name: install avj
run: npm install --no-save [email protected]
- name: validate dbt_project.yml sample file
run: npx ajv-cli validate -s schemas/dbt_project.json -d tests/dbt_project.yml
- name: validate sample model YAML file
run: npx ajv-cli validate -s schemas/dbt_yml_files.json -d tests/schema.yml
- name: Validate dbt_project.yml sample files
run: |
npx ajv-cli test -s schemas/dbt_project.json -d tests/valid/dbt_project.yml --valid
npx ajv-cli test -s schemas/dbt_project.json -d tests/invalid/dbt_project.yml --invalid
- name: Validate resource yml sample files
run: |
npx ajv-cli test -s schemas/dbt_yml_files.json -d tests/valid/schema.yml --valid
npx ajv-cli test -s schemas/dbt_yml_files.json -d tests/invalid/schema.yml --invalid
- name: Validate packages.yml sample files
run: |
npx ajv-cli test -s schemas/packages.json -d tests/valid/packages.yml --valid
npx ajv-cli test -s schemas/packages.json -d tests/invalid/packages.yml --invalid
- name: Validate selectors.yml sample files
run: |
npx ajv-cli test -s schemas/selectors.json -d tests/valid/selectors.yml --valid
npx ajv-cli test -s schemas/selectors.json -d tests/invalid/selectors.yml --invalid
44 changes: 44 additions & 0 deletions tests/invalid/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# this file was generated with dbt init with dbt 1.2.1

# Name your project! Project names should contain only lowercase characters
# and underscores. A good package name should reflect your organization's
# name or the intended use of these models
name: 'test'
version: '1.0.0'
config-version: 2

# This setting configures which "profile" dbt uses for this project.
profile: 'test'

# These configurations specify where dbt should look for different types of files.
# The `model-paths` config, for example, states that models in this project can be
# found in the "models/" directory. You probably won't need to change these!
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

target-path: "target" # directory which will store compiled SQL files
clean-targets: # directories to be removed by `dbt clean`
- "target"
- "dbt_packages"


# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models

# In this example config, we tell dbt to build all models in the example/ directory
# as tables. These settings can be overridden in the individual model files
# using the `{{ config(...) }}` macro.
models:
test:
# Config indicated by + and applies to all files under models/example/
example:
+materialized: view
+bogus_key: true

seeds:
test:
+enabled: false
8 changes: 8 additions & 0 deletions tests/invalid/packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
packages:
- package: dbt-labs/dbt-utils
version_number: 1.0.0

- git_address: "https://github.com/dbt-labs/dbt-utils.git"
revision: 0.9.2

- local_path: /opt/dbt/redshift
24 changes: 24 additions & 0 deletions tests/invalid/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# this file was generated with dbt init with dbt 1.2.1

version: 2

models:
- name: my_first_dbt_model
description: "A starter dbt model"
jarrod: saltalamachhia
columns:
- name: id
description: "The primary key for this table"
nomar: garciaparra
tests:
- unique
- not_null

- name: my_second_dbt_model
description: "A starter dbt model"
columns:
- name: id
description: "The primary key for this table"
tests:
- unique
- not_null
8 changes: 8 additions & 0 deletions tests/invalid/selectors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
selector:
- name: nodes_to_joy
definition:
method_of_attack: tag
value: nightly
dont_include:
- "@tag:daily"

File renamed without changes.
8 changes: 8 additions & 0 deletions tests/valid/packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
packages:
- package: dbt-labs/dbt-utils
version: 1.0.0

- git: "https://github.com/dbt-labs/dbt-utils.git"
revision: 1.0.0

- local: /opt/dbt/redshift
File renamed without changes.
8 changes: 8 additions & 0 deletions tests/valid/selectors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
selectors:
- name: nodes_to_joy
definition:
method: tag
value: nightly
exclude:
- "@tag:daily"

0 comments on commit 195c63b

Please sign in to comment.