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

Namespace conflict for tests: Two tests gets the same name but only one is executed #2308

Closed
johansjob opened this issue Apr 9, 2020 · 2 comments
Labels
bug Something isn't working dbt tests Issues related to built-in dbt testing functionality
Milestone

Comments

@johansjob
Copy link

johansjob commented Apr 9, 2020

Describe the bug

Test are skipped if the test name is compiled to the same name.

Steps To Reproduce

Create two models:

  • base.sql with sql SELECT CAST(NULL AS STRING) AS extension_id
  • base_extension.sql SELECT 'NOT_NULL' AS id

Create a schema:

version: 2

models:
    - name: base
       columns:
           - name: extension_id
              tests:
                  - not_null
    - name: base_extension
       columns:
           - name: id
              tests:
                  - not_null

Run:
dbt run dbt test

Current behavior will skip the first test and hence succeed even though this particular scenario should fail.

Using dbt list --output json also only shows one of the tests named 'not_null_base_extension_id'. (I guess this shows why this problem rises in the first place).

Expected behavior

The exepected behaviour would probably be a compilation error or handle this namespace conflict in such a way so both tests are executed.

System information

Which database are you using dbt with?

  • [X ] bigquery
    But probably an error for both

The output of dbt --version:
0.16.0

The operating system you're using:
macOS Catalina Version 10.15.3

The output of python --version:
3.8.2

Additional context

Very much a corner case. Thought I report it anyway..

@johansjob johansjob added bug Something isn't working triage labels Apr 9, 2020
@drewbanin drewbanin removed the triage label Apr 10, 2020
@drewbanin
Copy link
Contributor

Gosh, that's not great, thanks for opening this issue @johansjob!

We have some further thoughts outlined in #1173 that will help us generate unique ids / names for tests in a much more sane/sensible way! This is definitely a corner case, but it's one worth fixing for sure.

Thanks for digging in here!

@jtcohen6 jtcohen6 added this to the Oh-Twenty [TBD] milestone Nov 13, 2020
@jtcohen6 jtcohen6 added the dbt tests Issues related to built-in dbt testing functionality label Dec 31, 2020
@jtcohen6
Copy link
Contributor

Closing in favor of #3254

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
Projects
None yet
Development

No branches or pull requests

3 participants