-
Notifications
You must be signed in to change notification settings - Fork 91
Investigate managed disk cleanup reliability and download state handling #9009
Description
Summary
Managed disk test scenarios may leave disks in upload-related states, which can later cause disk download operations to fail unexpectedly.
Problem
There is evidence that managed-disk test cleanup is not reliably awaited, which can allow test-created resources to persist after runs complete or are interrupted. In addition, the managed disks download UX does not appear to guard against certain non-downloadable disk states.
Evidence
Test cleanup is not guaranteed
In src/components/managed-disks-extension/test/CreateAndDownloadDiskTests.ts, the after() hook invokes async cleanup helpers without awaiting them:
deleteTestDisk(initialDiskConnection);
deleteTestDisk(uploadedDiskConnection);
deleteTestSnapshot(snapshotConnection);
deleteTestDisk(copiedServerSideDiskConnection);
deleteTestDisk(copiedClientSideDiskConnection);Those helpers are asynchronous, so cleanup can be abandoned if the process exits or the run is interrupted.
The delete helpers also catch failures and log them without surfacing them as test failures.
Upload-mode disks are intentionally created during copy/upload flows
In src/components/managed-disks-extension/src/StateMachines/DiskCopy/States/CreateResourceState.ts, the upload path creates a disk with:
creationData = {
createOption: "Upload",
uploadSizeBytes: newDiskParams.size,
};If cleanup does not complete, these resources can remain in upload-related states.
Download UX should likely guard more disk states
src/components/managed-disks-extension/src/Editors/ManagedDisksExplorerReact/Commands/DownloadCommand.ts currently only disables download for attached disks. This may allow attempts against disks that Azure will reject for read access.
Proposed follow-up
- Update managed-disk tests to
awaitcleanup and ensure teardown completes before exit. - Consider failing tests or producing stronger diagnostics when cleanup fails.
- Audit interruption/failure paths for upload/copy flows to ensure access is revoked and temporary resources are cleaned up.
- Improve the download command to block or message clearly for non-downloadable disk states.
Impact
This can cause noisy follow-on failures and confusion during later managed disk testing and manual verification.