MSFT_MsiPackage.Integration.Tests.ps1: Tests fail with: RuntimeException: The variable '$responseStream' cannot be retrieved because it has not been set #142
Description
Details of the scenario you tried and the problem that is occurring
I'm not sure what the full set of conditions that cause this are, but tests have been failing lately in MSFT_MsiPackage.Integration.Tests.ps1 with the below error when trying to connect to a local HTTPS endpoint. It appears that this occurs at least in part when [Net.ServicePointManager]::SecurityProtocol is set to: Ssl3, Tls. The fix appears to be to set SchUseStrongCrypto to 1 on the test machine, which changes [Net.ServicePointManager]::SecurityProtocol to Tls, Tls11, Tls12.
Verbose logs showing the problem
[00:14:42] Executing script C:\projects\psdscresources\Tests\Integration\MSFT_MsiPackage.Integration.Tests.ps1
[00:14:43]
[00:14:43] Describing MSFT_MsiPackage Integration Tests
[00:14:44]
[00:14:44] Context Get-TargetResource
[00:14:44] [+] Should return only basic properties for absent package 403ms
[00:14:45] [+] Should return full package properties for present package without registry check parameters specified 1.16s
[00:14:45]
[00:14:45] Context Test-TargetResource
[00:14:48] [+] Should return correct value when package is absent 2.36s
[00:14:49] [+] Should return correct value when package is present 800ms
[00:14:49]
[00:14:49] Context Set-TargetResource
[00:14:52] [+] Should correctly install and remove a .msi package 3.11s
[00:14:52] [+] Should throw with incorrect product id 318ms
[00:14:56] [+] Should correctly install and remove a package from a HTTP URL 3.41s
[00:15:28] [-] Should correctly install and remove a package from a HTTPS URL 32.54s
[00:15:28] RuntimeException: The variable '$responseStream' cannot be retrieved because it has not been set.
[00:15:28] at Set-TargetResource, C:\projects\psdscresources\DSCResources\MSFT_MsiPackage\MSFT_MsiPackage.psm1: line 262
[00:15:28] at <ScriptBlock>, C:\projects\psdscresources\Tests\Integration\MSFT_MsiPackage.Integration.Tests.ps1: line 230
[00:15:29] [+] Should write to the specified log path 801ms
[00:15:33] [+] Should add space after .MSI installation arguments 3.51s
[00:15:33] [+] Should not check for product installation when rebooted is required 513ms
[00:15:34] [+] Should install package using user credentials when specified 534ms
Suggested solution to the issue
On test machines, set the following keys before executing MsiPackage tests:
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord -ErrorAction Stop
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord -ErrorAction Stop
The operating system the target node is running
OsName : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
PS C:> $PSVersionTable
Name Value
PSVersion 5.1.17763.316
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.316
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used ('dev' if using current dev branch)
dev