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

Unit Tests run on dbt docs and dbt compile #56

Closed
SOVALINUX opened this issue Apr 18, 2022 · 5 comments
Closed

Unit Tests run on dbt docs and dbt compile #56

SOVALINUX opened this issue Apr 18, 2022 · 5 comments

Comments

@SOVALINUX
Copy link
Contributor

SOVALINUX commented Apr 18, 2022

Hi

Currently once I run dbt compile or dbt docs command it take me significantly longer due to unit-tests execution
I can workaround it with dbt compile --exclude tag:unit-test but it's not something I'd like to type every time
I looked in the implementation and looks like today it's impossible to fix it in dbt-unit-testing package with current dbt-core version (1.0.4)

What I was thinking about: adding another variable to Jinja context at dbt-core like command so we can simply skip running queries in case of command differs from test
Raising the issue here to hear your thoughts on it, since most likely you're facing the same issue - thanks in advance!
Note: I'm running unit tests with overwritten dbt_unit_testing ref and source macroses

P.S. Very cool unit-testing framework! Already using it and improving!

@cdiniz
Copy link
Collaborator

cdiniz commented Apr 26, 2022

Hi @SOVALINUX.

Thank you for your feedback, we really appreciate.
We possibly don't suffer from it because we usually have our DBT commands in a makefile or a shell script, then we don't have to type the exclusion every time which is not practical as you mentioned. Although it's a fair observation, during next week I'll take a look to see if we can improve it.

Thank you

@SOVALINUX
Copy link
Contributor Author

@cdiniz great, thanks. So far I've took a look on the flags and what's inside the context.
This issue also bothers me less now, since most of operations were moved to CI pipelines
It's related with the dbt-labs/dbt-core#4785
Also I have made several improvements of the framework, hope will find the time next week to make pull requests
It's still working cool - thanks!

@cdiniz
Copy link
Collaborator

cdiniz commented May 2, 2022

Hi @SOVALINUX

Thanks for your input.
I didn't find a better/pleasant way than delegating to the dbt commands itself as you mentioned:

dbt compile --exclude tag:unit-test or dbt compile --exclude tests/unit

Delegating to the commands gives us the chance to choose when we want to compile or not the tests.

Do you think we can close the issue and have this trade-off?

@SOVALINUX
Copy link
Contributor Author

Hi @cdiniz
I believe for now we should close it, since dbt-core doesn't give any known ways to resolve it properly :)
One day we may open new similar issue once we are able to do it. Closing it.

@SOVALINUX
Copy link
Contributor Author

Hi @cdiniz
You won't believe: dbt-core was "hiding" such a feature under tricky name :)
Take a look: dbt-labs/dbt-core#5251
I already migrated unit_testing to mine version of "flags.WHICH", but it would be easy to adjust to dbt-core version - will do a PR in a week or so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants