Closed PlagueHO closed 5 months ago
Integration tests executed correctly on a Windows Server 2019 Hyper-V VM (Gen2) with 2 x Virtual DVDs and 1 x mounted ISO
PS C:\source\StorageDsc> Get-CimInstance -ClassName Win32_CDROMDrive
Caption Drive Manufacturer VolumeName
Microsoft Virtual DVD-ROM E: (Standard CD-ROM drives) Core Microsoft Virtual DVD-ROM Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963} (Standard CD-ROM drives) Microsoft Virtual DVD-ROM Volume{7cf7b888-ddc4-11ee-bc43-00155d018801} (Standard CD-ROM drives)
Drive with volume 7cf7b888-ddc4-11ee-bc43-00155d018801 cannot be managed because of being an Mounted ISO.
PS C:\source\StorageDsc> invoke-pester .\tests\Integration\DSC_OpticalDiskDriveLetter.Integration.Tests.ps1
Pester v4.10.1
Executing all tests in '.\tests\Integration\DSC_OpticalDiskDriveLetter.Integration.Tests.ps1'
Executing script .\tests\Integration\DSC_OpticalDiskDriveLetter.Integration.Tests.ps1
WARNING: This will change your machine environment variable PSModulePath but can be restored by running the command Restore-TestEnvironment.
WARNING: There is no operation running currently. Stop will return without any action.
VERBOSE: Performing the operation "Start-DscConfiguration: SendMetaConfigurationApply" on target "MSFT_DSCLocalConfigurationManager".
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendMetaConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer WIN-PHIJCRM7TQT with user sid S-1-5-21-2623088611-4008297936-2631156863-500.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Set ]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Resource ] [MSFT_DSCMetaConfiguration]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Set ] [MSFT_DSCMetaConfiguration]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Set ] [MSFT_DSCMetaConfiguration] in 0.0160 seconds.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Resource ] [MSFT_DSCMetaConfiguration]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Set ]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Set ] in 0.0930 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Set-DscLocalConfigurationManager finished in 0.291 seconds.
Describing DSC_OpticalDiskDriveLetter_Integration
Context Assign a Drive Letter to an optical drive that is not mounted
[+] Should compile MOF without throwing 83ms
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer WIN-PHIJCRM7TQT with user sid S-1-5-21-2623088611-4008297936-2631156863-500.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Set ]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Resource ] [[OpticalDiskDriveLetter]Integration_Test]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Test ] [[OpticalDiskDriveLetter]Integration_Test]
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-OpticalDiskDriveLetter: Using Get-CimInstance to get the drive letter of optical disk 1 in the
system.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_CDROMDrive'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' can not be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-OpticalDiskDriveLetter: The optical disk 1 is not currently assigned a drive letter.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM
Win32_Volume WHERE DriveLetter = 'F:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Query CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-TargetResource: The optical disk 1 is assigned the drive letter '' but should be 'F:'. Change
required.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Test ] [[OpticalDiskDriveLetter]Integration_Test] in 1.3900 seconds.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Set ] [[OpticalDiskDriveLetter]Integration_Test]
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-OpticalDiskDriveLetter: Using Get-CimInstance to get the drive letter of optical disk 1 in the
system.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_CDROMDrive'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' can not be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-OpticalDiskDriveLetter: The optical disk 1 is not currently assigned a drive letter.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM
Win32_Volume WHERE DeviceId = '\\\\?\\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}\\','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Query CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Set-TargetResource: The optical disk 1 drive letter is '', attempting to set to 'F:'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Modify CimInstance' with following parameters, ''namespaceName' =
root/cimv2,'instance' = Win32_Volume: \\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}\ (DeviceID = "\\?\Volume{65b8c367-ddc4-11ee-bc42-806e...)'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Modify CimInstance' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Set ] [[OpticalDiskDriveLetter]Integration_Test] in 0.1560 seconds.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Resource ] [[OpticalDiskDriveLetter]Integration_Test]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Set ]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Set ] in 2.2500 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 3.463 seconds
[+] Should apply the MOF without throwing 3.53s
VERBOSE: An LCM method call arrived from computer WIN-PHIJCRM7TQT with user sid S-1-5-21-2623088611-4008297936-2631156863-500.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Get ]
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-OpticalDiskDriveLetter: Using Get-CimInstance to get the drive letter of optical disk 1 in the
system.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_CDROMDrive'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' can not be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM
Win32_Volume WHERE DriveLetter = 'F:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Query CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' and assigned drive letter 'F:' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-TargetResource: The optical disk 1 is currently assigned drive letter 'F'.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Get ] [[OpticalDiskDriveLetter]Integration_Test] in 0.1710 seconds.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Get ] in 0.2180 seconds.
[+] Should be able to call Get-DscConfiguration without throwing 1.36s
[+] Should have set the resource and all the parameters should match 518ms
Context Assign a Drive Letter to an optical drive that is already mounted
[+] Should compile the MOF without throwing 88ms
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer WIN-PHIJCRM7TQT with user sid S-1-5-21-2623088611-4008297936-2631156863-500.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Set ]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Resource ] [[OpticalDiskDriveLetter]Integration_Test]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Test ] [[OpticalDiskDriveLetter]Integration_Test]
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-OpticalDiskDriveLetter: Using Get-CimInstance to get the drive letter of optical disk 1 in the
system.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_CDROMDrive'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' can not be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM
Win32_Volume WHERE DriveLetter = 'F:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Query CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' and assigned drive letter 'F:' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM
Win32_Volume WHERE DriveLetter = 'G:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Query CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-TargetResource: The optical disk 1 is assigned the drive letter 'F:' but should be 'G:'. Change
required.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Test ] [[OpticalDiskDriveLetter]Integration_Test] in 0.1090 seconds.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Set ] [[OpticalDiskDriveLetter]Integration_Test]
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-OpticalDiskDriveLetter: Using Get-CimInstance to get the drive letter of optical disk 1 in the
system.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_CDROMDrive'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' can not be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM
Win32_Volume WHERE DriveLetter = 'F:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Query CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' and assigned drive letter 'F:' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM
Win32_Volume WHERE DriveLetter = 'F:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Query CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Set-TargetResource: The optical disk 1 drive letter is 'F:', attempting to set to 'G:'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Modify CimInstance' with following parameters, ''namespaceName' =
root/cimv2,'instance' = Win32_Volume: F:\ (DeviceID = "\\?\Volume{65b8c367-ddc4-11ee-bc42-806e...)'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Modify CimInstance' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Set ] [[OpticalDiskDriveLetter]Integration_Test] in 0.1410 seconds.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Resource ] [[OpticalDiskDriveLetter]Integration_Test]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Set ]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Set ] in 0.3130 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 2.394 seconds
[+] Should apply the MOF without throwing 2.45s
VERBOSE: An LCM method call arrived from computer WIN-PHIJCRM7TQT with user sid S-1-5-21-2623088611-4008297936-2631156863-500.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Get ]
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-OpticalDiskDriveLetter: Using Get-CimInstance to get the drive letter of optical disk 1 in the
system.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_CDROMDrive'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' can not be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM
Win32_Volume WHERE DriveLetter = 'G:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Query CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' and assigned drive letter 'G:' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-TargetResource: The optical disk 1 is currently assigned drive letter 'G'.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Get ] [[OpticalDiskDriveLetter]Integration_Test] in 0.0940 seconds.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Get ] in 0.1250 seconds.
[+] Should be able to call Get-DscConfiguration without throwing 1.38s
[+] Should have set the resource and all the parameters should match 539ms
Context Remove a Drive Letter from an optical drive that is already mounted
[+] Should compile the MOF without throwing 92ms
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer WIN-PHIJCRM7TQT with user sid S-1-5-21-2623088611-4008297936-2631156863-500.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Set ]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Resource ] [[OpticalDiskDriveLetter]Integration_Test]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Test ] [[OpticalDiskDriveLetter]Integration_Test]
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-OpticalDiskDriveLetter: Using Get-CimInstance to get the drive letter of optical disk 1 in the
system.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_CDROMDrive'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' can not be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM
Win32_Volume WHERE DriveLetter = 'G:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Query CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' and assigned drive letter 'G:' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-TargetResource: The optical disk 1 is assigned the drive letter 'G:' which should be removed.
Change required.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Test ] [[OpticalDiskDriveLetter]Integration_Test] in 0.1410 seconds.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Set ] [[OpticalDiskDriveLetter]Integration_Test]
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-OpticalDiskDriveLetter: Using Get-CimInstance to get the drive letter of optical disk 1 in the
system.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_CDROMDrive'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' can not be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM
Win32_Volume WHERE DriveLetter = 'G:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Query CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' and assigned drive letter 'G:' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM
Win32_Volume WHERE DriveLetter = 'G:','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Query CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Set-TargetResource: The optical disk 1 drive letter is 'G:', attempting to remove it.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Modify CimInstance' with following parameters, ''namespaceName' =
root/cimv2,'instance' = Win32_Volume: G:\ (DeviceID = "\\?\Volume{65b8c367-ddc4-11ee-bc42-806e...)'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Modify CimInstance' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Set ] [[OpticalDiskDriveLetter]Integration_Test] in 0.1250 seconds.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Resource ] [[OpticalDiskDriveLetter]Integration_Test]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Set ]
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Set ] in 0.3590 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 2.689 seconds
[+] Should apply the MOF without throwing 2.76s
VERBOSE: An LCM method call arrived from computer WIN-PHIJCRM7TQT with user sid S-1-5-21-2623088611-4008297936-2631156863-500.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ Start Get ]
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-OpticalDiskDriveLetter: Using Get-CimInstance to get the drive letter of optical disk 1 in the
system.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_CDROMDrive'.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b3f0-ddc4-11ee-bc43-00155d018801}' can not be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{65b8c367-ddc4-11ee-bc42-806e6f6e6963}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: Testing if the optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' and without a drive letter assigned can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Test-OpticalDiskCanBeManaged: The optical disk with Device Id
'\\?\Volume{7cf7b888-ddc4-11ee-bc43-00155d018801}' can be managed by this resource.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Operation 'Enumerate CimInstances' complete.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-OpticalDiskDriveLetter: The optical disk 1 is not currently assigned a drive letter.
VERBOSE: [WIN-PHIJCRM7TQT]: [[OpticalDiskDriveLetter]Integration_Test] Get-TargetResource: The optical disk 1 is not currently assigned a drive letter.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Get ] [[OpticalDiskDriveLetter]Integration_Test] in 0.1090 seconds.
VERBOSE: [WIN-PHIJCRM7TQT]: LCM: [ End Get ] in 0.1560 seconds.
[+] Should be able to call Get-DscConfiguration without throwing 1.29s
[+] Should have set the resource and all the parameters should match 503ms
WARNING: There is no operation running currently. Stop will return without any action.
Tests completed in 16.77s
Tests Passed: 12, Failed: 0, Skipped: 0, Pending: 0, Inconclusive: 0
PS C:\source\StorageDsc>
Attention: Patch coverage is 95.45455%
with 1 lines
in your changes are missing coverage. Please review.
Project coverage is 95%. Comparing base (
a87725b
) to head (338f709
).
We could add the functions (e.g. Test-OpticalDiskCanBeManaged
) that is part of the resource as public commands so it possible to use them standalone. But that can be a future PR.
I started using that pattern in SqlServerDsc and will do that in future PRs in other modules as well. See private and public functions in SqlServerDsc, and I also recently fixed so they are auto-documented in the wiki (using DscResource.DocGenerator), see the "tree" (that is also automatically built) to the right in the SqlServerDsc wiki.
Using this pattern it so much simpler testing the code practically as I can use the commands to verify the functionality without the need to run LCM or Invoke-DscResource
, then adding them to a DSC resource is just another layer.
I should make blog post in dscommunity.org about the new DocGenerator functionality but haven't gotten around to it yet. It should also be added to the dsccommunity
-template in Sampler. 🤔
Awesome! Thanks @johlju - That is a great idea about moving the functions to be public. I'll add an issue to track.
Pull Request (PR) description
This PR fixes #285 by reworking the method of detecting whether an optical disk drive can be managed by this resource. The previous method of detection was unreliable. The new method of detection is described in the README.md:
Detection of Manageable Optical Disk Drives
This resource is intended to manage permanent optical disk drives that are either physically present in the system or are presented to the system by hypervisors or other virtualization platforms. It is not intended to be used to manage temporary optical disk drives that are created when mounting ISOs on Windows Server 2012 and newer. Mounted ISO drives should be managed by the
DSC_MountImage
resource.To detect whether a drive is a mounted ISO the following logic is used. For a CIM instance of a
cimv2:Win32_CDROMDrive
class representing an optical disk drive:cimv2:Win32_CDROMDrive
. If the drive letter is set, query the volume information using the`cimv2:Win32_Volume
CIM class for the device using drive letter and get the device path.drive
property.Get-DiskImage
cmdlet.The PR also makes some changes to the CI pipeline to resolve a known packaging issue on Linux. Also corrected a problem with Unit tests weren't being executed on a Windows Server 2022 host (only Windows Server 2019).
This Pull Request (PR) fixes the following issues
Task list
@johlju - apologies for the size of this one. I reworked the tests a bit to clean them up and make them clearer, which resulted in a lot of line changes.
Running the integration tests is being done on Hyper-V VMs and Azure VMs and will post results here as well.
This change is![Reviewable](https://reviewable.io/review_button.svg)