diff --git a/tests/integration/src/sqlbuild/compiler/compiled_project/publication/helpers.py b/tests/integration/src/sqlbuild/compiler/compiled_project/publication/helpers.py index a2ed27e6c1..69dd5117fc 100644 --- a/tests/integration/src/sqlbuild/compiler/compiled_project/publication/helpers.py +++ b/tests/integration/src/sqlbuild/compiler/compiled_project/publication/helpers.py @@ -1556,6 +1556,9 @@ def tagged_model(name: str, tags: str) -> str: ) +# `--changed` compares a relation with each of its executions this close to its newest, so a +# rebuild sooner than this after a build still reports that build's edits and inputs. +ORDER_SKEW_SECONDS: float = 5.2 CHANGED_FIXTURE: Path = Path("benchmarks/duckshop/edge_cases/changed_builds") CHANGED_JOB: str = ( 'name = "changed_orders_job"\n' diff --git a/tests/integration/src/sqlbuild/compiler/compiled_project/publication/test_changed.py b/tests/integration/src/sqlbuild/compiler/compiled_project/publication/test_changed.py index 10f655d911..cddcad4a5b 100644 --- a/tests/integration/src/sqlbuild/compiler/compiled_project/publication/test_changed.py +++ b/tests/integration/src/sqlbuild/compiler/compiled_project/publication/test_changed.py @@ -11,6 +11,7 @@ ChangedJobTestCase, ) from tests.integration.src.sqlbuild.compiler.compiled_project.publication.helpers import ( + ORDER_SKEW_SECONDS, changed_job_files, duckdb_rows, request_job_run, @@ -18,7 +19,6 @@ sqlite_rows, ) -ORDER_SKEW_SECONDS: float = 5.2 EXPECTED_CHANGED_RUNS: tuple[tuple[str, frozenset[str], dict[str, int]], ...] = ( ("first run", frozenset({"stg_orders", "stg_customers", "customer_orders"}), {"success": 3}), ("nothing changed", frozenset(), {"success": 3}), diff --git a/tests/integration/src/sqlbuild/compiler/compiled_project/publication/test_plan_preview.py b/tests/integration/src/sqlbuild/compiler/compiled_project/publication/test_plan_preview.py index 1b1718ca42..793533dc8a 100644 --- a/tests/integration/src/sqlbuild/compiler/compiled_project/publication/test_plan_preview.py +++ b/tests/integration/src/sqlbuild/compiler/compiled_project/publication/test_plan_preview.py @@ -5,6 +5,7 @@ import sqlite3 import subprocess import sys +import time from contextlib import closing from pathlib import Path from textwrap import dedent @@ -28,6 +29,7 @@ request_warehouse_sync, ) from tests.integration.src.sqlbuild.compiler.compiled_project.publication.helpers import ( + ORDER_SKEW_SECONDS, changed_build_and_plan_from_copy, changed_build_report, changed_runs, @@ -386,6 +388,7 @@ def test_given_a_served_location_when_syncs_complete_then_it_replans_only_after_ write_files(project_dir=project, files=_PROJECT_FILES) built: subprocess.CompletedProcess[str] = run_sqb(project, "build", "--target", "development") assert built.returncode == 0, built.stderr + built_at: float = time.monotonic() edited: str = _PROJECT_FILES["models/order_count.sql"].replace(*test_case.edit) write_files(project_dir=project, files={"models/order_count.sql": edited}) control: Path = tmp_path / "control/.sqlbuild/control.sqlite3" @@ -433,6 +436,7 @@ def changed_build() -> dict[str, list[str]]: _ = wait_for_location_work(api, request_plan(control, ["model:orders"]), location, log) assert log.read_text().count(_PLANNED) == 1, "a sync that applied nothing keeps the count" + time.sleep(max(0.0, built_at + ORDER_SKEW_SECONDS - time.monotonic())) rebuilt: subprocess.CompletedProcess[str] = run_sqb( project, "build", "--target", "development" )