Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion dsc/tests/dsc_export.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}

Expand Down
7 changes: 6 additions & 1 deletion dsc_lib/src/configure/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions powershell-adapter/Tests/powershellgroup.resource.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading