Skip to content
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

Let migration status test have one assert #1651

Merged
merged 2 commits into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions tests/integration/hive_metastore/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,23 @@ def test_table_migration_job_refreshes_migration_status(ws, installation_ctx, pr
ctx.workspace_installation.run()
ctx.deployed_workflows.run_workflow(workflow)

asserts = []
for table in tables.values():
# Avoiding MigrationStatusRefresh as it will refresh the status before fetching
query_migration_status = (
f"SELECT * FROM {ctx.config.inventory_database}.migration_status "
f"WHERE src_schema = '{table.schema_name}' AND src_table = '{table.name}'"
)
migration_status = list(ctx.sql_backend.fetch(query_migration_status))

assert_message_postfix = f" found for {table.table_type} {table.full_name}"
assert len(migration_status) == 1, "No migration status" + assert_message_postfix
assert migration_status[0].dst_schema is not None, "No destination schema" + assert_message_postfix
assert migration_status[0].dst_table is not None, "No destination table" + assert_message_postfix
if len(migration_status) == 0:
asserts.append("No migration status" + assert_message_postfix)
elif len(migration_status) > 1:
asserts.append("Multiple migration statuses" + assert_message_postfix)
elif migration_status[0].dst_schema is None:
asserts.append("No destination schema" + assert_message_postfix)
elif migration_status[0].dst_table is None:
asserts.append("No destination table" + assert_message_postfix)

assert len(asserts) == 0, "\n".join(asserts)
Loading