diff --git a/core/dbt/parser/manifest.py b/core/dbt/parser/manifest.py index 6743bf5e6e7..a57e1fe6f5c 100644 --- a/core/dbt/parser/manifest.py +++ b/core/dbt/parser/manifest.py @@ -662,9 +662,10 @@ def check_for_microbatch_deprecations(self) -> None: has_microbatch_model = True break - if has_microbatch_model and self.manifest._microbatch_macro_is_core( + if has_microbatch_model and not self.manifest._microbatch_macro_is_core( self.root_project.project_name ): + breakpoint() dbt.deprecations.warn("microbatch-macro-outside-of-batches-deprecation") def load_and_parse_macros(self, project_parser_files): diff --git a/tests/functional/microbatch/test_microbatch.py b/tests/functional/microbatch/test_microbatch.py index b98ad38caa9..ee1b5ccd762 100644 --- a/tests/functional/microbatch/test_microbatch.py +++ b/tests/functional/microbatch/test_microbatch.py @@ -182,19 +182,16 @@ def test_use_custom_microbatch_strategy_by_default( project, deprecation_catcher: EventCatcher, ): - with mock.patch.object( - type(project.adapter), "valid_incremental_strategies", lambda _: [] - ): - # Initial run - run_dbt(["run"]) + # Initial run fires deprecation + run_dbt(["run"], callbacks=[deprecation_catcher.catch]) + # Deprecation warning about custom microbatch macro fired + assert len(deprecation_catcher.caught_events) == 1 - # Incremental run uses custom strategy - _, logs = run_dbt_and_capture(["run"]) - assert "custom microbatch strategy" in logs - # The custom strategy wasn't used with batch functionality - assert "START batch" not in logs - # Deprecation warning about custom microbatch macro fired - assert len(deprecation_catcher.caught_events) == 0 + # Incremental run uses custom strategy + _, logs = run_dbt_and_capture(["run"]) + assert "custom microbatch strategy" in logs + # The custom strategy wasn't used with batch functionality + assert "START batch" not in logs class TestMicrobatchCustomUserStrategyProjectFlagTrueValid(BaseMicrobatchCustomUserStrategy): @@ -208,7 +205,9 @@ def test_use_custom_microbatch_strategy_project_flag_true_invalid_incremental_st ): # Initial run with patch_microbatch_end_time("2020-01-03 13:57:00"): - run_dbt(["run"]) + run_dbt(["run"], callbacks=[deprecation_catcher.catch]) + # Deprecation warning about custom microbatch macro not fired + assert len(deprecation_catcher.caught_events) == 0 # Incremental run uses custom strategy with patch_microbatch_end_time("2020-01-03 13:57:00"): @@ -216,10 +215,9 @@ def test_use_custom_microbatch_strategy_project_flag_true_invalid_incremental_st assert "custom microbatch strategy" in logs # The custom strategy was used with batch functionality assert "START batch" in logs - # Deprecation warning about custom microbatch macro not fired - assert len(deprecation_catcher.caught_events) == 0 +# TODO: fix this test once adapter behaviour flag gating is fixed class TestMicrobatchCustomUserStrategyProjectFlagTrueInvalid(BaseMicrobatchCustomUserStrategy): def test_use_custom_microbatch_strategy_project_flag_true_invalid_incremental_strategy( self, project