-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement initial adapter tests on bigquery #142
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[pytest] | ||
filterwarnings = | ||
ignore:.*'soft_unicode' has been renamed to 'soft_str'*:DeprecationWarning | ||
ignore:unclosed file .*:ResourceWarning | ||
env_files = | ||
test.env | ||
testpaths = | ||
tests/unit | ||
tests/integration | ||
tests/functional |
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,22 @@ | ||
import pytest | ||
import os | ||
import json | ||
|
||
# Import the fuctional fixtures as a plugin | ||
# Note: fixtures with session scope need to be local | ||
|
||
pytest_plugins = ["dbt.tests.fixtures.project"] | ||
|
||
# The profile dictionary, used to write out profiles.yml | ||
@pytest.fixture(scope="class") | ||
def dbt_profile_target(): | ||
credentials_json_str = os.getenv('BIGQUERY_TEST_SERVICE_ACCOUNT_JSON').replace("'", '') | ||
credentials = json.loads(credentials_json_str) | ||
project_id = credentials.get('project_id') | ||
return { | ||
'type': 'bigquery', | ||
'method': 'service-account-json', | ||
'threads': 1, | ||
'project': project_id, | ||
'keyfile_json': credentials, | ||
} |
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,52 @@ | ||
import pytest | ||
|
||
from dbt.tests.adapter.basic.test_base import BaseSimpleMaterializations | ||
from dbt.tests.adapter.basic.test_singular_tests import BaseSingularTests | ||
from dbt.tests.adapter.basic.test_singular_tests_ephemeral import ( | ||
BaseSingularTestsEphemeral, | ||
) | ||
from dbt.tests.adapter.basic.test_empty import BaseEmpty | ||
from dbt.tests.adapter.basic.test_ephemeral import BaseEphemeral | ||
from dbt.tests.adapter.basic.test_incremental import BaseIncremental | ||
from dbt.tests.adapter.basic.test_generic_tests import BaseGenericTests | ||
from dbt.tests.adapter.basic.test_snapshot_check_cols import BaseSnapshotCheckCols | ||
from dbt.tests.adapter.basic.test_snapshot_timestamp import BaseSnapshotTimestamp | ||
|
||
|
||
class TestSimpleMaterializationsBigQuery(BaseSimpleMaterializations): | ||
# This test requires a full-refresh to replace a table with a view | ||
@pytest.fixture(scope="class") | ||
def test_config(self): | ||
return {"require_full_refresh": True} | ||
|
||
|
||
class TestSingularTestsBigQuery(BaseSingularTests): | ||
pass | ||
|
||
|
||
class TestSingularTestsEphemeralBigQuery(BaseSingularTestsEphemeral): | ||
pass | ||
|
||
|
||
class TestEmptyBigQuery(BaseEmpty): | ||
pass | ||
|
||
|
||
class TestEphemeralBigQuery(BaseEphemeral): | ||
pass | ||
|
||
|
||
class TestIncrementalBigQuery(BaseIncremental): | ||
pass | ||
|
||
|
||
class TestGenericTestsBigQuery(BaseGenericTests): | ||
pass | ||
|
||
|
||
class TestSnapshotCheckColsBigQuery(BaseSnapshotCheckCols): | ||
pass | ||
|
||
|
||
class TestSnapshotTimestampBigQuery(BaseSnapshotTimestamp): | ||
pass |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we consider add this kind of logic to the dbt-core tests later on so that we don't need to do it anywhere in bigquery?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test_config sets a flag which does initiate different behavior in the dbt-core tests. I think we don't want to always do a full refresh in the adapter tests, because then we wouldn't ever be testing behavior without the full refresh, which ought to work for the other adapters.