Skip to content

Commit

Permalink
Fix failing test in DagCode (#9565)
Browse files Browse the repository at this point in the history
PR apache/airflow#9554 introduced this error and because of Github issue currently (github is down / has degraded performance) the CI didn't run fully

(cherry picked from commit ee0335315e421c8ce9e826f7ac5e8f4c82f171fe)

GitOrigin-RevId: a0e275348d5bd97d2fef05c984d415049bc5c826
  • Loading branch information
kaxil authored and Cloud Composer Team committed Jun 4, 2021
1 parent 7876369 commit 2ac1b12
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/models/test_dagcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def _write_two_example_dags(self):
return [bash_dag, xcom_dag]

@conf_vars({('core', 'store_dag_code'): 'True'})
@patch("airflow.models.dag.settings.STORE_DAG_CODE", True)
def _write_example_dags(self):
example_dags = make_example_dags(example_dags_module)
for dag in example_dags.values():
Expand All @@ -68,6 +69,7 @@ def test_sync_to_db(self):

self._compare_example_dags(example_dags)

@conf_vars({('core', 'store_dag_code'): 'True'})
def test_bulk_sync_to_db(self):
"""Dg code can be bulk written into database."""
example_dags = make_example_dags(example_dags_module)
Expand All @@ -78,6 +80,7 @@ def test_bulk_sync_to_db(self):

self._compare_example_dags(example_dags)

@conf_vars({('core', 'store_dag_code'): 'True'})
def test_bulk_sync_to_db_half_files(self):
"""Dg code can be bulk written into database."""
example_dags = make_example_dags(example_dags_module)
Expand Down Expand Up @@ -119,6 +122,8 @@ def _compare_example_dags(self, example_dags):
self.assertEqual(result.source_code, source_code)

@conf_vars({('core', 'store_dag_code'): 'True'})
@patch("airflow.models.dag.settings.STORE_DAG_CODE", True)
@patch("airflow.models.dagcode.STORE_DAG_CODE", True)
def test_code_can_be_read_when_no_access_to_file(self):
"""
Test that code can be retrieved from DB when you do not have access to Code file.
Expand All @@ -140,6 +145,7 @@ def test_code_can_be_read_when_no_access_to_file(self):
self.assertIn(test_string, dag_code)

@conf_vars({('core', 'store_dag_code'): 'True'})
@patch("airflow.models.dag.settings.STORE_DAG_CODE", True)
def test_db_code_updated_on_dag_file_change(self):
"""Test if DagCode is updated in DB when DAG file is changed"""
example_dag = make_example_dags(example_dags_module).get('example_bash_operator')
Expand Down

0 comments on commit 2ac1b12

Please sign in to comment.