Skip to content
Latchkey

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 dagster and your integration libraries.
  • Run dagster definitions validate -m your_module to 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 >= 0

Workflow

.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 -q

Gotchas

  • materialize_to_memory avoids touching a real warehouse, keeping asset tests fast.
  • Validate the exact module you deploy so import paths match production.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →