-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Bug] Unit test names aren't required to be unique, and duplicates get swallowed #10271
Comments
Update: I just made a similar mistake but spanning across two files, and did get the expected error message.
Is it possibly the case that this only happens when both duplicate tests live in the same file, or when attached to the same model? |
Thanks for raising this issue @joellabes 🤩 I think this is just the way that our YAML parser works -- any key that is duplicated within the same file just clobbers any earlier instance. For example, try this out:
select 1 as id
models:
- name: my_model
config:
enabled: false
- name: my_model
config:
enabled: true dbt list Then flip the While an unfortunate and unwelcome surprise to not to be warned (or err'd) when there is a dupe within a file, I don't think this is a bug, and I'm going to close as "not planned" accordingly. But if you or anyone else feels very strongly about this, just let me know and we can reconsider as a feature request. |
Is this a new bug in dbt-core?
Current Behavior
I am making some unit tests and copy-pasted without updating the name
The second and third tests both have the same name,
ensure_all_pks_in_columns_pks_at_end
.When I ran
dbt test -s unit_ensure_all_pks_are_in_column_set
(the name of the model I'm testing), the output wasFrom the attached logs, it seems that the first copy of the test is run and the second one is totally ignored.
dbt.log
Expected Behavior
The standard error you get when a node has a nonunuique name:
Steps To Reproduce
Create tests using sample code above
Relevant log output
Environment
Which database adapter are you using with dbt?
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: