astronomer / astronomer-cosmos

Run your dbt Core projects as Apache Airflow DAGs and Task Groups with a few lines of code
https://astronomer.github.io/astronomer-cosmos/
Apache License 2.0
777 stars 171 forks source link

[Feature] Add functionality to only run tests #1279

Open luis-fnogueira opened 1 month ago

luis-fnogueira commented 1 month ago

Description

Hi y'all!

I'd like to periodically run only the dbt tests of my project using cosmos, using an approach similar to:


        render_config=RenderConfig(                               
            test_behavior=TestBehavior.ONLY_TESTS

Would that be possible for future releases? Or is already there a workaround to do that? I could not figure it out at the documentation.

Use case/motivation

I'd like to periodically have an alert on Slack about how my dbt tests are. Like a summary.

Related issues

No response

Are you willing to submit a PR?

tatiana commented 4 weeks ago

@luis-fnogueira This feels like a duplicate of https://github.com/astronomer/astronomer-cosmos/issues/1242 and potentially related to https://github.com/astronomer/astronomer-cosmos/issues/959.

Would it be an option to use the DbtTestLocalOperator (https://github.com/astronomer/astronomer-cosmos/blob/4c9b28f9db856d4677926230ad5324c8740dfe50/cosmos/operators/local.py#L720) or an equivalent directly to run tests only? Would this solve your use-case?

As illustrated in: https://github.com/astronomer/astronomer-cosmos/blob/4c9b28f9db856d4677926230ad5324c8740dfe50/tests/operators/test_local.py#L458-L465