From 9373a45870d4fa4d9593a0b51e1d803ef66d37d2 Mon Sep 17 00:00:00 2001 From: Jacob Beck Date: Mon, 25 Mar 2019 13:53:11 -0600 Subject: [PATCH] add integration test --- .../models/ephemeral_model.sql | 3 ++ .../042_sources_test/test_sources.py | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 test/integration/042_sources_test/models/ephemeral_model.sql diff --git a/test/integration/042_sources_test/models/ephemeral_model.sql b/test/integration/042_sources_test/models/ephemeral_model.sql new file mode 100644 index 00000000000..8de35cd3e21 --- /dev/null +++ b/test/integration/042_sources_test/models/ephemeral_model.sql @@ -0,0 +1,3 @@ +{{ config(materialized='ephemeral') }} + +select 1 as id diff --git a/test/integration/042_sources_test/test_sources.py b/test/integration/042_sources_test/test_sources.py index f03bbefa182..3edf4641d7c 100644 --- a/test/integration/042_sources_test/test_sources.py +++ b/test/integration/042_sources_test/test_sources.py @@ -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): @@ -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! @@ -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(