Skip to content

Commit

Permalink
fix: flaky test when sync metadata (#21306)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyongjie committed Sep 2, 2022
1 parent 2d70ef6 commit f71ee2e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/integration_tests/sqla_models_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ def test_fetch_metadata_for_updated_virtual_table(self):

# make sure the columns have been mapped properly
assert len(table.columns) == 4
table.fetch_metadata(commit=False)
with db.session.no_autoflush:
table.fetch_metadata(commit=False)

# assert that the removed column has been dropped and
# the physical and calculated columns are present
Expand All @@ -465,15 +466,13 @@ def test_fetch_metadata_for_updated_virtual_table(self):
}
cols: Dict[str, TableColumn] = {col.column_name: col for col in table.columns}
# assert that the type for intcol has been updated (asserting CI types)
backend = get_example_database().backend
backend = table.database.backend
assert VIRTUAL_TABLE_INT_TYPES[backend].match(cols["intcol"].type)
# assert that the expression has been replaced with the new physical column
assert cols["mycase"].expression == ""
assert VIRTUAL_TABLE_STRING_TYPES[backend].match(cols["mycase"].type)
assert cols["expr"].expression == "case when 1 then 1 else 0 end"

db.session.delete(table)

@patch("superset.models.core.Database.db_engine_spec", BigQueryEngineSpec)
def test_labels_expected_on_mutated_query(self):
query_obj = {
Expand Down

0 comments on commit f71ee2e

Please sign in to comment.