Skip to content

Commit 7c310ff

Browse files
acc: stop bundle-generate tests leaking cloud workspace dirs (#5946)
## Why Several `bundle/generate` acceptance tests create directories on the **real workspace** (they have `Cloud = true`) and never reliably remove them, so leftovers accumulate on shared test workspaces (e.g. `azure-prod-ucws-is`), bloating `workspace list /`. This was observed contributing to a workspace-listing integration test hanging. Two distinct leaks: 1. **`genie_space`, `dashboard`, `alert`** each ran `workspace mkdirs /Workspace/test-$UNIQUE_NAME` at the **workspace root** and used it as the `parent_path` for the resource they create. Nothing deleted it: no `script.cleanup`, and the `eng-dev-ecosystem` env cleaner only sweeps `/Users`, never the root. The alert test also frequently times out (`TimeoutCloud = "5m"`, #4221). 2. **`auto-bind`** deployed its bundle to `/Workspace/tmp/$UNIQUE_NAME`. Its `bundle destroy` removes that on the happy path, but the inline `trap` only cleaned the `/Users/.../python-*` notebook dirs — so a failure before `destroy` leaked the root into the shared, unswept `/Workspace/tmp` namespace. ## What Every generate test that creates workspace state now cleans up after itself, in the swept user tree: - Relocated the three root dirs to `/Workspace/Users/$CURRENT_USER_NAME/test-$UNIQUE_NAME`, and added a `script.cleanup` to each that recursively deletes it (removing the genie space / dashboard / alert created inside). - Moved `auto-bind`'s bundle root to `~/.bundle/auto-bind-test-$UNIQUE_NAME`, matching the `~/.bundle` convention every other bundle acceptance test uses. Output goldens regenerated with `-update`; the full `bundle/generate` suite passes locally. This pull request and its description were written by Isaac, an AI coding agent.
1 parent 9b5273a commit 7c310ff

15 files changed

Lines changed: 22 additions & 13 deletions

File tree

acceptance/bundle/generate/alert/alert.json.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"display_name": "test alert",
3-
"parent_path": "/Workspace/test-$UNIQUE_NAME",
3+
"parent_path": "/Workspace/Users/$CURRENT_USER_NAME/test-$UNIQUE_NAME",
44
"query_text": "SELECT 1\n as value",
55
"warehouse_id": "$TEST_DEFAULT_WAREHOUSE_ID",
66
"evaluation": {

acceptance/bundle/generate/alert/output.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
>>> [CLI] workspace mkdirs /Workspace/test-[UNIQUE_NAME]
2+
>>> [CLI] workspace mkdirs /Workspace/Users/[USERNAME]/test-[UNIQUE_NAME]
33

44
>>> [CLI] bundle generate alert --existing-id [ALERT_ID] --source-dir out/alert --config-dir out/resource
55
Alert configuration successfully saved to [TEST_TMP_DIR]/out/resource/test_alert.alert.yml
@@ -12,3 +12,5 @@ so it will not be deployed. Add a matching entry to the 'include' section, for e
1212
include:
1313
- out/resource/*.yml
1414

15+
16+
>>> [CLI] workspace delete /Workspace/Users/[USERNAME]/test-[UNIQUE_NAME] --recursive

acceptance/bundle/generate/alert/script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
trace $CLI workspace mkdirs /Workspace/test-$UNIQUE_NAME
1+
trace $CLI workspace mkdirs /Workspace/Users/$CURRENT_USER_NAME/test-$UNIQUE_NAME
22

33
# create an alert to import
44
envsubst < alert.json.tmpl > alert.json
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
trace $CLI workspace delete /Workspace/Users/$CURRENT_USER_NAME/test-$UNIQUE_NAME --recursive

acceptance/bundle/generate/auto-bind/databricks.yml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ bundle:
22
name: auto-bind-test
33

44
workspace:
5-
root_path: /tmp/${UNIQUE_NAME}
5+
root_path: ~/.bundle/auto-bind-test-${UNIQUE_NAME}
66

77
include:
88
- resources/*.yml

acceptance/bundle/generate/auto-bind/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test.py
2121

2222
=== Deploy the bound job:
2323
>>> [CLI] bundle deploy
24-
Uploading bundle files to /Workspace/tmp/[UNIQUE_NAME]/files...
24+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/auto-bind-test-[UNIQUE_NAME]/files...
2525
Deploying resources...
2626
Updating deployment state...
2727
Deployment complete!
@@ -31,7 +31,7 @@ Deployment complete!
3131
The following resources will be deleted:
3232
delete resources.jobs.test_job
3333

34-
All files and directories at the following location will be deleted: /Workspace/tmp/[UNIQUE_NAME]
34+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/auto-bind-test-[UNIQUE_NAME]
3535

3636
Deleting files...
3737
Destroy complete!
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"display_name": "test dashboard",
3-
"parent_path": "/Workspace/test-$UNIQUE_NAME",
3+
"parent_path": "/Workspace/Users/$CURRENT_USER_NAME/test-$UNIQUE_NAME",
44
"serialized_dashboard": "{\"pages\":[{\"displayName\":\"New Page\",\"layout\":[],\"name\":\"12345678\"}]}"
55
}

acceptance/bundle/generate/dashboard/output.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
>>> [CLI] workspace mkdirs /Workspace/test-[UNIQUE_NAME]
2+
>>> [CLI] workspace mkdirs /Workspace/Users/[USERNAME]/test-[UNIQUE_NAME]
33

44
>>> [CLI] bundle generate dashboard --existing-id [DASHBOARD_ID] --dashboard-dir out/dashboard --resource-dir out/resource
55
Writing dashboard to out/dashboard/test_dashboard.lvdash.json
@@ -12,3 +12,5 @@ so it will not be deployed. Add a matching entry to the 'include' section, for e
1212
include:
1313
- out/resource/*.yml
1414

15+
16+
>>> [CLI] workspace delete /Workspace/Users/[USERNAME]/test-[UNIQUE_NAME] --recursive

acceptance/bundle/generate/dashboard/script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
trace $CLI workspace mkdirs /Workspace/test-$UNIQUE_NAME
1+
trace $CLI workspace mkdirs /Workspace/Users/$CURRENT_USER_NAME/test-$UNIQUE_NAME
22

33
# create a dashboard to import
44
envsubst < dashboard.json.tmpl > dashboard.json
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
trace $CLI workspace delete /Workspace/Users/$CURRENT_USER_NAME/test-$UNIQUE_NAME --recursive

0 commit comments

Comments
 (0)