Stop downstream model creation when dbt test fails

I’m using dbt Cloud and two folders: foundation and dwh. I imported Snowflake table as a source in dbt. Then i created:

In foundation folder:

  • model on top of that source (data clean up)
  • snapshot which records the state of source table on every run
  • test which compares source table and snapshot and fails if number of records changes

In dwh folder:

  • target (downstream) model - this model should not be created if test fails

The issue is that, when my test fails, downstream model is still created. Any idea how to change this?

Is the source for models in dwh folder are being referred or sourced?
Looks like models in dwh are being sourced

Note: @Vishwas originally posted this reply in Slack. It might not have transferred perfectly.