Skip to content

Commit 7626c8f

Browse files
pieternclaude
andauthored
Fix WorkspaceDelete to delete directories in testserver (#4382)
## Changes The testserver's WorkspaceDelete method now properly deletes directories in addition to files, both for non-recursive and recursive deletion modes. This ensures proper cleanup of workspace paths during tests. Updated sql_warehouses acceptance test output to reflect the corrected behavior where destroy properly cleans up and shows "No active deployment found to destroy!" on subsequent destroy calls. ## Tests Acceptance tests pass locally. Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 7d1572d commit 7626c8f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

acceptance/bundle/resources/sql_warehouses/output.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,4 @@ Resources:
137137
URL: (not deployed)
138138

139139
>>> [CLI] bundle destroy --auto-approve
140-
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test_sql_warehouse/default
141-
142-
Deleting files...
143-
Destroy complete!
140+
No active deployment found to destroy!

libs/testserver/fake_workspace.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,18 @@ func (s *FakeWorkspace) WorkspaceDelete(path string, recursive bool) {
341341
defer s.LockUnlock()()
342342
if !recursive {
343343
delete(s.files, path)
344+
delete(s.directories, path)
344345
} else {
345346
for key := range s.files {
346347
if strings.HasPrefix(key, path) {
347348
delete(s.files, key)
348349
}
349350
}
351+
for key := range s.directories {
352+
if strings.HasPrefix(key, path) {
353+
delete(s.directories, key)
354+
}
355+
}
350356
}
351357
}
352358

0 commit comments

Comments
 (0)