Skip to content

Commit d2556a5

Browse files
committed
Test for historical records table to be created
1 parent 4b2cd0b commit d2556a5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
def test_progress_tracking_installer_creates_workflow_runs_table(az_cli_ctx) -> None:
1+
import pytest
2+
3+
4+
@pytest.mark.parametrize("table_name", ["workflow_runs", "historical_records"])
5+
def test_progress_tracking_installer_creates_table(az_cli_ctx, table_name) -> None:
26
az_cli_ctx.progress_tracking_installation.run()
37
query = (
48
f"SELECT 1 FROM tables WHERE table_catalog = '{az_cli_ctx.config.ucx_catalog}' "
5-
"AND table_schema = 'multiworkspace' AND table_name = 'workflow_runs'"
9+
f"AND table_schema = 'multiworkspace' AND table_name = '{table_name}'"
610
)
711
assert any(az_cli_ctx.sql_backend.fetch(query, catalog="system", schema="information_schema"))

tests/unit/progress/test_install.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ def test_progress_tracking_installation_run_creates_progress_tracking_schema(moc
77
assert "CREATE SCHEMA IF NOT EXISTS ucx.multiworkspace" in mock_backend.queries[0]
88

99

10-
def test_progress_tracking_installation_run_creates_workflow_runs_table(mock_backend) -> None:
10+
def test_progress_tracking_installation_run_creates_tables(mock_backend) -> None:
1111
installation = ProgressTrackingInstallation(mock_backend, "ucx")
1212
installation.run()
1313
# Dataclass to schema conversion is tested within the lsql package
14-
assert any("CREATE TABLE IF NOT EXISTS" in query for query in mock_backend.queries)
14+
assert sum("CREATE TABLE IF NOT EXISTS" in query for query in mock_backend.queries) == 2

0 commit comments

Comments
 (0)