Skip to content

Commit

Permalink
[storage tests] runless events (#16520)
Browse files Browse the repository at this point in the history
update storage tests to ensure runless asset events work across storages

related to #16424

## How I Tested These Changes
  • Loading branch information
alangenfeld authored Sep 18, 2023
1 parent be7ff20 commit 3b59f9b
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
ExternalRepositoryOrigin,
InProcessCodeLocationOrigin,
)
from dagster._core.instance import RUNLESS_JOB_NAME, RUNLESS_RUN_ID
from dagster._core.storage.asset_check_execution_record import (
AssetCheckExecutionRecordStatus,
)
Expand Down Expand Up @@ -3965,3 +3966,26 @@ def test_asset_checks(self, storage):
AssetKey(["my_asset"]), "my_check", limit=10, materialization_event_storage_id=42
)
assert len(checks) == 1

def test_external_asset_event(self, storage):
key = AssetKey("test_asset")
log_entry = EventLogEntry(
error_info=None,
user_message="",
level="debug",
run_id=RUNLESS_RUN_ID,
timestamp=time.time(),
dagster_event=DagsterEvent(
event_type_value=DagsterEventType.ASSET_MATERIALIZATION.value,
job_name=RUNLESS_JOB_NAME,
event_specific_data=StepMaterializationData(
materialization=AssetMaterialization(asset_key=key, metadata={"was": "here"})
),
),
)

storage.store_event(log_entry)

mats = storage.get_latest_materialization_events([key])
assert mats
assert mats[key].asset_materialization.metadata["was"].value == "here"

0 comments on commit 3b59f9b

Please sign in to comment.