|
39 | 39 | join_collection, |
40 | 40 | logs, |
41 | 41 | manual_workspace_info, |
| 42 | + migrate_acls, |
42 | 43 | migrate_credentials, |
43 | 44 | migrate_dbsql_dashboards, |
44 | 45 | migrate_local_code, |
@@ -100,6 +101,12 @@ def create_workspace_client_mock(workspace_id: int) -> WorkspaceClient: |
100 | 101 | } |
101 | 102 | } |
102 | 103 | ), |
| 104 | + '/Users/foo/.ucx/workspaces.json': json.dumps( |
| 105 | + [ |
| 106 | + {'workspace_id': 123, 'workspace_name': '123'}, |
| 107 | + {'workspace_id': 456, 'workspace_name': '456'}, |
| 108 | + ] |
| 109 | + ), |
103 | 110 | "/Users/foo/.ucx/uc_roles_access.csv": "role_arn,resource_type,privilege,resource_path\n" |
104 | 111 | "arn:aws:iam::123456789012:role/role_name,s3,READ_FILES,s3://labsawsbucket/", |
105 | 112 | "/Users/foo/.ucx/azure_storage_account_info.csv": "prefix,client_id,principal,privilege,type,directory_id\ntest,test,test,test,Application,test", |
@@ -265,9 +272,9 @@ def test_manual_workspace_info(ws): |
265 | 272 | manual_workspace_info(ws, prompts) |
266 | 273 |
|
267 | 274 |
|
268 | | -def test_create_table_mapping(ws, acc_client): |
| 275 | +def test_create_table_mapping_raises_value_error_because_no_tables_found(ws, acc_client) -> None: |
269 | 276 | ctx = WorkspaceContext(ws) |
270 | | - with pytest.raises(ValueError, match='databricks labs ucx sync-workspace-info'): |
| 277 | + with pytest.raises(ValueError, match="No tables found. .*"): |
271 | 278 | create_table_mapping(ws, ctx, False, acc_client) |
272 | 279 |
|
273 | 280 |
|
@@ -434,6 +441,23 @@ def test_save_storage_and_principal_gcp(ws): |
434 | 441 | principal_prefix_access(ws, ctx=ctx) |
435 | 442 |
|
436 | 443 |
|
| 444 | +@pytest.mark.parametrize("run_as_collection", [True, False]) |
| 445 | +def test_migrate_acls_calls_workspace_id( |
| 446 | + run_as_collection, |
| 447 | + workspace_clients, |
| 448 | + acc_client, |
| 449 | +) -> None: |
| 450 | + if not run_as_collection: |
| 451 | + workspace_clients = [workspace_clients[0]] |
| 452 | + migrate_acls( |
| 453 | + workspace_clients[0], |
| 454 | + run_as_collection=run_as_collection, |
| 455 | + a=acc_client, |
| 456 | + ) |
| 457 | + for workspace_client in workspace_clients: |
| 458 | + workspace_client.get_workspace_id.assert_called() |
| 459 | + |
| 460 | + |
437 | 461 | def test_migrate_credentials_azure(ws, acc_client): |
438 | 462 | ws.config.is_azure = True |
439 | 463 | ws.workspace.upload.return_value = "test" |
|
0 commit comments