dbt-labs / dbt-core

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
https://getdbt.com
Apache License 2.0
9.68k stars 1.61k forks source link

All `unit_test` configs in `dbt_project.yaml` are incorrectly identified as being `unused` #10311

Closed QMalcolm closed 3 months ago

QMalcolm commented 3 months ago

Is this a new bug in dbt-core?

Current Behavior

Currently, if you specify and config for unit tests in dbt_project.yaml you get a warning for them as being unused even if they are. Notably, they will still be used, but a warning is produced that they are not. An example can be seen here https://github.com/dbt-labs/jaffle-shop/pull/46

(venv) quigleymalcolm@Quigley-Malcolm jaffle-shop % dbt parse                                                                 
22:56:16  Running with dbt=1.8.2
22:56:16  Registered adapter: postgres=1.8.1
22:56:16  [WARNING]: Configuration paths exist in your dbt_project.yml file which do not apply to any resources.
There are 3 unused configuration paths:
- seeds.jaffle_shop
- unit_tests.jaffle_shop
- unit_tests.jaffle_shop.marts.order_items.test_supply_costs_sum_correctly
22:56:16  Performance info: /Users/quigleymalcolm/Developer/dbt-labs/jaffle-shop/target/perf_info.json

Expected Behavior

A warning should not be produced for used unit_test config paths

(venv) quigleymalcolm@Quigley-Malcolm jaffle-shop % dbt parse                                                                 
22:56:16  Running with dbt=1.8.2
22:56:16  Registered adapter: postgres=1.8.1
22:56:16  [WARNING]: Configuration paths exist in your dbt_project.yml file which do not apply to any resources.
There are 1 unused configuration paths:
- seeds.jaffle_shop
22:56:16  Performance info: /Users/quigleymalcolm/Developer/dbt-labs/jaffle-shop/target/perf_info.json

Steps To Reproduce

  1. Pull down my jaffle-shop branch qmalcolm--demo-broken-unused-config-warning-for-unit-tests
  2. Run dbt parse
  3. Observer the output

Relevant log output

No response

Environment

- OS: macOS 14.2
- Python: 3.10.14
- dbt: 1.8.2

Which database adapter are you using with dbt?

dbt-postgres

Additional Context

No response