Skip to content

Commit

Permalink
add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Beck committed Mar 26, 2019
1 parent a2db88c commit 9373a45
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/integration/042_sources_test/models/ephemeral_model.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{ config(materialized='ephemeral') }}

select 1 as id
30 changes: 30 additions & 0 deletions test/integration/042_sources_test/test_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,13 @@ def start(self):
raise Exception('server never appeared!')


_select_from_ephemeral = '''with __dbt__CTE__ephemeral_model as (
select 1 as id
)select * from __dbt__CTE__ephemeral_model'''


@unittest.skipIf(os.name == 'nt', 'Windows not supported for now')
class TestRPCServer(BaseSourcesTest):
def setUp(self):
Expand Down Expand Up @@ -481,6 +488,17 @@ def test_compile(self):
compiled_sql='select 2 as id'
)

ephemeral = self.query(
'compile',
'select * from {{ ref("ephemeral_model") }}',
name='foo'
).json()
self.assertSuccessfulCompilationResult(
ephemeral,
'select * from {{ ref("ephemeral_model") }}',
compiled_sql=_select_from_ephemeral
)

@use_profile('postgres')
def test_run(self):
# seed + run dbt to make models before using them!
Expand Down Expand Up @@ -592,6 +610,18 @@ def test_run(self):
table={'column_names': ['id'], 'rows': [[1.0]]}
)

ephemeral = self.query(
'run',
'select * from {{ ref("ephemeral_model") }}',
name='foo'
).json()
self.assertSuccessfulRunResult(
ephemeral,
raw_sql='select * from {{ ref("ephemeral_model") }}',
compiled_sql=_select_from_ephemeral,
table={'column_names': ['id'], 'rows': [[1.0]]}
)

@use_profile('postgres')
def test_invalid_requests(self):
data = self.query(
Expand Down

0 comments on commit 9373a45

Please sign in to comment.