Skip to content

Commit

Permalink
Added handling of exceptions when listing tables
Browse files Browse the repository at this point in the history
  • Loading branch information
skrydal committed Nov 15, 2024
1 parent 733ed5a commit f9ac4c7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions metadata-ingestion/tests/unit/test_iceberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,21 @@ def list_tables(self, namespace: str) -> Iterable[Tuple[str, str]]:
return super().list_tables(namespace)


class MockCatalogExceptionListingNamespaces(MockCatalog):
def list_namespaces(self) -> Iterable[str]:
raise Exception()


def test_exception_while_listing_namespaces() -> None:
source = with_iceberg_source(processing_threads=2)
mock_catalog = MockCatalogExceptionListingNamespaces({})
with patch(
"datahub.ingestion.source.iceberg.iceberg.IcebergSourceConfig.get_catalog"
) as get_catalog, pytest.raises(Exception):
get_catalog.return_value = mock_catalog
[*source.get_workunits_internal()]


def test_known_exception_while_listing_tables() -> None:
source = with_iceberg_source(processing_threads=2)
mock_catalog = MockCatalogExceptionListingTables(
Expand Down

0 comments on commit f9ac4c7

Please sign in to comment.