diff --git a/dsc/tests/dsc_export.tests.ps1 b/dsc/tests/dsc_export.tests.ps1 index 78a8aa5d3..ab7aa6f15 100644 --- a/dsc/tests/dsc_export.tests.ps1 +++ b/dsc/tests/dsc_export.tests.ps1 @@ -42,6 +42,7 @@ Describe 'resource export tests' { $config_with_process_list.metadata.'Microsoft.DSC'.operation | Should -BeExactly 'export' # contentVersion on export is always 1.0.0 $config_with_process_list.contentVersion | Should -BeExactly '1.0.0' + $config_with_process_list.resources.name | Should -BeLike 'Process-*' } It 'Configuration Export can be piped to configuration Set' -Skip:(!$IsWindows) { @@ -74,7 +75,7 @@ Describe 'resource export tests' { properties: pid: 0 '@ - $out = $yaml | dsc config export -f - 2>&1 + $null = $yaml | dsc config export -f - 2>&1 $LASTEXITCODE | Should -Be 0 } diff --git a/dsc_lib/src/configure/mod.rs b/dsc_lib/src/configure/mod.rs index c6a3f344f..e68599157 100644 --- a/dsc_lib/src/configure/mod.rs +++ b/dsc_lib/src/configure/mod.rs @@ -81,7 +81,12 @@ pub fn add_resource_export_results_to_configuration(resource: &DscResource, conf .map(std::string::ToString::to_string) .ok_or_else(|| DscError::Parser(t!("configure.mod.propertyNotString", name = "_name", value = name).to_string()))? } else { - format!("{}-{i}", r.resource_type) + let resource_type_short = if let Some(pos) = resource.type_name.find('/') { + &resource.type_name[pos + 1..] + } else { + &resource.type_name + }; + format!("{resource_type_short}-{i}") }; let mut metadata = Metadata { microsoft: None, diff --git a/powershell-adapter/Tests/powershellgroup.resource.tests.ps1 b/powershell-adapter/Tests/powershellgroup.resource.tests.ps1 index ca90bb094..4fd12b4e4 100644 --- a/powershell-adapter/Tests/powershellgroup.resource.tests.ps1 +++ b/powershell-adapter/Tests/powershellgroup.resource.tests.ps1 @@ -304,10 +304,10 @@ Describe 'PowerShell adapter resource tests' { $resources = $r | ConvertFrom-Json $resources.resources.count | Should -Be 2 $resources.resources[0].type | Should -BeExactly 'Test/TestCase' - $resources.resources[0].name | Should -BeExactly 'Test/TestCase-0' + $resources.resources[0].name | Should -BeExactly 'TestCase-0' $resources.resources[0].properties.TestCaseId | Should -Be 1 $resources.resources[1].type | Should -BeExactly 'Test/TestCase' - $resources.resources[1].name | Should -BeExactly 'Test/TestCase-1' + $resources.resources[1].name | Should -BeExactly 'TestCase-1' $resources.resources[1].properties.TestCaseId | Should -Be 2 } finally {