ephraimbuddy commented on code in PR #68518:
URL: https://github.com/apache/airflow/pull/68518#discussion_r3735375387
##########
airflow-core/tests/unit/dag_processing/test_manager.py:
##########
@@ -309,6 +343,54 @@ def
test_sync_bundles_does_not_deactivate_missing_when_filtered(self):
manager.sync_bundles()
mock_bundles_manager.return_value.sync_bundles_to_db.assert_called_once_with(deactivate_missing=False)
+ @pytest.mark.parametrize(
+ "safe_mode",
+ [
+ pytest.param(False, id="safe-mode-off-includes-keywordless"),
+ pytest.param(True, id="safe-mode-on-filters-keywordless"),
+ ],
+ )
+ def test_find_files_in_bundle_respects_dag_discovery_safe_mode(self,
tmp_path, safe_mode):
+ (tmp_path / "with_keywords.py").write_text("from airflow.sdk import
DAG\n")
+ (tmp_path / "no_keywords.py").write_text("from mycompany.pipelines
import flow\n")
+ bundle = MagicMock(spec=BaseDagBundle)
+ bundle.name = "testing"
+ bundle.path = tmp_path
+
+ manager = DagFileProcessorManager(max_runs=1,
dag_discovery_safe_mode=safe_mode)
+
+ expected = {Path("with_keywords.py")}
+ if not safe_mode:
+ expected.add(Path("no_keywords.py"))
+ assert set(manager._find_files_in_bundle(bundle)) == expected
+
+ @pytest.mark.parametrize(
+ "safe_mode",
+ [
+ pytest.param(False, id="safe-mode-off-includes-keywordless"),
+ pytest.param(True, id="safe-mode-on-filters-keywordless"),
+ ],
+ )
+ def test_get_observed_filelocs_respects_dag_discovery_safe_mode(self,
tmp_path, safe_mode):
Review Comment:
Can you use `conf_vars` to exercise the real config change
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]