Skip to content

Commit 33c2655

Browse files
authored
Fix: test_delete_ws_groups_should_delete_renamed_and_reflected_groups_only and test_running_real_remove_backup_groups_job (#1476)
## Changes The opposite of the `retried` logic should be applied: pass when `NotFound` otherwise fail after retrying a couple times. ### Linked issues Resolves #1473 Resolves #1472 ### Functionality - [ ] added relevant user documentation - [ ] added new CLI command - [ ] modified existing command: `databricks labs ucx ...` - [ ] added a new workflow - [ ] modified existing workflow: `...` - [ ] added a new table - [ ] modified existing table: `...` ### Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [ ] manually tested - [ ] added unit tests - [ ] added integration tests - [ ] verified on staging environment (screenshot attached)
1 parent 43284ca commit 33c2655

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

tests/integration/test_installation.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,14 @@ def test_running_real_remove_backup_groups_job(ws, installation_ctx):
170170

171171
installation_ctx.deployed_workflows.run_workflow("remove-workspace-local-backup-groups")
172172

173-
@retried(on=[NotFound], timeout=timedelta(seconds=120))
174-
def wait():
175-
ws.groups.get(ws_group_a.id)
173+
# The API needs a moment to delete a group, i.e. until the group is not found anymore
174+
@retried(on=[KeyError], timeout=timedelta(minutes=2))
175+
def get_group(group_id: str):
176+
ws.groups.get(group_id)
177+
raise KeyError(f"Group is not deleted: {group_id}")
176178

177-
wait()
179+
with pytest.raises(NotFound):
180+
get_group(ws_group_a.id)
178181

179182

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

tests/integration/workspace_access/test_groups.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,14 @@ def test_delete_ws_groups_should_delete_renamed_and_reflected_groups_only(
9999
group_manager.reflect_account_groups_on_workspace()
100100
group_manager.delete_original_workspace_groups()
101101

102-
@retried(on=[NotFound], timeout=timedelta(seconds=120))
103-
def wait():
104-
ws.groups.get(ws_group.id)
105-
106-
wait()
102+
# The API needs a moment to delete a group, i.e. until the group is not found anymore
103+
@retried(on=[KeyError], timeout=timedelta(minutes=2))
104+
def get_group(group_id: str):
105+
ws.groups.get(group_id)
106+
raise KeyError(f"Group is not deleted: {group_id}")
107+
108+
with pytest.raises(NotFound):
109+
get_group(ws_group.id)
107110

108111

109112
@retried(on=[NotFound], timeout=timedelta(minutes=2))

0 commit comments

Comments
 (0)