Skip to content
Open
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 @@ -2,7 +2,6 @@
from unittest import mock

import pytest
import time_machine
from pathlib import Path
from sqlglot import exp
from sqlglot.optimizer.qualify_columns import quote_identifiers
Expand Down Expand Up @@ -474,7 +473,6 @@ def test_plan_correlation_id_in_job_labels(ctx: TestContext):
assert labels == {correlation_id.job_type.value.lower(): correlation_id.job_id}


@time_machine.travel("2023-01-08 15:00:00 UTC")
def test_run_correlation_id_in_job_labels(ctx: TestContext):
run_id = "test_run_id"
model_name = ctx.table("run_test")
Expand All @@ -497,7 +495,7 @@ def test_run_correlation_id_in_job_labels(ctx: TestContext):
)
)
)
sqlmesh.plan(auto_apply=True, no_prompts=True)
sqlmesh.plan(auto_apply=True, no_prompts=True, execution_time="2023-01-08 15:00:00")

captured_evaluators: t.List = []
original_scheduler = sqlmesh.scheduler
Expand All @@ -510,12 +508,9 @@ def scheduler_wrapper(
captured_evaluators.append(snapshot_evaluator)
return original_scheduler(environment=environment, snapshot_evaluator=snapshot_evaluator)

with time_machine.travel("2023-01-09 00:00:00 UTC"):
with mock.patch(
"sqlmesh.core.context.analytics.collector.on_run_start", return_value=run_id
):
with mock.patch.object(sqlmesh, "scheduler", scheduler_wrapper):
sqlmesh.run()
with mock.patch("sqlmesh.core.context.analytics.collector.on_run_start", return_value=run_id):
with mock.patch.object(sqlmesh, "scheduler", scheduler_wrapper):
sqlmesh.run(execution_time="2023-01-09 00:00:00")

assert captured_evaluators
adapter = t.cast(BigQueryEngineAdapter, captured_evaluators[-1].adapter)
Expand Down
Loading