Skip to content

Commit

Permalink
Fix cluster tests
Browse files Browse the repository at this point in the history
  • Loading branch information
henlue committed Aug 6, 2024
1 parent 4adc95b commit 275031a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
18 changes: 13 additions & 5 deletions tests/functional/adapter/dbt_clone/test_dbt_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,19 @@ def test_persist_docs(self, project, unique_schema, other_schema):
]

results = run_dbt(clone_args)

results = project.run_sql(
f"describe extended {project.database}.{other_schema}.table_model",
fetch="all",
)
for row in results:
if row[0] == "comment":
assert row[1] == "This is a table model"

results = project.run_sql(
f"select comment from {project.database}.information_schema.tables "
f"where table_schema = '{other_schema}' "
f"order by table_name",
f"describe extended {project.database}.{other_schema}.view_model",
fetch="all",
)
assert results[0][0] == "This is a table model"
assert results[1][0] == "This is a view model"
for row in results:
if row[0] == "comment":
assert row[1] == "This is a view model"
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,13 @@ def test_adding_comments(self, project):
util.run_dbt(["run"])

results = project.run_sql(
f"select comment from {project.database}.information_schema.tables "
f"where"
f" table_schema = '{project.test_schema}' and"
f" table_name = 'merge_update_columns_sql'",
f"describe detail {project.database}.{project.test_schema}.merge_update_columns_sql",
fetch="all",
)
assert results[0][0] == "This is a model description"
assert results[0][3] == "This is a model description"
results = project.run_sql(
f"select comment from {project.database}.information_schema.columns "
f"where"
f" table_schema = '{project.test_schema}' and"
f" table_name = 'merge_update_columns_sql'"
f"order by ordinal_position",
f"describe table {project.database}.{project.test_schema}.merge_update_columns_sql",
fetch="all",
)
assert results[0][0] == "This is the id column"
assert results[1][0] == "This is the msg column"
assert results[0][2] == "This is the id column"
assert results[1][2] == "This is the msg column"
11 changes: 3 additions & 8 deletions tests/functional/adapter/simple_snapshot/test_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,11 @@ def project_config_update(self):

def test_persist_docs(self, project):
results = run_dbt(["snapshot"])
comment_query = (
f"select comment from {project.database}.information_schema.tables "
f"where "
f" table_schema = '{project.test_schema}' and "
f" table_name = 'snapshot'"
)
comment_query = f"describe detail {project.database}.{project.test_schema}.snapshot"
results = project.run_sql(comment_query, fetch="all")
assert results[0][0] == "This is a snapshot description"
assert results[0][3] == "This is a snapshot description"

util.write_file(fixtures.new_comment_schema_yml, "models", "schema.yml")
results = run_dbt(["snapshot"])
results = project.run_sql(comment_query, fetch="all")
assert results[0][0] == "This is a new snapshot description"
assert results[0][3] == "This is a new snapshot description"

0 comments on commit 275031a

Please sign in to comment.