Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Include resource via new Import resource kind and resolve operation #429

Merged
merged 15 commits into from
May 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add nested test
SteveL-MSFT committed May 4, 2024
commit c31eef39ad204f0f738715a6d55b00170210d51b
48 changes: 48 additions & 0 deletions dsc/tests/dsc_include.tests.ps1
Original file line number Diff line number Diff line change
@@ -131,4 +131,52 @@ Describe 'Include tests' {
}
$out.results[0].result[0].result.actualState.family | Should -Be $expectedOS
}

It 'Multiple includes' {
$echoConfig = @'
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: one
type: Test/Echo
properties:
output: one
'@

$echoConfigPath = Join-Path $TestDrive 'echo.dsc.yaml'
$echoConfig | Set-Content -Path $echoConfigPath

$nestedIncludeConfig = @"
`$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: nested
type: Microsoft.DSC/Include
properties:
configurationFile: $echoConfigPath
"@

$nestedIncludeConfigPath = Join-Path $TestDrive 'nested_include.dsc.yaml'
$nestedIncludeConfig | Set-Content -Path $nestedIncludeConfigPath

$includeConfig = @"
`$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: include
type: Microsoft.DSC/Include
properties:
configurationFile: $echoConfigPath
- name: include nested
type: Microsoft.DSC/Include
properties:
configurationFile: $nestedIncludeConfigPath
"@

$out = $includeConfig | dsc -l trace config get | ConvertFrom-Json
$LASTEXITCODE | Should -Be 0
$out.results[0].result[0].result.actualState.output | Should -Be 'one'
$out.results[1].result[0].name | Should -Be 'nested'
$out.results[1].result[0].type | Should -Be 'Microsoft.DSC/Include'
$out.results[1].result[0].result[0].name | Should -Be 'one'
$out.results[1].result[0].result[0].type | Should -Be 'Test/Echo'
$out.results[1].result[0].result[0].result[0].actualState.output | Should -Be 'one'
}
}