-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add DEFAULT_ENV_VARS and test_path arg
- Loading branch information
1 parent
6361429
commit 6bca5dc
Showing
1 changed file
with
12 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,12 @@ | |
PG_PORT = 5432 | ||
load_dotenv(find_dotenv("test.env")) | ||
DEFAULT_ENV_VARS = { | ||
"DBT_TEST_USER_1": "[email protected]", | ||
"DBT_TEST_USER_2":"[email protected]", | ||
"DBT_TEST_USER_3": "[email protected]", | ||
"DBT_TEST_USER_1": os.getenv("DBT_TEST_USER_1", "[email protected]"), | ||
"DBT_TEST_USER_2": os.getenv("DBT_TEST_USER_2","[email protected]"), | ||
"DBT_TEST_USER_3": os.getenv("DBT_TEST_USER_3", "[email protected]"), | ||
} | ||
|
||
|
||
def env_variables(envs: dict[str, str]): | ||
def env_variables_inner(ctr: dagger.Container): | ||
for key, value in envs.items(): | ||
|
@@ -25,7 +26,6 @@ def env_variables_inner(ctr: dagger.Container): | |
|
||
|
||
def get_databricks_env_vars(): | ||
|
||
return { | ||
"DBT_DATABRICKS_TOKEN": os.environ["DBT_DATABRICKS_TOKEN"], | ||
"DBT_DATABRICKS_HOST_NAME": os.environ["DBT_DATABRICKS_HOST_NAME"], | ||
|
@@ -123,25 +123,22 @@ async def test_spark(test_args): | |
if "databricks" in test_profile: | ||
tst_container = tst_container.with_(env_variables(get_databricks_env_vars())) | ||
tst_container = tst_container.with_(env_variables(DEFAULT_ENV_VARS)) | ||
test_path = test_args.test_path if test_args.test_path else "tests/functional/adapter" | ||
result = await tst_container.with_exec( | ||
[ | ||
"python", | ||
"-m", | ||
"pytest", | ||
"-v", | ||
"--profile", | ||
test_args.profile, | ||
"-n", | ||
"auto", | ||
"tests/functional/", | ||
] | ||
["python", "-m", "pytest", | ||
"-v", | ||
"--profile", test_args.profile, | ||
"-n", "auto", | ||
test_path, | ||
] | ||
).stdout() | ||
|
||
return result | ||
|
||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--profile", required=True, type=str) | ||
parser.add_argument("--test-path", required=False, type=str) | ||
args = parser.parse_args() | ||
|
||
anyio.run(test_spark, args) |