tart/Tests/TartTests
Fedor Korotkov 3a6c5fb81d
feat: Add disk image format selection with ASIF support (#1094)
* feat: Add disk image format selection with ASIF support

* fixed goreleaser-pro

* Fix ASIF disk format compatibility issues

- Use .uncached caching mode for ASIF disks to avoid Virtualization framework compatibility issues
- Improve caching mode selection logic for better maintainability
- Fix compiler warning by changing var to let for attachment variable

This resolves VM startup failures when using ASIF disk format by ensuring proper disk attachment configuration.

* Update goreleaser installation to use tap-specific formula

Change from 'brew install --cask goreleaser-pro' to 'brew install --cask goreleaser/tap/goreleaser-pro' for proper installation from the official goreleaser tap.

* Remove VS Code configuration and add to gitignore

- Remove .vscode/launch.json from repository
- Add .vscode/ to .gitignore to prevent VS Code settings from being tracked

* Implement ASIF disk resize using diskutil

- Add support for resizing ASIF disk images using diskutil image resize
- Detect disk format from VM config and route to appropriate resize method
- Use diskutil image info to get current ASIF disk size and validate resize
- Remove restriction that prevented ASIF disk resizing in Set command
- Add FailedToResizeDisk error case for proper error handling
- Maintain backward compatibility with raw disk resizing
- Add comprehensive size validation to prevent data loss

* Update Sources/tart/Commands/Create.swift

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>

* Update Sources/tart/DiskImageFormat.swift

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>

* Update Sources/tart/DiskImageFormat.swift

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>

* Fix test naming and remove redundant test cases

- Rename testFormatArgument to testCaseInsensitivity for clarity
- Remove redundant 'raw' and 'invalid' test cases already covered in testFormatFromString
- Remove testFormatDescriptions test as it's not very useful

Addresses review comment: https://github.com/cirruslabs/tart/pull/1094#discussion_r2152093510

* Remove canCreate property and simplify DiskImageFormat

- Remove canCreate property since it's the same as isSupported
- Remove description property entirely as it's not used
- Fix displayName for RAW format (remove UDIF reference)
- Remove checkDiskutilASIFSupport helper function

Addresses review comments:
- https://github.com/cirruslabs/tart/pull/1094#discussion_r2152109450
- https://github.com/cirruslabs/tart/pull/1094#discussion_r2152115610
- https://github.com/cirruslabs/tart/pull/1094#discussion_r2152124330

* Update Create command validation and help text

- Simplify ArgumentParser help text to let it show possible values automatically
- Remove canCreate validation since property was removed
- Simplify error message for unsupported disk formats

Addresses review comment: https://github.com/cirruslabs/tart/pull/1094#discussion_r2152113480

* Add disk format validation to Run command

- Add validation to ensure ASIF disk format is supported on current system
- Check disk format compatibility before attempting to run VM

Addresses review comment: https://github.com/cirruslabs/tart/pull/1094#discussion_r2152109450

* Use proper namespaced constant for OCI label

- Add diskFormatLabelAnnotation constant in Manifest.swift
- Use org.cirruslabs.tart.disk.format namespace for consistency
- Use variable shadowing instead of new variable name for labels

Addresses review comment: https://github.com/cirruslabs/tart/pull/1094#discussion_r2152163515

* Remove special ASIF caching mode

- Remove .uncached caching mode for ASIF disks
- Use default caching logic for all disk formats
- Testing shows .cached mode works fine on macOS 26.0

Addresses review comment: https://github.com/cirruslabs/tart/pull/1094#discussion_r2152133589

* Improve code structure in VMDirectory

- Use guard let instead of nested if let for better readability
- Reduce nesting in resizeASIFDisk function
- Improve error handling flow

Addresses review comment: https://github.com/cirruslabs/tart/pull/1094#discussion_r2152141916

* diskFormatLabel

* reverted caching mode

* Use PropertyListDecoder

---------

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
2025-06-19 18:27:30 +04:00
..
Util RegistryRunner: explicitly listen on localhost (#956) 2024-11-21 09:24:37 -05:00
DigestTests.swift Support pulling/pushing VMs to OCI-compatible registries (#32) 2022-05-03 14:30:26 -04:00
DirecotryShareTests.swift Allow to override VirtioFS tag for shared directories (#733) 2024-02-19 20:51:25 +00:00
DiskImageFormatTests.swift feat: Add disk image format selection with ASIF support (#1094) 2025-06-19 18:27:30 +04:00
DockerConfigTests.swift Support wildcards in `credHelpers` (#592) 2023-08-28 11:37:49 -04:00
FileLockTests.swift Reformat code idents and introduce the SwiftFormat linter (#339) 2022-11-29 15:56:13 +00:00
LayerizerTests.swift tart push: support --concurrency command-line argument (#868) 2024-07-18 17:52:55 +04:00
LeaseTest.swift MAC address resolver: skip expired leases (#669) 2023-11-27 10:12:36 -05:00
LeasesTests.swift DHCP MAC-address resolver: handle duplicate leases (#740) 2024-02-23 16:49:06 +04:00
MACAddressResolverTests.swift MAC address resolver: skip expired leases (#669) 2023-11-27 10:12:36 -05:00
RegistryTests.swift Reformat code idents and introduce the SwiftFormat linter (#339) 2022-11-29 15:56:13 +00:00
RemoteNameTests.swift Reformat code idents and introduce the SwiftFormat linter (#339) 2022-11-29 15:56:13 +00:00
TokenResponseTests.swift Fixed Swift Warning (#787) 2024-04-11 19:53:10 +04:00
URLAbsolutizationTests.swift Reformat code idents and introduce the SwiftFormat linter (#339) 2022-11-29 15:56:13 +00:00
URLAccessDateTests.swift Introduce "tart prune" command (#164) 2022-08-12 16:43:04 +03:00
WWWAuthenticateTests.swift Support pulling/pushing VMs to OCI-compatible registries (#32) 2022-05-03 14:30:26 -04:00