kaxil commented on a change in pull request #10282:
URL: https://github.com/apache/airflow/pull/10282#discussion_r468916917
##########
File path: tests/models/test_dagbag.py
##########
@@ -700,3 +704,34 @@ def test_get_dag_with_dag_serialization(self):
self.assertCountEqual(updated_ser_dag_1.tags, ["example", "new_tag"])
self.assertGreater(updated_ser_dag_1_update_time,
ser_dag_1_update_time)
+
+ @patch("airflow.settings.policy", cluster_policies.cluster_policy)
+ def test_cluster_policy_violation(self):
+ """test that file processing results in import error when task does not
+ obey cluster policy.
+ """
+ dag_file = os.path.join(TEST_DAGS_FOLDER, "test_missing_owner.py")
+
+ dagbag = DagBag(dag_folder=dag_file)
+ self.assertEqual(set(), set(dagbag.dag_ids))
+ expected_import_errors = {
+ dag_file: (
+ f'''Task must have non-None non-default owner.'''
+ ''' Current value: {task.owner}'''
+ )
Review comment:
```suggestion
dag_file: (
'Task must have non-None non-default owner.'
f' Current value: {task.owner}'
)
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]