Skip to content

Commit cedad88

Browse files
authored
Fix test_migrate_managed_tables_with_acl by filtering the grant created for the test user (#2512)
## Changes Filter the grant created for the test user instead of assuming it to be the last grant. ### Linked issues Resolves #2511 ### Tests - [x] modified integration tests: `test_migrate_managed_tables_with_acl`
1 parent e16194b commit cedad88

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/integration/hive_metastore/test_migrate.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,11 +532,13 @@ def test_migrate_managed_tables_with_acl(ws, sql_backend, runtime_ctx, make_cata
532532
assert len(target_tables) == 1
533533

534534
target_table_properties = ws.tables.get(f"{dst_schema.full_name}.{src_managed_table.name}").properties
535-
target_table_grants = ws.grants.get(SecurableType.TABLE, f"{dst_schema.full_name}.{src_managed_table.name}")
536535
assert target_table_properties["upgraded_from"] == src_managed_table.full_name
537536
assert target_table_properties[Table.UPGRADED_FROM_WS_PARAM] == str(ws.get_workspace_id())
538-
assert target_table_grants.privilege_assignments[-1].principal == user.user_name
539-
assert target_table_grants.privilege_assignments[-1].privileges == [Privilege.MODIFY, Privilege.SELECT]
537+
538+
target_table_grants = ws.grants.get(SecurableType.TABLE, f"{dst_schema.full_name}.{src_managed_table.name}")
539+
target_principals = [pa for pa in target_table_grants.privilege_assignments or [] if pa.principal == user.user_name]
540+
assert len(target_principals) == 1, f"Missing grant for user {user.user_name}"
541+
assert target_principals[0].privileges == [Privilege.MODIFY, Privilege.SELECT]
540542

541543

542544
@retried(on=[NotFound], timeout=timedelta(minutes=3))

0 commit comments

Comments
 (0)