Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
ChangedJobTestCase,
)
from tests.integration.src.sqlbuild.compiler.compiled_project.publication.helpers import (
ORDER_SKEW_SECONDS,
changed_job_files,
duckdb_rows,
request_job_run,
scheduled_worker,
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}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sqlite3
import subprocess
import sys
import time
from contextlib import closing
from pathlib import Path
from textwrap import dedent
Expand All @@ -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,
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
)
Expand Down
Loading