-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prefetch all account-level and workspace-level groups (#192)
Addresses #190 and other SCIM-related issues. Conceptually, the following happens: 1. Existing method to list the workspace groups is inconsistent, and the root cause of these issues is somewhere on SCIM API side. We've raised a ticket, but the resolution timing is unclear. 2. To avoid being time-dependent on SCIM API, we re-introduce the listing methods, but this time we intentionally don't use `filter`-based conditions and explicitly split the API methods into two. 3. To avoid reaching out to the SCIM API too frequently, we list the whole API only once and then work with an in-memory data. This PR also adds 100% coverage for `GroupManager` and adds integration tests for groups to verify it works as expected.
- Loading branch information
1 parent
f4e5989
commit b654a3a
Showing
3 changed files
with
169 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from databricks.sdk import WorkspaceClient | ||
|
||
from databricks.labs.ucx.config import GroupsConfig | ||
from databricks.labs.ucx.managers.group import GroupLevel, GroupManager | ||
|
||
|
||
def test_group_listing(ws: WorkspaceClient, make_ucx_group): | ||
ws_group, acc_group = make_ucx_group() | ||
manager = GroupManager(ws, GroupsConfig(selected=[ws_group.display_name])) | ||
assert ws_group.display_name in [g.display_name for g in manager._workspace_groups] | ||
assert acc_group.display_name in [g.display_name for g in manager._account_groups] | ||
|
||
|
||
def test_id_validity(ws: WorkspaceClient, make_ucx_group): | ||
ws_group, acc_group = make_ucx_group() | ||
manager = GroupManager(ws, GroupsConfig(selected=[ws_group.display_name])) | ||
assert ws_group.id == manager._get_group(ws_group.display_name, GroupLevel.WORKSPACE).id | ||
assert acc_group.id == manager._get_group(acc_group.display_name, GroupLevel.ACCOUNT).id |
Oops, something went wrong.