Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DBT TEST] dbt test does not seems to pick the tests when +enabled is false on project level and +enabled is true on sub-model-dir level #3591

Closed
4 tasks
karthikeyan-sivabaskaran opened this issue Jul 17, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@karthikeyan-sivabaskaran
Copy link

karthikeyan-sivabaskaran commented Jul 17, 2021

Describe the bug

I tried to run dbt test with the +enabled config turned OFF on dbt project level and the same config is turned ON at sub-models-directory level, and got the output WARNING: Nothing to do. Try checking your model configs and model specification args

Steps To Reproduce

dbt init my_new_project : to start the fresh new dbt project, which by default will have 2 models and 4 tests under example models directory.

dbt compile: you should see 2 models and 4 tests

Changed the dbt_project.yml file to add the +enabled config on project and model level.

models:
  my_new_project:
      # Applies to all files under models/example/
      +enabled: false
      example:
        +enabled: true
        materialized: view

After saving the dbt_project.yml file, run dbt compile, now you will be seeing only 2 models and 0 tests

Expected behavior

As per docs, configuration on model level takes higher precedence than the config declared on project level. But, this holds true for models and it seems it is not same for tests.

dbt compile or dbt test after adding the +enabled config should have picked the 4 tests which is defined in schema.yml file under example model directory.

Screenshots and log output

image

System information

Which database are you using dbt with? - Snowflake

  • postgres
  • redshift
  • bigquery
  • [✔] snowflake
  • other (specify: ____________)

The output of dbt --version:

installed version: 0.19.2
   latest version: 0.20.0

Your version of dbt is out of date! You can find instructions for upgrading here:
https://docs.getdbt.com/docs/installation

Plugins:
  - bigquery: 0.19.2
  - snowflake: 0.19.2
  - redshift: 0.19.2
  - postgres: 0.19.2

The operating system you're using:
Mac OSX

The output of python --version:
Python 3.9.6

Additional context

Add any other context about the problem here.

@karthikeyan-sivabaskaran karthikeyan-sivabaskaran added bug Something isn't working triage labels Jul 17, 2021
@jtcohen6 jtcohen6 removed the triage label Jul 17, 2021
@jtcohen6
Copy link
Contributor

@karthikeyan-sivabaskaran Thanks for opening the issue, and for including the simple reproduction case. I found the issue: These tests are winding up in the disabled dict in manifest.json. Why? In dbt v0.19.x (and older versions), tests look to the models block for their project-level configs. So even as the models they're disabling are targeted for re-enabling, the tests are still observing the blanket ban.

Here's the good news: v0.20.0 actually fixes this bug. Tests now get their own project-level configs (#3253), using a test: key, and should no longer be caught as side effects of models configs. (This is also why I wasn't able to reproduce this bug, when initially reported in Slack the other day.)

I'm going to close this issue, since it's resolved by upgrading to the latest version of dbt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants