|
62 | 62 |
|
63 | 63 | configuration.load_test_config()
|
64 | 64 |
|
| 65 | +logger = logging.getLogger(__name__) |
65 | 66 |
|
66 | 67 | try:
|
67 | 68 | from unittest import mock
|
@@ -200,30 +201,33 @@ def test_backfill_multi_dates(self):
|
200 | 201 | def test_backfill_examples(self):
|
201 | 202 | """
|
202 | 203 | Test backfilling example dags
|
203 |
| - """ |
204 | 204 |
|
205 |
| - # some DAGs really are just examples... but try to make them work! |
206 |
| - skip_dags = [ |
207 |
| - 'example_http_operator', |
208 |
| - 'example_twitter_dag', |
209 |
| - 'example_trigger_target_dag', |
210 |
| - 'example_trigger_controller_dag', # tested above |
211 |
| - 'test_utils', # sleeps forever |
212 |
| - 'example_kubernetes_executor', # requires kubernetes cluster |
213 |
| - 'example_kubernetes_operator' # requires kubernetes cluster |
214 |
| - ] |
| 205 | + Try to backfill some of the example dags. Be carefull, not all dags are suitable |
| 206 | + for doing this. For example, a dag that sleeps forever, or does not have a |
| 207 | + schedule won't work here since you simply can't backfill them. |
| 208 | + """ |
| 209 | + include_dags = { |
| 210 | + 'example_branch_operator', |
| 211 | + 'example_bash_operator', |
| 212 | + 'example_skip_dag', |
| 213 | + 'latest_only' |
| 214 | + } |
215 | 215 |
|
216 |
| - logger = logging.getLogger('BackfillJobTest.test_backfill_examples') |
217 | 216 | dags = [
|
218 | 217 | dag for dag in self.dagbag.dags.values()
|
219 |
| - if 'example_dags' in dag.full_filepath and dag.dag_id not in skip_dags |
| 218 | + if 'example_dags' in dag.full_filepath and dag.dag_id in include_dags |
220 | 219 | ]
|
221 | 220 |
|
222 | 221 | for dag in dags:
|
223 | 222 | dag.clear(
|
224 | 223 | start_date=DEFAULT_DATE,
|
225 | 224 | end_date=DEFAULT_DATE)
|
226 | 225 |
|
| 226 | + # Make sure that we have the dags that we want to test available |
| 227 | + # in the example_dags folder, if this assertion fails, one of the |
| 228 | + # dags in the include_dags array isn't available anymore |
| 229 | + self.assertEqual(len(include_dags), len(dags)) |
| 230 | + |
227 | 231 | for i, dag in enumerate(sorted(dags, key=lambda d: d.dag_id)):
|
228 | 232 | logger.info('*** Running example DAG #{}: {}'.format(i, dag.dag_id))
|
229 | 233 | job = BackfillJob(
|
|
0 commit comments