Skip to content

Commit

Permalink
Merge pull request #553 from SteveL-MSFT/echo
Browse files Browse the repository at this point in the history
Change `Echo` test resource to `Microsoft.DSC.Debug/Echo` resource
  • Loading branch information
SteveL-MSFT authored Sep 20, 2024
2 parents 097350b + b844974 commit 2539e64
Show file tree
Hide file tree
Showing 27 changed files with 471 additions and 80 deletions.
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"rust-analyzer.linkedProjects": [
"./dsc/Cargo.toml",
"./dsc_lib/Cargo.toml",
"./echo/Cargo.toml",
"./osinfo/Cargo.toml",
"./registry/Cargo.toml",
"./runcommandonset/Cargo.toml",
Expand All @@ -21,5 +22,8 @@
"schemas/2024/04/bundled/config/document.vscode.json": "**.dsc.{yaml,yml,config.yaml,config.yml}",
"schemas/2024/04/bundled/resource/manifest.vscode.json": "**.dsc.resource.{yaml,yml}"
},
"sarif-viewer.connectToGithubCodeScanning": "off"
"sarif-viewer.connectToGithubCodeScanning": "off",
"vscode-nmake-tools.workspaceBuildDirectories": [
"."
]
}
7 changes: 7 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ if ($GetPackageVersion) {

$filesForWindowsPackage = @(
'dsc.exe',
'dscecho.exe',
'echo.dsc.resource.json',
'assertion.dsc.resource.json',
'group.dsc.resource.json',
'powershell.dsc.resource.json',
Expand All @@ -45,6 +47,8 @@ $filesForWindowsPackage = @(

$filesForLinuxPackage = @(
'dsc',
'dscecho',
'echo.dsc.resource.json',
'assertion.dsc.resource.json',
'apt.dsc.resource.json',
'apt.dsc.resource.sh',
Expand All @@ -57,6 +61,8 @@ $filesForLinuxPackage = @(

$filesForMacPackage = @(
'dsc',
'dscecho',
'echo.dsc.resource.json',
'assertion.dsc.resource.json',
'brew.dsc.resource.json',
'brew.dsc.resource.sh',
Expand Down Expand Up @@ -209,6 +215,7 @@ if (!$SkipBuild) {
"security_context_lib",
"dsc_lib",
"dsc",
"dscecho",
"osinfo",
"powershell-adapter",
"process",
Expand Down
10 changes: 5 additions & 5 deletions dsc/examples/groups.dsc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ resources:
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: Last
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: Last
dependsOn:
Expand All @@ -21,7 +21,7 @@ resources:
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: First
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: First
- name: Nested Group
Expand All @@ -30,12 +30,12 @@ resources:
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: Nested Second
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: Nested Second
dependsOn:
- "[resourceId('Test/Echo','Nested First')]"
- "[resourceId('Microsoft.DSC.Debug/Echo','Nested First')]"
- name: Nested First
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: Nested First
4 changes: 2 additions & 2 deletions dsc/examples/multiline.dsc.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: test multi-line
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: |
This is a
'multi-line'
string.
- name: test single-quote escaping
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "[concat('This is a single-quote: ', '''')]"
2 changes: 1 addition & 1 deletion dsc/examples/osinfo_parameters.dsc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ resources:
properties:
family: macOS
- name: path
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "[envvar('PATH')]"
2 changes: 1 addition & 1 deletion dsc/examples/reference.dsc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resources:
type: Microsoft/OSInfo
properties: {}
- name: Echo
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "[concat('The OS is ', reference(resourceId('Microsoft/OSInfo','os')).actualState.family)]"
dependsOn:
Expand Down
4 changes: 2 additions & 2 deletions dsc/examples/secure_parameters.dsc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ parameters:
type: secureObject
resources:
- name: Echo 1
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "[parameters('myString')]"
- name: Echo 2
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "[parameters('myObject').myProperty]"
2 changes: 1 addition & 1 deletion dsc/examples/variables.dsc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ variables:
test: baz
resources:
- name: test
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "[concat('myOutput is: ', variables('myOutput'), ', myObject is: ', variables('myObject').test)]"
2 changes: 1 addition & 1 deletion dsc/tests/dsc_args.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Describe 'config argument tests' {
'@ }
) {
param($text)
$output = $text | dsc resource get -r Test/Echo
$output = $text | dsc resource get -r Microsoft.DSC.Debug/Echo
$output = $output | ConvertFrom-Json
$output.actualState.output | Should -BeExactly 'Hello There'
}
Expand Down
4 changes: 2 additions & 2 deletions dsc/tests/dsc_config_get.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ Describe 'dsc config get tests' {
`$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: Echo
type: test/echo
type: Microsoft.DSC.Debug/Echo
properties:
output: hello
"@
$result = $config_yaml | dsc config get --format pretty-json | ConvertFrom-Json
$result.hadErrors | Should -BeFalse
$result.results.Count | Should -Be 1
$result.results[0].Name | Should -Be 'Echo'
$result.results[0].type | Should -BeExactly 'test/echo'
$result.results[0].type | Should -BeExactly 'Microsoft.DSC.Debug/Echo'
$result.results[0].result.actualState.output | Should -Be 'hello'
$result.metadata.'Microsoft.DSC'.version | Should -BeLike '3.*'
$result.metadata.'Microsoft.DSC'.operation | Should -BeExactly 'Get'
Expand Down
4 changes: 2 additions & 2 deletions dsc/tests/dsc_expressions.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ parameters:
value: 3
resources:
- name: echo
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "$text"
"@
Expand All @@ -58,7 +58,7 @@ resources:
`$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: echo
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "$expression"
"@
Expand Down
2 changes: 1 addition & 1 deletion dsc/tests/dsc_functions.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Describe 'tests for function expressions' {
`$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: Echo
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '$escapedText'
"@
Expand Down
8 changes: 4 additions & 4 deletions dsc/tests/dsc_group.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ results:
Microsoft.DSC:
duration: *
name: First
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output: First
Expand All @@ -40,15 +40,15 @@ results:
Microsoft.DSC:
duration: *
name: Nested First
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output: Nested First
- metadata:
Microsoft.DSC:
duration: *
name: Nested Second
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output: Nested Second
Expand All @@ -62,7 +62,7 @@ results:
Microsoft.DSC:
duration: *
name: Last
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output: Last
Expand Down
8 changes: 4 additions & 4 deletions dsc/tests/dsc_include.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Describe 'Include tests' {
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: one
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: one
'@
Expand Down Expand Up @@ -171,7 +171,7 @@ resources:
$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.actualState.name | Should -Be 'one'
$out.results[1].result[0].result.actualState.type | Should -Be 'Test/Echo'
$out.results[1].result[0].result.actualState.type | Should -Be 'Microsoft.DSC.Debug/Echo'
$out.results[1].result[0].result.actualState.result.actualState.output | Should -Be 'one'
}

Expand All @@ -180,7 +180,7 @@ resources:
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: one
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: Hello World
'@
Expand All @@ -204,7 +204,7 @@ resources:
$out = dsc config set -d $includeConfig | ConvertFrom-Json
$LASTEXITCODE | Should -Be 0
$out.results[0].result.beforeState[0].name | Should -Be 'one'
$out.results[0].result.beforeState[0].type | Should -Be 'Test/Echo'
$out.results[0].result.beforeState[0].type | Should -Be 'Microsoft.DSC.Debug/Echo'
$out.results[0].result.afterState[0].result.afterState.output | Should -Be 'Hello World'
$out.hadErrors | Should -Be $false
}
Expand Down
24 changes: 12 additions & 12 deletions dsc/tests/dsc_parameters.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Describe 'Parameters tests' {
type: string
resources:
- name: Echo
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '[parameters(''param1'')]'
"@
Expand Down Expand Up @@ -49,7 +49,7 @@ Describe 'Parameters tests' {
type: $type
resources:
- name: Echo
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '[parameters(''param1'')]'
"@
Expand All @@ -75,7 +75,7 @@ Describe 'Parameters tests' {
type: $type
resources:
- name: Echo
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '[parameters(''param1'')]'
"@
Expand Down Expand Up @@ -103,7 +103,7 @@ Describe 'Parameters tests' {
maxLength: 3
resources:
- name: Echo
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '[parameters(''param1'')]'
"@
Expand All @@ -130,7 +130,7 @@ Describe 'Parameters tests' {
maxValue: $max
resources:
- name: Echo
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '[parameters(''param1'')]'
"@
Expand All @@ -155,7 +155,7 @@ Describe 'Parameters tests' {
allowedValues: $($allowed | ConvertTo-Json -Compress)
resources:
- name: Echo
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '[parameters(''param1'')]'
"@
Expand All @@ -182,7 +182,7 @@ Describe 'Parameters tests' {
${constraint}: 3
resources:
- name: Echo
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '[parameters(''param1'')]'
"@
Expand Down Expand Up @@ -211,19 +211,19 @@ Describe 'Parameters tests' {
defaultValue: ['hello', 'world']
resources:
- name: String
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '[parameters(''paramString'')]'
- name: Int
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '[parameters(''paramInt'')]'
- name: Bool
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '[parameters(''paramBool'')]'
- name: Array
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '[parameters(''paramArray'')]'
"@
Expand Down Expand Up @@ -299,7 +299,7 @@ Describe 'Parameters tests' {
type: $type
resources:
- name: Echo
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: '[parameters(''param'')]'
"@
Expand Down
2 changes: 1 addition & 1 deletion dsc/tests/dsc_schema.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Describe 'config schema tests' {
}

It 'can accept the use of --format as a subcommand' {
$schema = dsc resource schema -r Test/Echo -f pretty-json
$schema = dsc resource schema -r Microsoft.DSC.Debug/Echo -f pretty-json
$LASTEXITCODE | Should -Be 0
$schema | Should -Not -BeNullOrEmpty
$schema = $schema | ConvertFrom-Json
Expand Down
2 changes: 1 addition & 1 deletion dsc/tests/dsc_test.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Describe 'resource test tests' {
}

It 'can accept the use of --format as a subcommand' {
$null = "output: hello" | dsc resource test -r Test/Echo --format pretty-json
$null = "output: hello" | dsc resource test -r Microsoft.DSC.Debug/Echo --format pretty-json
$LASTEXITCODE | Should -Be 0
}
}
4 changes: 2 additions & 2 deletions dsc/tests/dsc_variables.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ variables:
myVariable: bar
resources:
- name: test
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "[variables('myVariable')]"
'@
Expand All @@ -34,7 +34,7 @@ variables:
hello: world
resources:
- name: test
type: Test/Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "[variables('myVariable')]"
'@
Expand Down
Loading

0 comments on commit 2539e64

Please sign in to comment.