Skip to content

Commit f52a018

Browse files
authored
Remove flaky tests (#2129)
Fix #1930
1 parent 4a75a7b commit f52a018

File tree

3 files changed

+4
-84
lines changed

3 files changed

+4
-84
lines changed

tests/integration/assessment/test_ext_hms.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
import dataclasses
2-
from datetime import timedelta
32

4-
from databricks.sdk.errors import (
5-
InvalidParameterValue,
6-
NotFound,
7-
)
8-
from databricks.sdk.retries import retried
3+
from databricks.labs.lsql.backends import CommandExecutionBackend
94
from databricks.sdk.service.iam import PermissionLevel
105

116

12-
@retried(on=[NotFound, InvalidParameterValue], timeout=timedelta(minutes=5))
137
def test_running_real_assessment_job_ext_hms(
148
ws,
159
installation_ctx,
1610
env_or_skip,
1711
make_cluster_policy,
1812
make_cluster_policy_permissions,
1913
):
14+
cluster_id = env_or_skip('TEST_EXT_HMS_CLUSTER_ID')
2015
ext_hms_ctx = installation_ctx.replace(
2116
skip_dashboards=True,
17+
sql_backend=CommandExecutionBackend(ws, cluster_id),
2218
config_transform=lambda wc: dataclasses.replace(
2319
wc,
2420
override_clusters=None,

tests/integration/hive_metastore/test_workflows.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
from datetime import timedelta
2-
31
import pytest
4-
from databricks.sdk.errors import InvalidParameterValue, NotFound
5-
from databricks.sdk.retries import retried
2+
from databricks.sdk.errors import NotFound
63

74

8-
@retried(on=[NotFound, InvalidParameterValue], timeout=timedelta(minutes=10))
95
@pytest.mark.parametrize(
106
"prepare_tables_for_migration,workflow",
117
[
@@ -63,7 +59,6 @@ def test_table_migration_job_refreshes_migration_status(
6359
assert len(asserts) == 0, assert_message
6460

6561

66-
@retried(on=[NotFound], timeout=timedelta(minutes=8))
6762
@pytest.mark.parametrize('prepare_tables_for_migration', [('hiveserde')], indirect=True)
6863
def test_hiveserde_table_in_place_migration_job(ws, installation_ctx, prepare_tables_for_migration):
6964
tables, dst_schema = prepare_tables_for_migration
@@ -84,7 +79,6 @@ def test_hiveserde_table_in_place_migration_job(ws, installation_ctx, prepare_ta
8479
assert False, f"{table.name} not found in {dst_schema.catalog_name}.{dst_schema.name}"
8580

8681

87-
@retried(on=[NotFound], timeout=timedelta(minutes=8))
8882
@pytest.mark.parametrize('prepare_tables_for_migration', [('hiveserde')], indirect=True)
8983
def test_hiveserde_table_ctas_migration_job(ws, installation_ctx, prepare_tables_for_migration):
9084
tables, dst_schema = prepare_tables_for_migration

tests/integration/install/test_installation.py

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import dataclasses
22
import json
33
import logging
4-
from dataclasses import replace
54
from datetime import timedelta
65

76
import pytest # pylint: disable=wrong-import-order
87
from databricks.labs.ucx.__about__ import __version__
98

109
from databricks.labs.blueprint.installation import Installation
11-
from databricks.labs.blueprint.installer import RawState
1210
from databricks.labs.blueprint.parallel import ManyError
1311
from databricks.labs.blueprint.tui import MockPrompts
1412
from databricks.labs.blueprint.wheels import ProductInfo
@@ -356,74 +354,6 @@ def test_check_inventory_database_exists(ws, installation_ctx):
356354
installation_ctx.workspace_installer.configure()
357355

358356

359-
@retried(on=[NotFound], timeout=timedelta(minutes=5))
360-
@pytest.mark.parametrize('prepare_tables_for_migration', [('regular')], indirect=True)
361-
def test_table_migration_job(ws, installation_ctx, env_or_skip, prepare_tables_for_migration):
362-
363-
ctx = installation_ctx.replace(
364-
config_transform=lambda wc: replace(wc, override_clusters=None),
365-
extend_prompts={
366-
r"Parallelism for migrating.*": "1000",
367-
r"Min workers for auto-scale.*": "2",
368-
r"Max workers for auto-scale.*": "20",
369-
r"Instance pool id to be set.*": env_or_skip("TEST_INSTANCE_POOL_ID"),
370-
r".*Do you want to update the existing installation?.*": 'yes',
371-
},
372-
)
373-
tables, dst_schema = prepare_tables_for_migration
374-
375-
ctx.workspace_installation.run()
376-
ctx.deployed_workflows.run_workflow("migrate-tables")
377-
# assert the workflow is successful
378-
assert ctx.deployed_workflows.validate_step("migrate-tables")
379-
# assert the tables are migrated
380-
for table in tables.values():
381-
try:
382-
assert ws.tables.get(f"{dst_schema.catalog_name}.{dst_schema.name}.{table.name}").name
383-
except NotFound:
384-
assert False, f"{table.name} not found in {dst_schema.catalog_name}.{dst_schema.name}"
385-
# assert the cluster is configured correctly
386-
for job_cluster in ws.jobs.get(
387-
ctx.installation.load(RawState).resources["jobs"]["migrate-tables"]
388-
).settings.job_clusters:
389-
if job_cluster.job_cluster_key != "table_migration":
390-
# don't assert on the cluster for parse logs task
391-
continue
392-
assert job_cluster.new_cluster.autoscale.min_workers == 2
393-
assert job_cluster.new_cluster.autoscale.max_workers == 20
394-
assert job_cluster.new_cluster.spark_conf["spark.sql.sources.parallelPartitionDiscovery.parallelism"] == "1000"
395-
396-
397-
@retried(on=[NotFound], timeout=timedelta(minutes=8))
398-
@pytest.mark.parametrize('prepare_tables_for_migration', [('regular')], indirect=True)
399-
def test_table_migration_job_cluster_override(ws, installation_ctx, prepare_tables_for_migration, env_or_skip):
400-
401-
tables, dst_schema = prepare_tables_for_migration
402-
ctx = installation_ctx.replace(
403-
extend_prompts={
404-
r".*Do you want to update the existing installation?.*": 'yes',
405-
},
406-
)
407-
ctx.workspace_installation.run()
408-
ctx.deployed_workflows.run_workflow("migrate-tables")
409-
# assert the workflow is successful
410-
assert ctx.deployed_workflows.validate_step("migrate-tables")
411-
# assert the tables are migrated
412-
for table in tables.values():
413-
try:
414-
assert ws.tables.get(f"{dst_schema.catalog_name}.{dst_schema.name}.{table.name}").name
415-
except NotFound:
416-
assert False, f"{table.name} not found in {dst_schema.catalog_name}.{dst_schema.name}"
417-
# assert the cluster is configured correctly on the migrate tables tasks
418-
install_state = ctx.installation.load(RawState)
419-
job_id = install_state.resources["jobs"]["migrate-tables"]
420-
assert all(
421-
task.existing_cluster_id == env_or_skip("TEST_USER_ISOLATION_CLUSTER_ID")
422-
for task in ws.jobs.get(job_id).settings.tasks
423-
if task.task_key != "parse_logs"
424-
)
425-
426-
427357
def test_compare_remote_local_install_versions(ws, installation_ctx):
428358
installation_ctx.workspace_installation.run()
429359
with pytest.raises(

0 commit comments

Comments
 (0)