You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/10/03 07:13:26 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #18575: Resync DAG during next parse if error in ``sync_to_db``

uranusjr commented on a change in pull request #18575:
URL: https://github.com/apache/airflow/pull/18575#discussion_r720782683



##########
File path: tests/models/test_dagbag.py
##########
@@ -801,6 +802,32 @@ def _sync_to_db():
             _sync_to_db()
             mock_sync_perm_for_dag.assert_called_once_with(dag, session=session)
 
+    def test_sync_to_db_dag_specific_perms_failure(self, caplog):
+        """
+        Test that errors during dagbag.sync_to_db, specifically syncing DAG specific permissions, are logged
+        and added to import_errors every parsing cycle
+        """
+        with create_session() as session, NamedTemporaryFile(
+            dir=self.empty_dir, suffix=".py"
+        ) as f, freeze_time(tz.datetime(2020, 1, 5, 0, 0, 0)) as frozen_time:
+            f.write(b'from airflow import DAG\n')
+            f.write(b'd = DAG(dag_id="access_control_test", access_control={"FakeRole": {"can_read"}})')
+            f.flush()
+
+            for i in [0, 60]:

Review comment:
       ```suggestion
               for i in range(60):
   ```




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org