diff --git a/src/databricks/labs/ucx/workspace_access/generic.py b/src/databricks/labs/ucx/workspace_access/generic.py index 6341167413..4a1ecd8e2e 100644 --- a/src/databricks/labs/ucx/workspace_access/generic.py +++ b/src/databricks/labs/ucx/workspace_access/generic.py @@ -246,7 +246,7 @@ def _crawl(self) -> list[WorkspaceObjectInfo]: ws_listing = WorkspaceListing(self._ws, num_threads=self._num_threads, with_directories=False) for obj in ws_listing.walk(self._start_path): - if obj is None: + if obj is None or obj.object_type is None: continue raw = obj.as_dict() yield WorkspaceObjectInfo( diff --git a/tests/unit/workspace_access/test_generic.py b/tests/unit/workspace_access/test_generic.py index ad9198de7f..8142f882a7 100644 --- a/tests/unit/workspace_access/test_generic.py +++ b/tests/unit/workspace_access/test_generic.py @@ -490,6 +490,33 @@ def test_workspaceobject_crawl(): assert result_set[0] == WorkspaceObjectInfo("NOTEBOOK", "123", "/rootobj/notebook1", "PYTHON") +def test_workspaceobject_withexperiment_crawl(): + sample_objects = [ + ObjectInfo( + object_type=ObjectType.NOTEBOOK, + path="/rootobj/notebook1", + language=Language.PYTHON, + created_at=0, + modified_at=0, + object_id=123, + size=0, + ), + ObjectInfo( + path="/rootobj/experiment1", + created_at=0, + modified_at=0, + object_id=456, + ), + ] + ws = Mock() + with patch("databricks.labs.ucx.workspace_access.listing.WorkspaceListing.walk", return_value=sample_objects): + crawler = WorkspaceListing(ws, MockBackend(), "ucx")._crawl() + result_set = list(crawler) + + assert len(result_set) == 1 + assert result_set[0] == WorkspaceObjectInfo("NOTEBOOK", "123", "/rootobj/notebook1", "PYTHON") + + def test_workspace_snapshot(): sample_objects = [ WorkspaceObjectInfo(