Skip to content

Commit d3981f1

Browse files
committed
test: move E2E expectations from the task kind to assets
The end-to-end shards still asserted task labels, kind ordering and decorators that no longer exist. They now assert the same behavior against @asset nodes.
1 parent 708b5b2 commit d3981f1

21 files changed

Lines changed: 56 additions & 56 deletions

‎tests/e2e/src/sqlbuild/cli/commands/main/bigquery/test_bigquery.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ def test_given_bigquery_dbt_profile_when_running_dbt_init_then_builds_profile_li
148148
BigQueryNodeResultE2ETestCase(
149149
description="direct node results persist and read on bigquery",
150150
expected_rows=(
151-
("check", "check_produce_result", "success"),
152151
("asset", "produce_result", "success"),
152+
("check", "check_produce_result", "success"),
153153
),
154154
)
155155
],

‎tests/e2e/src/sqlbuild/cli/commands/main/build/helpers.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,10 +867,10 @@ def _counting_python_node(*, decorator: str, name: str, ref: str, returned: str)
867867

868868

869869
def python_node_selection_project_files(*, orders_sql: str) -> dict[str, str]:
870-
"""Return a DuckDB project whose tasks and assets count managed, unmanaged, and model rows."""
870+
"""Return a DuckDB project whose assets count managed, unmanaged, and model rows."""
871871

872872
task_nodes: str = "".join(
873-
_counting_python_node(decorator="task", name=name, ref=ref, returned="None")
873+
_counting_python_node(decorator="asset", name=name, ref=ref, returned="None")
874874
for name, ref in (
875875
("count_customers", 'source("raw_customers")'),
876876
("count_raw_orders", 'source("raw_orders")'),

‎tests/e2e/src/sqlbuild/cli/commands/main/build/no_tests_no_audits/test_build_no_tests_no_audits.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def test_given_task_selector_when_running_run_then_task_executes(
443443
)
444444

445445
assert result.returncode == test_case.expected_exit_code, result.stdout + result.stderr
446-
assert "python task prepare_orders" in result.stdout
446+
assert "python asset prepare_orders" in result.stdout
447447
assert "OK" in result.stdout
448448
assert (project_dir / "task_marker.txt").read_text(encoding="utf-8") == "ran"
449449

@@ -626,7 +626,7 @@ def test_given_failing_task_selector_when_running_run_then_command_fails(
626626

627627
assert result.returncode == test_case.expected_exit_code
628628
combined_output: str = result.stdout + result.stderr
629-
assert "python task fail_orders" in combined_output
629+
assert "python asset fail_orders" in combined_output
630630
assert "FAIL" in combined_output
631631
assert "\u2717 Completed with errors" in combined_output
632632
assert "Python node failures:" in combined_output
@@ -713,7 +713,7 @@ def test_given_task_loader_source_model_chain_when_running_model_then_task_runs_
713713
)
714714

715715
assert result.returncode == test_case.expected_exit_code, result.stdout + result.stderr
716-
assert "python task prepare_orders" in result.stdout
716+
assert "python asset prepare_orders" in result.stdout
717717
execution_output: str = result.stdout[result.stdout.index("Execution sqb build") :]
718718
assert execution_output.index("prepare_orders") < execution_output.index("fact_orders")
719719
db_path: Path = project_dir / "python_loader_run_project.duckdb"
@@ -1388,7 +1388,7 @@ def test_given_sql_ready_task_fails_when_running_run_then_footer_json_and_exit_f
13881388

13891389
assert result.returncode == test_case.expected_exit_code
13901390
combined_output: str = result.stdout + result.stderr
1391-
assert "python task fail_after_stg_orders" in combined_output
1391+
assert "python asset fail_after_stg_orders" in combined_output
13921392
assert "FAIL" in combined_output
13931393
assert "Python node failures:" in combined_output
13941394
payload: dict[str, object] = json.loads(json_output_path.read_text(encoding="utf-8"))

‎tests/e2e/src/sqlbuild/cli/commands/main/build/test_build.py‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ def test_given_shared_downstream_failure_when_building_then_blocks_all_source_ap
704704
expected_exit_code=1,
705705
expected_output_fragments=(
706706
"Python ingress (1)",
707-
"python task prepare_orders",
707+
"python asset prepare_orders",
708708
"FAIL",
709709
"Python node failures:",
710710
),
@@ -751,7 +751,7 @@ def test_given_shared_downstream_failure_when_building_then_blocks_all_source_ap
751751
expected_exit_code=0,
752752
expected_output_fragments=(
753753
"Python ingress (1)",
754-
"python task prepare_orders",
754+
"python asset prepare_orders",
755755
"SKIP",
756756
"no input",
757757
),
@@ -838,7 +838,7 @@ def test_given_shared_downstream_failure_when_building_then_blocks_all_source_ap
838838
expected_exit_code=1,
839839
expected_output_fragments=(
840840
"fact_orders",
841-
"python task fail_after_fact",
841+
"python asset fail_after_fact",
842842
"FAIL",
843843
"Python node failures:",
844844
),
@@ -878,7 +878,7 @@ def test_given_shared_downstream_failure_when_building_then_blocks_all_source_ap
878878
expected_exit_code=0,
879879
expected_output_fragments=(
880880
"fact_orders",
881-
"python task skip_after_fact",
881+
"python asset skip_after_fact",
882882
"SKIP",
883883
"no profile needed",
884884
),
@@ -918,7 +918,7 @@ def test_given_shared_downstream_failure_when_building_then_blocks_all_source_ap
918918
expected_exit_code=0,
919919
expected_output_fragments=(
920920
"fact_orders",
921-
"python task soft_skip_after_fact",
921+
"python asset soft_skip_after_fact",
922922
"SKIP",
923923
"optional profile skipped",
924924
),
@@ -976,7 +976,7 @@ def test_given_shared_downstream_failure_when_building_then_blocks_all_source_ap
976976
},
977977
expected_exit_code=0,
978978
expected_output_fragments=(
979-
"python task prepare_orders",
979+
"python asset prepare_orders",
980980
"OK",
981981
),
982982
expected_present_tables=("raw_orders", "fact_orders"),
@@ -1024,7 +1024,7 @@ def test_given_shared_downstream_failure_when_building_then_blocks_all_source_ap
10241024
},
10251025
expected_exit_code=0,
10261026
expected_output_fragments=(
1027-
"python task profile_raw_orders",
1027+
"python asset profile_raw_orders",
10281028
"OK",
10291029
),
10301030
expected_present_tables=("raw_orders",),
@@ -1138,7 +1138,7 @@ def test_given_python_lifecycle_edge_case_when_building_then_direct_build_harden
11381138
),
11391139
},
11401140
expected_exit_code=0,
1141-
expected_output_fragments=("source raw_events", "unselected upstream task"),
1141+
expected_output_fragments=("source raw_events", "unselected upstream asset"),
11421142
expected_present_tables=("raw_events",),
11431143
expected_absent_paths=("prepared.txt",),
11441144
),
@@ -1331,11 +1331,11 @@ def test_given_python_asset_with_json_output_when_building_then_json_includes_py
13311331
expected_execution_fragments=(
13321332
"Python ingress (2)",
13331333
"Python read-side (3)",
1334-
"python task prepare_orders",
1334+
"python asset prepare_orders",
13351335
"python asset publish_prepared_orders",
1336-
"python task profile_fact_orders",
1336+
"python asset profile_fact_orders",
13371337
"python asset export_fact_orders",
1338-
"python task notify_fact_orders",
1338+
"python asset notify_fact_orders",
13391339
),
13401340
expected_table_names=("window_orders", "raw_orders", "fact_orders"),
13411341
expected_notify_text="7",

‎tests/e2e/src/sqlbuild/cli/commands/main/build/test_explicit_references.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def test_given_implicit_reference_when_running_command_then_it_fails_with_guidan
459459
enforce_explicit=True,
460460
expected_exit_code=0,
461461
expected_warning_fragments=(
462-
"[P008] task 'export_orders' named model:stg_customers as 'stg_customers'",
462+
"[P008] asset 'export_orders' named model:stg_customers as 'stg_customers'",
463463
),
464464
expected_final_line_prefix="\u2713 Completed with warnings",
465465
),

‎tests/e2e/src/sqlbuild/cli/commands/main/build/test_python_node_identity.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def orders(ctx):
237237
db_path=project_dir / "warehouse.duckdb",
238238
sql=(
239239
"SELECT COUNT(DISTINCT version_hash) FROM main._sqlbuild_fingerprints "
240-
"WHERE node_type = 'task' AND node_name = 'orders'"
240+
"WHERE node_type = 'asset' AND node_name = 'orders'"
241241
),
242242
) == [(test_case.expected_version_count,)]
243243

‎tests/e2e/src/sqlbuild/cli/commands/main/build/test_python_node_selection.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_given_python_node_selection_when_building_then_it_gates_only_on_schedul
209209
select="asset:report_order_count",
210210
upstream_select="asset:count_orders",
211211
expected_error=(
212-
"Upstream task 'count_orders' has no successful result to read. Build it first "
212+
"Upstream asset 'count_orders' has no successful result to read. Build it first "
213213
"with 'sqb build --select asset:count_orders', or build both with "
214214
"'sqb build --select +asset:report_order_count'."
215215
),

‎tests/e2e/src/sqlbuild/cli/commands/main/build/test_warehouse_round_trips.py‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
expected_exit_code=0,
4343
expected_output_order=(
4444
"table orders OK",
45-
"task score_orders OK",
45+
"asset score_orders OK",
4646
"source partner_scores OK",
4747
"table scored_orders OK",
4848
),
@@ -79,11 +79,11 @@ def test_given_a_warehouse_round_trip_when_building_then_the_loader_runs_between
7979
expected_exit_code=1,
8080
expected_output_order=(
8181
"table orders OK",
82-
"task score_orders FAIL",
82+
"asset score_orders FAIL",
8383
"source partner_scores SKIP",
8484
"table scored_orders SKIP",
8585
),
86-
expected_output_fragments=("hard skip: Upstream task 'score_orders' failed",),
86+
expected_output_fragments=("hard skip: Upstream asset 'score_orders' failed",),
8787
expected_scored_rows=None,
8888
expected_scored_table_exists=False,
8989
),
@@ -94,7 +94,7 @@ def test_given_a_warehouse_round_trip_when_building_then_the_loader_runs_between
9494
expected_exit_code=1,
9595
expected_output_order=(),
9696
expected_output_fragments=(
97-
"loader 'partner_scores' depends on task 'score_orders', which reads SQL",
97+
"loader 'partner_scores' depends on asset 'score_orders', which reads SQL",
9898
"set `allow_warehouse_round_trips = true` under [settings]",
9999
),
100100
expected_scored_rows=None,
@@ -125,7 +125,7 @@ def test_given_a_round_trip_that_cannot_complete_when_building_then_its_readers_
125125
"SELECT 1 AS order_id UNION ALL SELECT 2 UNION ALL SELECT 3\n"
126126
),
127127
expected_output_fragments=(
128-
"task score_orders OK",
128+
"asset score_orders OK",
129129
"source partner_scores OK",
130130
"table scored_orders OK",
131131
),
@@ -138,7 +138,7 @@ def test_given_a_round_trip_that_cannot_complete_when_building_then_its_readers_
138138
"SELECT 1 AS order_id UNION ALL SELECT 2 AS order_id\n"
139139
),
140140
expected_output_fragments=(
141-
"soft skip: Upstream task 'score_orders' did not run; the SQL it reads was not "
141+
"soft skip: Upstream asset 'score_orders' did not run; the SQL it reads was not "
142142
"rebuilt",
143143
"Completed successfully",
144144
),
@@ -151,8 +151,8 @@ def test_given_a_round_trip_that_cannot_complete_when_building_then_its_readers_
151151
"SELECT 1 AS order_id UNION ALL SELECT 2 UNION ALL SELECT 3\n"
152152
),
153153
expected_output_fragments=(
154-
"soft skip: Upstream task 'score_orders' did not run; --no-python skips "
155-
"read-side tasks and assets",
154+
"soft skip: Upstream asset 'score_orders' did not run; --no-python skips "
155+
"read-side assets",
156156
"Completed successfully",
157157
),
158158
expected_scored_rows=((1, 10), (2, 20)),
@@ -166,7 +166,7 @@ def test_given_a_round_trip_that_cannot_complete_when_building_then_its_readers_
166166
),
167167
extra_files=scoring_task_files(' return ctx.skip(reason="partner offline")\n'),
168168
expected_output_fragments=(
169-
"soft skip: Upstream task 'score_orders' was skipped",
169+
"soft skip: Upstream asset 'score_orders' was skipped",
170170
"table scored_orders OK",
171171
"Completed successfully",
172172
),
@@ -182,7 +182,7 @@ def test_given_a_round_trip_that_cannot_complete_when_building_then_its_readers_
182182
' return ctx.skip(reason="partner offline", mode="hard")\n'
183183
),
184184
expected_output_fragments=(
185-
"hard skip: Upstream task 'score_orders' was skipped",
185+
"hard skip: Upstream asset 'score_orders' was skipped",
186186
"table scored_orders SKIP",
187187
),
188188
expected_scored_rows=((1, 10), (2, 20)),
@@ -195,7 +195,7 @@ def test_given_a_round_trip_that_cannot_complete_when_building_then_its_readers_
195195
**ranking_task_files(' return ctx.result(payload={"ranked": True})\n'),
196196
},
197197
expected_output_fragments=(
198-
"task rank_orders OK",
198+
"asset rank_orders OK",
199199
"source partner_scores OK",
200200
"table scored_orders OK",
201201
),
@@ -210,7 +210,7 @@ def test_given_a_round_trip_that_cannot_complete_when_building_then_its_readers_
210210
},
211211
expected_output_fragments=(
212212
"partner_scores SKIP",
213-
"soft skip: Upstream task '",
213+
"soft skip: Upstream asset '",
214214
"table scored_orders OK",
215215
),
216216
expected_scored_rows=((1, 10), (2, 20)),
@@ -225,7 +225,7 @@ def test_given_a_round_trip_that_cannot_complete_when_building_then_its_readers_
225225
**ranking_task_files(' return ctx.result(payload={"ranked": True})\n'),
226226
},
227227
expected_output_fragments=(
228-
"hard skip: Upstream task 'score_orders' was skipped",
228+
"hard skip: Upstream asset 'score_orders' was skipped",
229229
"table scored_orders SKIP",
230230
),
231231
expected_scored_rows=((1, 10), (2, 20)),
@@ -241,7 +241,7 @@ def test_given_a_round_trip_that_cannot_complete_when_building_then_its_readers_
241241
},
242242
),
243243
expected_output_fragments=(
244-
"soft skip: Upstream task 'package_scores'",
244+
"soft skip: Upstream asset 'package_scores'",
245245
"table scored_orders OK",
246246
"Completed successfully",
247247
),
@@ -260,8 +260,8 @@ def test_given_a_round_trip_that_cannot_complete_when_building_then_its_readers_
260260
},
261261
),
262262
expected_output_fragments=(
263-
"soft skip: Upstream task 'score_orders' did not run; --no-python skips "
264-
"read-side tasks and assets",
263+
"soft skip: Upstream asset 'score_orders' did not run; --no-python skips "
264+
"read-side assets",
265265
"Completed successfully",
266266
),
267267
expected_scored_rows=((1, 10), (2, 20)),

‎tests/e2e/src/sqlbuild/cli/commands/main/compile/test_python_sql_graph_boundaries.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
expected_output_fragments=(
4141
"S000",
4242
"loader 'partner_scores' is in a dependency cycle: loader 'partner_scores' -> "
43-
"task 'score_orders' -> model 'scored_orders' -> source 'partner_scores' -> "
43+
"asset 'score_orders' -> model 'scored_orders' -> source 'partner_scores' -> "
4444
"loader 'partner_scores'",
4545
),
4646
),
@@ -63,7 +63,7 @@
6363
edited_files={},
6464
expected_exit_code=1,
6565
expected_output_fragments=(
66-
"loader 'partner_scores' depends on task 'score_orders', which reads SQL",
66+
"loader 'partner_scores' depends on asset 'score_orders', which reads SQL",
6767
"set `allow_warehouse_round_trips = true` under [settings]",
6868
),
6969
),

‎tests/e2e/src/sqlbuild/cli/commands/main/databricks/test_databricks.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ def test_given_databricks_dbt_profile_when_running_dbt_init_then_builds_profile_
142142
DatabricksNodeResultE2ETestCase(
143143
description="direct node results persist and read on databricks",
144144
expected_rows=(
145-
("check", "check_produce_result", "success"),
146145
("asset", "produce_result", "success"),
146+
("check", "check_produce_result", "success"),
147147
),
148148
)
149149
],

0 commit comments

Comments
 (0)