-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix integ test for GitHub actions * Separated database in test_docs.py * Separated database in test_snapshot.py * Run integ tests for a database with random name * Removed unneeded test * Moving unique_schema, profiles_config_update, and cleanup to conftest.py * More refactor * No need to update proifile_config. Remove * Now that we are using different schema for each class, need to cleanup after the test * Update test_docs.py and test_snapshot.py as well * Create separate conftest.py for integration tests * Use helper method as possible --------- Co-authored-by: Akira Ajisaka <[email protected]>
- Loading branch information
1 parent
879f41a
commit bbbc05a
Showing
8 changed files
with
53 additions
and
109 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
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
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
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 |
---|---|---|
|
@@ -14,7 +14,6 @@ flake8 | |
pytz | ||
tox>=3.2.0 | ||
ipdb | ||
pytest-xdist | ||
pytest-dotenv | ||
pytest-csv | ||
flaky | ||
|
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
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
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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import pytest | ||
import os | ||
import random | ||
import string | ||
from tests.util import get_s3_location, get_region, cleanup_s3_location | ||
|
||
s3bucket = get_s3_location() | ||
region = get_region() | ||
|
||
# Import the standard functional fixtures as a plugin | ||
# Note: fixtures with session scope need to be local | ||
pytest_plugins = ["dbt.tests.fixtures.project"] | ||
|
||
# Use different datatabase for each test class | ||
@pytest.fixture(scope="class") | ||
def unique_schema(request, prefix) -> str: | ||
database_suffix = ''.join(random.choices(string.digits, k=4)) | ||
return f"dbt_functional_test_{database_suffix}" | ||
|
||
|
||
# The profile dictionary, used to write out profiles.yml | ||
# dbt will supply a unique schema per test, so we do not specify 'schema' here | ||
@pytest.fixture(scope="class") | ||
def dbt_profile_target(unique_schema): | ||
return { | ||
'type': 'glue', | ||
'query-comment': 'test-glue-adapter', | ||
'role_arn': os.getenv('DBT_GLUE_ROLE_ARN'), | ||
'user': os.getenv('DBT_GLUE_ROLE_ARN'), | ||
'region': get_region(), | ||
'workers': 2, | ||
'worker_type': 'G.1X', | ||
'schema': unique_schema, | ||
'database': unique_schema, | ||
'session_provisioning_timeout_in_seconds': 300, | ||
'location': get_s3_location(), | ||
'datalake_formats': 'delta', | ||
'conf': "spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension --conf spark.sql.catalog.spark_catalog=org.apache.spark.sql.delta.catalog.DeltaCatalog --conf spark.sql.legacy.allowNonEmptyLocationInCTAS=true", | ||
'glue_session_reuse': True | ||
} | ||
|
||
|
||
@pytest.fixture(scope='class', autouse=True) | ||
def cleanup(unique_schema): | ||
cleanup_s3_location(s3bucket + unique_schema, region) | ||
yield | ||
cleanup_s3_location(s3bucket + unique_schema, region) |