[CT-3323] Allow singular tests to be documented
Description
Currently, you can document pretty much everything but a data test - if you try, it fails on a parsing error. This ticket is for singular tests. A separate ticket (#2578) addresses generic tests.
Currently we don't have a "tests" section in schema files. In order to allow setting descriptions in yaml files we should add one. (As a side issue, the SingularTestNodes use the TestConfig, which is not particularly valid for SingularTestNodes. Maybe we need a separate SingularTestConfig.)
https://docs.getdbt.com/docs/build/tests#singular-tests
Acceptance Criteria
- You can add a description to a singular test in a yaml file
- You can use a docs block to capture your test description
- That description shows up in the docs site
Considerations
- Do we need to exclude this from state modified?
- New section in schema files and new schema parser
- Don't have a test schema parser
- Need yml to be able to have a description
Since singular tests aren't explicitly linked to models in schema.yml files already, we would need to introduce a new top-level 'tests' resource in order to parse descriptions:
# top-level
tests:
- name: my_super_cool_singular_test
description: The order_id is unique for every row in the orders model
config:
error_if: ">10"
- name: my_super_cool_singular_test2
description: '{{ doc("not_null_test") }}'
cc @graciegoheen @jtcohen6
Yep - this feels similar to how we handle descriptions for seeds or macros! Only adjustment I would say is data_tests: instead of tests: (since we're introducing unit tests in 1.8):
# top-level
data_tests:
- name: my_super_cool_singular_test
description: The order_id is unique for every row in the orders model
config:
error_if: ">10"
- name: my_super_cool_singular_test2
description: '{{ doc("not_null_test") }}'
Opened a new issue in dbt-labs/docs.getdbt.com: https://github.com/dbt-labs/docs.getdbt.com/issues/6132