Skip to content

Investigate managed disk cleanup reliability and download state handling #9009

@craxal

Description

@craxal

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

  1. Update managed-disk tests to await cleanup and ensure teardown completes before exit.
  2. Consider failing tests or producing stronger diagnostics when cleanup fails.
  3. Audit interruption/failure paths for upload/copy flows to ensure access is revoked and temporary resources are cleaned up.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions