Skip to content

Commit

Permalink
add cluster start fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-rogers-dbt committed Jan 24, 2024
1 parent 6edcdcf commit eeba17f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/functional/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from multiprocessing import Lock

import pytest

_db_start_lock = Lock()
_DB_CLUSTER_STARTED = False


@pytest.fixture(scope="class", autouse=True)
def start_databricks_cluster(project, request):
global _DB_CLUSTER_STARTED
profile_type = request.config.getoption("--profile")
with _db_start_lock:
if "databricks" in profile_type and not _DB_CLUSTER_STARTED:
print("Starting Databricks cluster")
project.run_sql("SELECT 1")

_DB_CLUSTER_STARTED = True

0 comments on commit eeba17f

Please sign in to comment.