Skip to content
This repository was archived by the owner on Feb 24, 2021. It is now read-only.
This repository was archived by the owner on Feb 24, 2021. It is now read-only.

Using .json with Integration tests does not work #28

@johlju

Description

@johlju

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

if (Test-Path -Path $configFile)
{
<#
TODO: Allows reading the configuration data from a JSON file,
e.g. integration_template.config.json for real testing
scenarios outside of the CI.
#>
$ConfigurationData = Get-Content -Path $configFile | ConvertFrom-Json
}

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. 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions