Skip to content

Commit da5a5e3

Browse files
committed
Refactor test fixtures DAGs to have tasks and taskgroups as list
1 parent 060261a commit da5a5e3

11 files changed

Lines changed: 43 additions & 47 deletions

tests/fixtures/dag_factory.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ example_dag:
1919
doc_md: '##here is a doc md string'
2020
schedule_interval: 0 3 * * *
2121
tasks:
22-
task_1:
22+
- task_id: "task_1"
2323
bash_command: echo 1
2424
operator: airflow.operators.bash.BashOperator
25-
task_2:
25+
- task_id: "task_2"
2626
bash_command: echo 2
2727
dependencies:
2828
- task_1
2929
operator: airflow.operators.bash.BashOperator
30-
task_3:
30+
- task_id: "task_3"
3131
bash_command: echo 3
3232
dependencies:
3333
- task_1
@@ -36,15 +36,15 @@ example_dag2:
3636
doc_md_file_path: $PWD/tests/fixtures/mydocfile.md
3737
schedule_interval: None
3838
tasks:
39-
task_1:
39+
- task_id: "task_1"
4040
bash_command: echo 1
4141
operator: airflow.operators.bash.BashOperator
42-
task_2:
42+
- task_id: "task_2"
4343
bash_command: echo 2
4444
dependencies:
4545
- task_1
4646
operator: airflow.operators.bash.BashOperator
47-
task_3:
47+
- task_id: "task_3"
4848
bash_command: echo 3
4949
dependencies:
5050
- task_1
@@ -56,14 +56,14 @@ example_dag3:
5656
doc_md_python_callable_file: $PWD/tests/fixtures/doc_md_builder.py
5757
doc_md_python_callable_name: mydocmdbuilder
5858
tasks:
59-
task_1:
59+
- task_id: "task_1"
6060
bash_command: echo 1
6161
operator: airflow.operators.bash.BashOperator
6262
example_dag4:
6363
vars:
6464
arg1: &arg1 'hello'
6565
arg2: &arg2 !join [*arg1, ' world']
6666
tasks:
67-
task_1:
67+
- task_id: "task_1"
6868
bash_command: !join ['echo ', *arg2]
6969
operator: airflow.operators.bash.BashOperator

tests/fixtures/dag_factory_http_operator_task.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ http_operator_example_dag:
1111
tags: ['http']
1212
render_template_as_native_obj: True
1313
tasks:
14-
send_request_json:
14+
- task_id: "send_request_json"
1515
operator: airflow.providers.http.operators.http.HttpOperator
1616
http_conn_id: "example_host"
1717
method: "POST"
1818
endpoint: "/run_test"
19-
data:
19+
data:
2020
data: "fake_data"
2121
format: "json"
2222
headers:
2323
Content-Type: application/json
2424
log_response: True
25-
send_request_plain_text:
25+
- task_id: "send_request_plain_text"
2626
operator: airflow.providers.http.operators.http.HttpOperator
2727
http_conn_id: "example_host"
2828
method: "POST"
2929
endpoint: "/run_test"
30-
data:
30+
data:
3131
data: "fake_data"
3232
test: "plain_text"
3333
headers:

tests/fixtures/dag_factory_kubernetes_pod_operator.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ default:
1313
schedule_interval: '0 1 * * *'
1414
example_dag:
1515
tasks:
16-
task_1:
16+
- task_id: "task_1"
1717
operator: airflow.providers.cncf.kubernetes.operators.pod.KubernetesPodOperator
1818
namespace: 'default'
1919
config_file : 'path_to_config_file'
@@ -50,11 +50,10 @@ example_dag:
5050
]
5151
labels: {'foo': 'bar'}
5252
name: 'passing-test'
53-
task_id: 'passing-task'
5453
get_logs: True
5554
in_cluster: False
5655
dependencies: []
57-
task_2:
56+
- task_id: "task_2"
5857
operator: airflow.providers.cncf.kubernetes.operators.pod.KubernetesPodOperator
5958
namespace: 'default'
6059
config_file : 'path_to_config_file'
@@ -67,7 +66,6 @@ example_dag:
6766
]
6867
labels: {'foo': 'bar'}
6968
name: 'passing-test'
70-
task_id: 'passing-task'
7169
get_logs: True
7270
in_cluster: False
7371
dependencies: ['task_1']

tests/fixtures/dag_factory_kubernetes_pod_operator_lt_2_7.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ default:
1313
schedule_interval: '0 1 * * *'
1414
example_dag:
1515
tasks:
16-
task_1:
16+
- task_id: "task_1"
1717
operator: airflow.providers.cncf.kubernetes.operators.kubernetes_pod.KubernetesPodOperator
1818
namespace: 'default'
1919
config_file : 'path_to_config_file'
@@ -50,11 +50,10 @@ example_dag:
5050
]
5151
labels: {'foo': 'bar'}
5252
name: 'passing-test'
53-
task_id: 'passing-task'
5453
get_logs: True
5554
in_cluster: False
5655
dependencies: []
57-
task_2:
56+
- task_id: "task_2"
5857
operator: airflow.providers.cncf.kubernetes.operators.kubernetes_pod.KubernetesPodOperator
5958
namespace: 'default'
6059
config_file : 'path_to_config_file'
@@ -67,7 +66,6 @@ example_dag:
6766
]
6867
labels: {'foo': 'bar'}
6968
name: 'passing-test'
70-
task_id: 'passing-task'
7169
get_logs: True
7270
in_cluster: False
7371
dependencies: ['task_1']

tests/fixtures/dag_factory_no_or_none_string_schedule.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ example_dag_no_schedule:
55
description: this is an example dag
66
doc_md: '##here is a doc md string'
77
tasks:
8-
task_1:
8+
- task_id: "task_1"
99
bash_command: echo 1
1010
operator: airflow.operators.bash.BashOperator
11-
task_2:
11+
- task_id: "task_2"
1212
bash_command: echo 2
1313
dependencies:
1414
- task_1
1515
operator: airflow.operators.bash.BashOperator
16-
task_3:
16+
- task_id: "task_3"
1717
bash_command: echo 3
1818
dependencies:
1919
- task_1
@@ -28,15 +28,15 @@ example_dag_none_string_schedule:
2828
description: this is an example dag
2929
doc_md: '##here is a doc md string'
3030
tasks:
31-
task_1:
31+
- task_id: "task_1"
3232
bash_command: echo 1
3333
operator: airflow.operators.bash.BashOperator
34-
task_2:
34+
- task_id: "task_2"
3535
bash_command: echo 2
3636
dependencies:
3737
- task_1
3838
operator: airflow.operators.bash.BashOperator
39-
task_3:
39+
- task_id: "task_3"
4040
bash_command: echo 3
4141
dependencies:
4242
- task_1

tests/fixtures/dag_factory_simple_http_operator_task.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ simple_http_operator_example_dag:
1111
tags: ['http']
1212
render_template_as_native_obj: True
1313
tasks:
14-
send_request_json:
14+
- task_id: "send_request_json"
1515
operator: airflow.operators.http_operator.SimpleHttpOperator
1616
http_conn_id: "example_host"
1717
method: "POST"
1818
endpoint: "/run_test"
19-
data:
19+
data:
2020
data: "fake_data"
2121
format: "json"
2222
headers:
2323
Content-Type: application/json
2424
log_response: True
25-
send_request_plain_text:
25+
- task_id: "send_request_plain_text"
2626
operator: airflow.operators.http_operator.SimpleHttpOperator
2727
http_conn_id: "example_host"
2828
method: "POST"
2929
endpoint: "/run_test"
30-
data:
30+
data:
3131
data: "fake_data"
3232
test: "plain_text"
3333
headers:

tests/fixtures/dag_factory_task_group.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ default:
1212
example_dag:
1313
description: "this dag uses task groups"
1414
task_groups:
15-
task_group_1:
15+
- group_name: "task_group_1"
1616
tooltip: "this is a task group"
1717
dependencies: [task_1]
1818
tasks:
19-
task_1:
19+
- task_id: "task_1"
2020
operator: airflow.operators.bash.BashOperator
2121
bash_command: "echo 1"
22-
task_2:
22+
- task_id: "task_2"
2323
operator: airflow.operators.bash.BashOperator
2424
bash_command: "echo 2"
2525
task_group_name: task_group_1
26-
task_3:
26+
- task_id: "task_3"
2727
operator: airflow.operators.python.PythonOperator
2828
python_callable_name: print_hello
2929
python_callable_file: examples/print_hello.py
3030
task_group_name: task_group_1
3131
dependencies: [task_2]
32-
task_4:
32+
- task_id: "task_4"
3333
operator: airflow.operators.bash.BashOperator
3434
bash_command: "echo 1"
3535
dependencies: [task_group_1]

tests/fixtures/dag_factory_variables_as_arguments.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ example_dag:
1919
description: 'this is an example dag'
2020
schedule_interval: '0 3 * * *'
2121
tasks:
22-
task_1:
22+
- task_id: "task_1"
2323
operator: airflow.operators.bash.BashOperator
2424
bash_command: 'echo 1'
25-
task_2:
25+
- task_id: "task_2"
2626
operator: airflow.operators.bash.BashOperator
2727
bash_command: 'echo 2'
2828
dependencies: [task_1]
29-
task_3:
29+
- task_id: "task_3"
3030
operator: airflow.operators.bash.BashOperator
3131
bash_command: 'echo 3'
3232
dependencies: [task_1]
@@ -41,6 +41,6 @@ second_example_dag:
4141
description: 'this is a second example dag'
4242
schedule_interval: '0 6 * * *'
4343
tasks:
44-
task_0:
44+
- task_id: "task_0"
4545
operator: airflow.operators.bash.BashOperator
4646
bash_command: 'echo 1'

tests/fixtures/dag_md_docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ default:
1515
example_dag2:
1616
schedule_interval: None
1717
tasks:
18-
task_1:
18+
- task_id: "task_1"
1919
bash_command: echo 1
2020
operator: airflow.operators.bash.BashOperator
21-
task_2:
21+
- task_id: "task_2"
2222
bash_command: echo 2
2323
dependencies:
2424
- task_1
2525
operator: airflow.operators.bash.BashOperator
26-
task_3:
26+
- task_id: "task_3"
2727
bash_command: echo 3
2828
dependencies:
2929
- task_1

tests/fixtures/invalid_dag_factory.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ example_dag:
1111
description: 'this is an example dag'
1212
schedule_interval: '0 3 * * *'
1313
tasks:
14-
task_1:
14+
- task_id: "task_1"
1515
operator: airflow.operators.bash.BashOperator
1616
bash_command: 'echo 1'
17-
task_2:
17+
- task_id: "task_2"
1818
operator: airflow.operators.bash.BashOperator
1919
bash_command: 'echo 2'
2020
dependencies: [task_1]
21-
task_3:
21+
- task_id: "task_3"
2222
operator: airflow.operators.bash.BashOperator
2323
bash_command: 'echo 3'
2424
dependencies: [task_1]

0 commit comments

Comments
 (0)