TechFabricTechFabric
Testing on Databricks

What to test, per artifact

Coverage matrix for Databricks artifact types. What matters, at which tier, and which tool asserts it.

Use this matrix to decide what a healthy suite covers for each Databricks artifact type. Tiers refer to the test pyramid.

SQL / warehouse queries

  • Correctness of logic (joins, window functions, attribution CTEs): local DuckDB tier with committed fixtures. Fast enough to run on every save.
  • Engine parity: the same statement on DuckDB and Photon must return identical rows. Run a parity suite with golden results. Catches dialect divergence (QUALIFY, timestamp zones, null ordering) before production.
  • Performance smoke (live, optional): statement completes within a budget on a serverless warehouse.

Delta tables

  • Schema contracts: column names, types, nullability against a committed contract file. Local against DuckDB-created tables; live against information_schema.
  • Data quality: row counts, uniqueness, null rates, freshness. Express these as BDD Then steps or SQL predicates.
  • Constraint / partition layout (live): DESCRIBE DETAIL assertions.

DLT / Lakeflow pipelines

  • End-to-end (live, @dlt): upload fixture files to the ingest location, start a pipeline update, poll to a terminal state, assert the target table contents.
  • Rescue-data drift: assert _rescued_data is empty after the run, a non-empty rescue column means the ingestion contract drifted.
  • Expectations: pipeline expectations (data-quality rules) pass; failed expectation counts are zero.

Jobs and notebooks

  • Run-to-terminal (live, @jobs): run-now an existing job or runs/submit a notebook, wait with a timeout, assert SUCCESS and inspect task output.
  • Task logic: extract pure logic out of notebooks into packages and unit test it locally. The notebook itself should be a thin shell.

Unity Catalog / governance

  • Grant assertions (live): a scoped service principal CAN read allowed tables and CANNOT read denied ones (expect PERMISSION_DENIED). Least privilege is a test, not a hope.
  • Object existence: catalogs, schemas, volumes referenced by config exist.

Lakebase Postgres

  • Credential lifecycle (live, @lakebase): OAuth → credential exchange succeeds, short-lived credentials refresh, connection pool survives the swap.
  • Migrations: apply idempotently against a scratch branch.

dbt models

  • dbt build with tests against a scratch schema (live): sources must match the tables the ingestion pipeline actually creates.
  • Source contract: a boundary test asserting dbt _sources.yml table names equal the names emitted by the ingestion code, so the two can never drift.

Statistical / experimentation workloads

  • Golden vectors: freeze expected aggregate/stat outputs for committed fixtures; every engine and every refactor must reproduce them exactly, the same policy used by Fabric's cross-SDK assignment conformance vectors.
  • Guardrails: SRM χ² and metric-decline checks fire on skewed fixtures and stay silent on balanced ones.

On this page