Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions tests/airflow/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,42 @@ def test_create_task_metadata_normalize_task_id(
assert "task_display_name" not in metadata.arguments


@pytest.mark.integration
def test_build_airflow_graph_with_build_and_buildable_indirect_selection():
with DAG("test-build-buildable", start_date=datetime(2022, 1, 1)) as dag:
task_args = {
"project_dir": SAMPLE_PROJ_PATH,
"conn_id": "fake_conn",
"profile_config": ProfileConfig(
profile_name="default",
target_name="default",
profile_mapping=PostgresUserPasswordProfileMapping(
conn_id="fake_conn",
profile_args={"schema": "public"},
),
),
}
render_config = RenderConfig(
test_behavior=TestBehavior.BUILD,
)
build_airflow_graph(
nodes=sample_nodes,
dag=dag,
execution_mode=ExecutionMode.LOCAL,
test_indirect_selection=TestIndirectSelection.BUILDABLE,
task_args=task_args,
dbt_project_name="astro_shop",
render_config=render_config,
)

topological_sort = [task.task_id for task in dag.topological_sort()]
expected_sort = ["seed_parent_seed_build", "parent_model_build", "child_model_build", "child2_v2_model_build"]
assert topological_sort == expected_sort

for task in dag.tasks:
if hasattr(task, 'indirect_selection'):
assert task.indirect_selection == TestIndirectSelection.BUILDABLE.value

@pytest.mark.parametrize(
"node_type,node_unique_id,test_indirect_selection,additional_arguments",
[
Expand Down