File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ # Example configuration mixing native app resources with classic PS resources
2+ $schema : https://aka.ms/dsc/schemas/v3/bundled/config/document.json
3+ resources :
4+ - name : Use PS script
5+ type : Microsoft.DSC.Transitional/PowerShellScript
6+ properties :
7+ getScript : |
8+ Write-Warning "This is a warning message"
9+ # any output will be collected and returned
10+ $PSVersionTable
Original file line number Diff line number Diff line change @@ -255,4 +255,13 @@ Describe 'Tests for PSScript resource' {
255255 $result.actualState.output.Count | Should - Be 0 - Because ($result | ConvertTo-Json | Out-String )
256256 (Get-Content $TestDrive / error.txt - Raw) | Should - BeLike ' *ERROR*:*This is an exception*'
257257 }
258+
259+ It ' Sample config works' {
260+ $configPath = Join-Path $PSScriptRoot ' ../../dsc/examples/psscript.dsc.yaml'
261+ $result = dsc config get -f $configPath 2> $TestDrive / error.txt | ConvertFrom-Json - Depth 10
262+ $LASTEXITCODE | Should - Be 0 - Because (Get-Content $TestDrive / error.txt - Raw | Out-String )
263+ $result.results [0 ].result.actualState.output.Count | Should - Be 1 - Because ($result | ConvertTo-Json - Depth 10 | Out-String )
264+ $result.results [0 ].result.actualState.output[0 ].PSEdition | Should - BeExactly ' Core'
265+ $result.results [0 ].result.actualState.output[0 ].PSVersion.Major | Should - Be 7
266+ }
258267}
You can’t perform that action at this time.
0 commit comments