Skip to content

Commit

Permalink
revert some changes to minimize the PR diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Dec 18, 2024
1 parent f7f6863 commit d51e52c
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions dagger/run_dbt_spark_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ async def test_spark(test_args):

# setup directories as we don't want to copy the whole repo into the container
req_files = client.host().directory(
"./", include=["*.env", "hatch.toml", "pyproject.toml", "./dbt", "./tests"]
"./", include=["test.env", "hatch.toml", "pyproject.toml"]
)
dbt_spark_dir = client.host().directory("./dbt")
test_dir = client.host().directory("./tests")
scripts = client.host().directory("./dagger/scripts")

platform = dagger.Platform("linux/amd64")
Expand All @@ -110,6 +112,22 @@ async def test_spark(test_args):
.with_exec(["./scripts/install_os_reqs.sh"])
# install dbt-spark + python deps
.with_directory("/src", req_files)
.with_exec(["pip", "install", "-U", "pip", "hatch"])
)

# install local dbt-spark changes
tst_container = (
tst_container.with_workdir("/")
.with_directory("src/dbt", dbt_spark_dir)
.with_workdir("/src")
.with_exec(["hatch", "shell"])
)

# install local test changes
tst_container = (
tst_container.with_workdir("/")
.with_directory("src/tests", test_dir)
.with_workdir("/src")
.with_workdir("/src")
)

Expand All @@ -125,12 +143,13 @@ async def test_spark(test_args):
)

elif test_profile == "spark_session":
tst_container = tst_container.with_exec(["pip", "install", "pyspark"])
tst_container = tst_container.with_exec(["apt-get", "install", "openjdk-17-jre", "-y"])

tst_container = tst_container.with_(env_variables(TESTING_ENV_VARS))
test_path = test_args.test_path if test_args.test_path else "tests/functional/adapter"
result = await tst_container.with_exec(
["hatch", "run", "pytest", "-v", "--profile", test_profile, "-n", "auto", test_path]
["hatch", "run", "pytest", "--profile", test_profile, test_path]
).stdout()

return result
Expand Down

0 comments on commit d51e52c

Please sign in to comment.