Mock user doesn't have the required privileges to access catalog `remorph` while running 'make test'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 05:17 AM
Utility : Remorph (Databricks)
Issue : 'User `me@example.com` doesn't have required privileges :: ``to access catalog `remorph`' while running 'make test' cmd
I am encountering an issue while running tests for Databricks Labs Remorph using 'make test' cmd. The error indicates that the mock user does not have the required privileges to access the catalog remorph, despite explicitly adding the user to the 'admins' group.
1. Relevant Code Snippet :
@pytest.fixture
def ws():
w = create_autospec(WorkspaceClient)
w.current_user.me.side_effect = lambda: iam.User(
user_name="me@example.com", groups=[iam.ComplexValue(display="admins")],
)
w.config.return_value = {"warehouse_id" , "1234"}
return w
2. Troubleshooting Steps Taken:
- Mocking a user using WorkspaceClient.
- User has been added to the admins group.
- Attempted to assign catalog-level permissions like catalog:read:remorph and few more,
but the error still persists.Expected Behaviour : The mock user 'me@example.com'should have equivalent admin privileges to access the 'remorph' catalog and schema during tests.
Requesting for a help on resolving the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 05:29 AM
Hi @rai00,
Ensure that the mock user me@example.com has the necessary privileges at both the catalog and schema levels. The user needs specific privileges such as USE_SCHEMA and CREATE_VOLUME
Use the WorkspaceClient to check the effective privileges for the user.
permissions = ws.grants.get_effective(SecurableType.SCHEMA, "remorph", principal="me@example.com")
user_privileges = [p.privilege for p in chain.from_iterable(privilege.privileges for privilege in permissions.privilege_assignments if privilege.privileges)]
print(user_privileges)

