refactor: workstation license check #277
Open
+147
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Refactors
workstationLicenseCheck
to enhance the handling of VMware Workstation license checks and improve test coverage. The most important changes include adding a new constant for a version that does not require a license, modifying the license check logic, and adding comprehensive unit tests for the updated logic.Enhancements to license handling:
builder/vmware/common/driver.go
: Added a new constantworkstationNoLicenseVersion
for version 17.6.1, which does not require a license for personal use, and provided notes and references for version changes.builder/vmware/common/driver_workstation_unix.go
: Updated theworkstationCheckLicense
function to skip the license check for versions greater than or equal toworkstationNoLicenseVersion
and added logging for different scenarios.Improvements to test coverage:
builder/vmware/common/driver_workstation_unix_test.go
: Added mock functions and a new testable functiontestableWorkstationCheckLicense
to facilitate unit testing. Implemented multiple test cases to cover various scenarios, including version checks and license file detection.Resolves #242