PowerShell / DscResource.Template

MIT License
10 stars 15 forks source link

Using .json with Integration tests does not work #28

Open johlju opened 5 years ago

johlju commented 5 years ago

There is an option to use a .json file for the ConfigurationData-block.

https://github.com/PowerShell/DscResource.Template/blob/8425a135a165e4e13b5899216ebdc5acdb7477a8/Tests/Integration/integration_test_template.config.ps1#L22-L30

The problem is that this conversion returns a [PSCustomObject] instead of [Hashtable] which result in Start-DscConfiguration fails when it tries to convert [PSCustomObject] to [Hashtable] for the parameter ConfigurationData.

There is a solution in PowerShell 6.2 where ConvertFrom-Json has a parameter -AsHashtable. It does not help us so much. So work around this I think we need to convert the .json file to hashtable, or use a .psd1 file instead if that can be imported as a hashtable. Not looked in to any solution, just figure I submit an issue will memory is fresh. 🙂