Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[storage tests] runless events #16520

Merged
merged 1 commit into from
Sep 18, 2023
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
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
Comment on lines +3988 to +3990
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could consider including a runless one and a runful one for the same key (is that a thing?) and verify that both are included

assert mats[key].asset_materialization.metadata["was"].value == "here"