-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
migrate 034 integration test to functional #6054
Merged
Merged
Changes from all commits
Commits
Show all changes
4 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
8 changes: 0 additions & 8 deletions
8
test/integration/034_changing_relation_type_tests/models/model.sql
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
test/integration/034_changing_relation_type_tests/test_changing_relation_type.py
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
tests/adapter/dbt/tests/adapter/relations/test_changing_relation_type.py
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,44 @@ | ||
|
||
|
||
from typing import List, Optional | ||
import pytest | ||
|
||
from dbt.tests.util import run_dbt | ||
|
||
|
||
_DEFAULT_CHANGE_RELATION_TYPE_MODEL = """ | ||
{{ config(materialized=var('materialized')) }} | ||
|
||
select '{{ var("materialized") }}' as materialization | ||
|
||
{% if var('materialized') == 'incremental' and is_incremental() %} | ||
where 'abc' != (select max(materialization) from {{ this }}) | ||
{% endif %} | ||
""" | ||
|
||
|
||
class BaseChangeRelationTypeValidator: | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"model_mc_modelface.sql": _DEFAULT_CHANGE_RELATION_TYPE_MODEL | ||
} | ||
|
||
def _run_and_check_materialization(self, materialization, extra_args: Optional[List] = None): | ||
run_args = ["run", '--vars', f'materialized: {materialization}'] | ||
if extra_args: | ||
run_args.extend(extra_args) | ||
results = run_dbt(run_args) | ||
assert results[0].node.config.materialized == materialization | ||
assert len(results) == 1 | ||
|
||
def test_changing_materialization_changes_relation_type(self, project): | ||
self._run_and_check_materialization('view') | ||
self._run_and_check_materialization('table') | ||
self._run_and_check_materialization('view') | ||
self._run_and_check_materialization('incremental') | ||
self._run_and_check_materialization('table', extra_args=['--full-refresh']) | ||
|
||
|
||
class TestChangeRelationTypes(BaseChangeRelationTypeValidator): | ||
pass |
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.
fun model name