How to Run Dagster CI Checks for Jobs and Assets
dagster definitions validate loads your code location and fails fast if any asset or job is misconfigured.
Run dagster definitions validate to load the Definitions object, then unit-test assets with materialize_to_memory under pytest.
Steps
- Install
dagsterand your integration libraries. - Run
dagster definitions validate -m your_moduleto load the code location. - Unit-test assets in memory with pytest.
Asset test
tests/test_assets.py
from dagster import materialize_to_memory
from my_project.assets import orders, daily_revenue
def test_daily_revenue():
result = materialize_to_memory([orders, daily_revenue])
assert result.success
value = result.output_for_node("daily_revenue")
assert value >= 0Workflow
.github/workflows/ci.yml
steps:
- uses: actions/checkout@v4
- run: pip install dagster dagster-duckdb pytest
- run: dagster definitions validate -m my_project.definitions
- run: pytest tests -qGotchas
materialize_to_memoryavoids touching a real warehouse, keeping asset tests fast.- Validate the exact module you deploy so import paths match production.