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

[CT-3570] [Bug] tests -> data_tests rename misses model-level tests + tests defined on model versions #9411

Closed
2 tasks done
jtcohen6 opened this issue Jan 19, 2024 · 0 comments · Fixed by #9412
Closed
2 tasks done
Assignees
Labels
bug Something isn't working pre-regression Regression not yet in a stable release

Comments

@jtcohen6
Copy link
Contributor

jtcohen6 commented Jan 19, 2024

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

In #9201 we renamed testsdata_tests, with validation/renaming to offer backwards compatibility for the tens of thousands of projects who have defined generic data tests as tests.

The validation/renaming logic works for generic data tests defined on columns of models, but it's missing:

  • model-level tests
  • tests defined on versions of a versioned model (model-level + column-level)

Expected Behavior

All of the generic data tests are parsed successfully, as they are in dbt-core v1.7

Steps To Reproduce

-- macros/my_cool_tests.sql
{% test my_cool_model_test(model) %}
  select * from {{ model }}
  limit 0
{% endtest %}

{% test my_cool_column_test(model, column_name) %}
  select {{ column_name }} from {{ model }}
  limit 0
{% endtest %}
-- models/my_model_v1.sql
select 1 as id
-- models/my_model_v2.sql
select 1 as id, 'blue' as new_in_v2
models:
  - name: my_model
    tests:
      - my_cool_model_test
    columns:
      - name: id
        tests:
          - my_cool_column_test
    versions:
      - v: 1
      - v: 2
        tests:
          - name: my_cool_versioned_model_test
            test_name: my_cool_model_test
            # this is the same test as above, just with a different name
            # for versioned models, there isn't any way to inherit/extend the tests on the 'base' model config
        columns:
          - name: new_in_v2
            description: "A column that I added in my_model_v2"
            tests:
              - name: my_cool_versioned_column_test
                test_name: my_cool_column_test

Relevant log output

No response

Environment

- OS: macOS 13.4.1
- Python: 3.10.11
- dbt: main

Which database adapter are you using with dbt?

No response

Additional Context

No response

@jtcohen6 jtcohen6 added bug Something isn't working pre-regression Regression not yet in a stable release labels Jan 19, 2024
@github-actions github-actions bot changed the title [Bug] tests -> data_tests rename misses model-level tests + tests defined on model versions [CT-3570] [Bug] tests -> data_tests rename misses model-level tests + tests defined on model versions Jan 19, 2024
@jtcohen6 jtcohen6 self-assigned this Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pre-regression Regression not yet in a stable release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant