Skip to content

Commit 7a1bf02

Browse files
committed
Update integration test to create catalog
1 parent 44a1de7 commit 7a1bf02

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

tests/integration/hive_metastore/test_catalog_schema.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import logging
22
from datetime import timedelta
3-
from collections.abc import Iterator
43

54
import pytest
65
from databricks.labs.blueprint.tui import MockPrompts
@@ -17,34 +16,19 @@
1716
_SPARK_CONF = get_azure_spark_conf()
1817

1918

20-
@pytest.fixture
21-
def catalog_name(ws, make_random) -> Iterator[str]:
22-
name = f"test-catalog-{make_random(5)}"
23-
yield name
24-
try:
25-
ws.catalogs.delete(name, force=True)
26-
logger.info(f"Deleted test catalog: {name}")
27-
except NotFound:
28-
pass
29-
30-
3119
@retried(on=[NotFound], timeout=timedelta(minutes=2))
32-
def test_create_ucx_catalog_creates_catalog(
33-
ws,
34-
runtime_ctx,
35-
watchdog_remove_after,
36-
catalog_name,
37-
) -> None:
38-
prompts = MockPrompts({f"Please provide storage location url for catalog: {catalog_name}": "metastore"})
39-
runtime_ctx.catalog_schema._ucx_catalog = catalog_name
20+
def test_create_ucx_catalog_creates_catalog(ws, runtime_ctx, watchdog_remove_after) -> None:
21+
# Delete catalog created for testing to test the creation of a new catalog
22+
runtime_ctx.workspace_client.catalogs.delete(runtime_ctx.ucx_catalog, force=True)
23+
prompts = MockPrompts({f"Please provide storage location url for catalog: {runtime_ctx.ucx_catalog}": "metastore"})
4024

4125
runtime_ctx.catalog_schema.create_ucx_catalog(prompts, properties={"RemoveAfter": watchdog_remove_after})
4226

43-
@retried(on=[KeyError], timeout=timedelta(seconds=20))
27+
@retried(on=[NotFound], timeout=timedelta(seconds=20))
4428
def get_catalog(name: str) -> CatalogInfo:
4529
return ws.catalogs.get(name)
4630

47-
assert get_catalog(catalog_name)
31+
assert get_catalog(runtime_ctx.ucx_catalog)
4832

4933

5034
@retried(on=[NotFound], timeout=timedelta(minutes=2))

0 commit comments

Comments
 (0)