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

Test modifiers do not store unrendered configs #3576

Closed
jtcohen6 opened this issue Jul 15, 2021 · 2 comments
Closed

Test modifiers do not store unrendered configs #3576

jtcohen6 opened this issue Jul 15, 2021 · 2 comments
Labels
bug Something isn't working dbt tests Issues related to built-in dbt testing functionality stale Issues that have gone stale state Stateful selection (state:modified, defer)

Comments

@jtcohen6
Copy link
Contributor

Describe the bug

Similar to #2744, but for tests. We're not properly storing the un-rendered version of test configs supplied as modifiers, so any env-aware logic in them will trigger state:modified. We actually do have access to node.unrendered_config, we just need to pass the original values before they're rendered here:
https://github.com/dbt-labs/dbt/blob/f460d275baa4df8cf8713f27e198a3577d6ea71c/core/dbt/parser/schema_test_builders.py#L228-L233

This is true for both generic-generic tests, and built-in shortcut generic tests (unique + not_null).

Steps To Reproduce

version: 2
models:
  - name: my_model
    columns: 
      - name: id
        tests:
          - not_null:
              limit: "{{ ('50' if target.name == 'dev' else '500') | as_number }}"
          - accepted_values:
              values: [1]
              limit: "{{ ('50' if target.name == 'dev' else '500') | as_number }}"
$ dbt run --target prod
$ dbt test --target prod
$ mv target/manifest.json .state
$ dbt ls -s state:modified --state .state
my_project.schema_test.accepted_values_my_model_id__1
my_project.schema_test.not_null_my_model_id
@jtcohen6 jtcohen6 added bug Something isn't working state Stateful selection (state:modified, defer) dbt tests Issues related to built-in dbt testing functionality labels Jul 15, 2021
@jtcohen6 jtcohen6 mentioned this issue Jul 27, 2021
4 tasks
@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2022

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days.

@github-actions github-actions bot added the stale Issues that have gone stale label Jun 8, 2022
@github-actions
Copy link
Contributor

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest; add a comment to notify the maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dbt tests Issues related to built-in dbt testing functionality stale Issues that have gone stale state Stateful selection (state:modified, defer)
Projects
None yet
Development

No branches or pull requests

1 participant