diff --git a/python_modules/dagster/dagster_tests/daemon_tests/test_backfill.py b/python_modules/dagster/dagster_tests/daemon_tests/test_backfill.py index 0bcb908e53daf..e291a8dfa1c22 100644 --- a/python_modules/dagster/dagster_tests/daemon_tests/test_backfill.py +++ b/python_modules/dagster/dagster_tests/daemon_tests/test_backfill.py @@ -570,6 +570,49 @@ def test_canceled_backfill( assert instance.get_runs_count() == 1 +def test_delete_backfill( + instance: DagsterInstance, + workspace_context: WorkspaceProcessContext, + remote_repo: RemoteRepository, +): + partition_set = remote_repo.get_partition_set("the_job_partition_set") + instance.add_backfill( + PartitionBackfill( + backfill_id="simple", + partition_set_origin=partition_set.get_remote_origin(), + status=BulkActionStatus.REQUESTED, + partition_names=["one", "two", "three"], + from_failure=False, + reexecution_steps=None, + tags=None, + backfill_timestamp=get_current_timestamp(), + ) + ) + assert instance.get_runs_count() == 0 + + next( + iter( + execute_backfill_iteration( + workspace_context, get_default_daemon_logger("BackfillDaemon") + ) + ) + ) + assert instance.get_runs_count() == 1 + backfill = instance.get_backfills()[0] + assert backfill.status == BulkActionStatus.REQUESTED + instance.update_backfill(backfill.with_status(BulkActionStatus.DELETING)) + list( + iter( + execute_backfill_iteration( + workspace_context, get_default_daemon_logger("BackfillDaemon") + ) + ) + ) + backfill = instance.get_backfill(backfill.backfill_id) + assert backfill is None + assert instance.get_runs_count() == 0 + + def test_failure_backfill( instance: DagsterInstance, workspace_context: WorkspaceProcessContext,