-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
43 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,7 @@ def download(path: str) -> io.StringIO | io.BytesIO: | |
workspace_client = create_autospec(WorkspaceClient) | ||
|
||
workspace_client.current_user.me = lambda: iam.User( | ||
user_name="[email protected]", groups=[iam.ComplexValue(display="admins")] | ||
user_name="[email protected]", id="666", groups=[iam.ComplexValue(display="admins")] | ||
) | ||
workspace_client.config.host = "https://foo" | ||
workspace_client.config.is_aws = True | ||
|
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 |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
from databricks.sdk.errors.platform import BadRequest | ||
from databricks.sdk.service import iam, jobs, sql | ||
from databricks.sdk.service.compute import Policy | ||
from databricks.sdk.service.iam import Group, ComplexValue | ||
from databricks.sdk.service.jobs import BaseRun, RunLifeCycleState, RunResultState, RunState | ||
from databricks.sdk.service.provisioning import Workspace | ||
|
||
|
@@ -394,6 +395,47 @@ def test_configure_sets_expected_workspace_configuration_values( | |
mock_installation.assert_file_written("config.yml", workspace_config_expected) | ||
|
||
|
||
def test_configure_with_default_owner_group( | ||
ws, | ||
mock_installation, | ||
) -> None: | ||
workspace_config_expected = { | ||
"version": 2, | ||
"default_catalog": "ucx_default", | ||
"default_owner_group": "account_group", | ||
"ucx_catalog": "ucx", | ||
"inventory_database": "ucx", | ||
"log_level": "INFO", | ||
"num_threads": 8, | ||
"min_workers": 1, | ||
"max_workers": 10, | ||
"policy_id": "foo", | ||
"renamed_group_prefix": "db-temp-", | ||
"warehouse_id": "abc", | ||
"workspace_start_path": "/", | ||
"num_days_submit_runs_history": 30, | ||
"recon_tolerance_percent": 5, | ||
"managed_table_external_storage": "CLONE", | ||
} | ||
prompts = MockPrompts( | ||
{ | ||
r".*PRO or SERVERLESS SQL warehouse.*": "1", | ||
r"Choose how to map the workspace groups.*": "2", # specify names | ||
r"If hive_metastore contains managed table with external.*": "1", | ||
r"Do you want to define a default owner group.*": "yes", | ||
r"Select the group to be used.*": "0", | ||
r".*": "", | ||
} | ||
) | ||
group1 = Group(id="1", display_name="account_group", members=[ComplexValue(display="[email protected]", value="666")]) | ||
ws.api_client.do.return_value = {"Resources": [group1.as_dict()]} | ||
install = WorkspaceInstaller(ws).replace(prompts=prompts, installation=mock_installation, product_info=PRODUCT_INFO) | ||
|
||
install.configure() | ||
|
||
mock_installation.assert_file_written("config.yml", workspace_config_expected) | ||
|
||
|
||
def test_corrupted_config(ws, mock_installation, caplog): | ||
installation = MockInstallation({'config.yml': "corrupted"}) | ||
|
||
|