Skip to content

test: make remaining incremental functional tests rerun-safe - #1512

Merged
sd-db merged 2 commits into
databricks:mainfrom
moomindani:test/rerun-safe-functional-tests
Jun 15, 2026
Merged

test: make remaining incremental functional tests rerun-safe#1512
sd-db merged 2 commits into
databricks:mainfrom
moomindani:test/rerun-safe-functional-tests

Conversation

@moomindani

Copy link
Copy Markdown
Contributor

Description

Follow-up to #1503 (incremental constraint tests) and #1499 (column-tag tests): applies the same RerunSafeMixin treatment to the remaining incremental functional tests that mutate on-disk state mid-test.

These tests rewrite schema.yml (or model.sql) via write_file and build relations during the test body. Under pytest --reruns 2 (used in CI integration runs), a transient failure leaves the retry running against the mutated files and the half-built relation from the failed attempt, so the retry fails deterministically and the rerun budget is wasted.

Covered files:

  • test_incremental_tags.py (SQL + Python)
  • test_incremental_column_tags.py (SQL + Python)
  • test_incremental_tblproperties.py (SQL + Python)
  • test_incremental_clustering.py (SQL + Python)
  • test_incremental_column_masks.py (incl. DescribeJsonOn subclass via inheritance)
  • test_incremental_persist_docs.py (incl. V2 subclass via inheritance)
  • test_incremental_replace_table.py

Test-only change, no runtime impact.

Verified against a UC SQL warehouse and a UC all-purpose cluster: 11 passed. The two column_tags tests could not run in my workspace because a Unity Catalog tag policy there restricts allowed values for the pii tag key (the fixtures use pii: "false"); the unmodified tests fail identically on that workspace, so this is environmental and unrelated to the change. They are covered by the CI integration environment.

Checklist

  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-databricks next" section.

Apply RerunSafeMixin to the incremental functional tests that rewrite
schema.yml or model files mid-test (tags, column tags, tblproperties,
liquid clustering, column masks, persist_docs, replace table), so a
pytest --reruns retry no longer inherits mutated files and half-built
relations from the failed attempt. Follows the pattern established for
the incremental constraint tests and column-tag tests.

Co-authored-by: Isaac
@github-actions

Copy link
Copy Markdown

Coverage report

This PR does not seem to contain any modification to coverable code.

@sd-db

sd-db commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

/integration-test

@github-actions

Copy link
Copy Markdown

Integration tests dispatched for PR #1512 by @sd-db. Track progress in the Actions tab.

@sd-db sd-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Changes look good, thanks for the PR ! Started the integration test run, will merge once all green !!

@github-actions

Copy link
Copy Markdown

Integration results for PR #1512 — UC cluster ✅ success · SQL warehouse ✅ success · All-purpose cluster ✅ success · Shard coverage ✅ success

Run details.

@sd-db
sd-db merged commit 73c1320 into databricks:main Jun 15, 2026
sd-db added a commit that referenced this pull request Jun 17, 2026
…le change (#1522)

## What

Adds functional coverage asserting that an **updateable-component**
change to a materialized view — `databricks_tags` or the refresh
`schedule` — is applied via an **in-place `ALTER`** and does **not**
rebuild the MV. This is the `requires_full_refresh=False` branch of
`MaterializedViewConfig.get_changeset` (`updateable_component_keys =
["refresh", "tags", "row_filter"]`).

## Why

The existing suite proves this branch only via debug-log substrings
(`assert_message_in_logs("Applying ALTER" / "Applying REPLACE")`), which
is not server-observable, and the unit test
(`test_get_changeset__some_changes`) pins only the
`requires_full_refresh=True` case. So "an updateable change does not
rebuild the MV" had no server-side coverage.

## How it's proven

Source-row staleness: a row is inserted into the source **after** the MV
is materialized. The test confirms the row landed in the source (`count
== 3`) yet the MV stays at `2` across each change — an in-place `ALTER`
neither recomputes the query nor issues a `REFRESH`, whereas a `CREATE
OR REPLACE` (the misclassification this guards against) would pull the
new row in.

One class walks a single MV through a tags change, then a
refresh-schedule change. To keep the staleness assertion sound, the MV
starts `MANUAL` (no schedule) and the refresh step moves it to `EVERY 4
WEEKS`, so the server never auto-refreshes it during the run.

## Testing

`pytest
tests/functional/adapter/materialized_view_tests/test_mv_alter_no_rebuild.py`
→ **1 passed** (profile `databricks_uc_sql_endpoint`). Section collects
cleanly; `ruff` / `ruff format` / `mypy` pass.

Test-only change — no changelog entry, consistent with #1511 / #1512 /
#1514.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants