From 806ed92f16e391f961d742bf01d9bbeb0dd46563 Mon Sep 17 00:00:00 2001 From: Michael T Lombardi Date: Thu, 10 Dec 2020 18:50:43 -0600 Subject: [PATCH] (MAINT) Ensure changelog actually updates --- CHANGELOG.md | 3 +++ src/functions/New-PuppetDscModule.ps1 | 4 ++++ src/tests/functions/New-PuppetDscModule.Tests.ps1 | 12 ++++++++++++ 3 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8562bdec..f51a17fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - `JoinOU` to the static list of DSC Resource properties which are Puppet parameters ([#107](https://github.com/puppetlabs/Puppet.Dsc/pulls/107)) +## Fixed + +- Ensure changelog is actually updated during module Puppetization ([#108](https://github.com/puppetlabs/Puppet.Dsc/pull/)) ## [0.2.0] - 2020-12-04 diff --git a/src/functions/New-PuppetDscModule.ps1 b/src/functions/New-PuppetDscModule.ps1 index 0647377b..5795ba61 100644 --- a/src/functions/New-PuppetDscModule.ps1 +++ b/src/functions/New-PuppetDscModule.ps1 @@ -120,6 +120,10 @@ Function New-PuppetDscModule { Write-PSFMessage -Message 'Writing the Puppet Module readme' Update-PuppetModuleReadme -PuppetModuleFolderPath $PuppetModuleRootFolderDirectory -PowerShellModuleManifestPath $PowerShellModuleManifestPath + # Write the Puppet module changelog based on PowerShell module + Write-PSFMessage -Message 'Writing the Puppet Module changelog' + Update-PuppetModulechangelog -PuppetModuleFolderPath $PuppetModuleRootFolderDirectory -PowerShellModuleManifestPath $PowerShellModuleManifestPath + # The PowerShell Module path needs to be munged because the Get-DscResource function always and only # checks the PSModulePath for DSC modules; you CANNOT point to a module by path. Write-PSFMessage -Message 'Converting the DSC resources to Puppet types and providers' diff --git a/src/tests/functions/New-PuppetDscModule.Tests.ps1 b/src/tests/functions/New-PuppetDscModule.Tests.ps1 index 10c84a69..8c5520b8 100644 --- a/src/tests/functions/New-PuppetDscModule.Tests.ps1 +++ b/src/tests/functions/New-PuppetDscModule.Tests.ps1 @@ -11,6 +11,7 @@ Describe "New-PuppetDscModule" { Mock Update-PuppetModuleMetadata {} Mock Update-PuppetModuleFixture {} Mock Update-PuppetModuleReadme {} + Mock Update-PuppetModuleChangelog {} Mock Set-PSModulePath {} Mock Get-DscResource { [Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo[]]@( @@ -68,6 +69,12 @@ Describe "New-PuppetDscModule" { $PowerShellModuleManifestPath -match 'import(/|\\)foo\S+(/|\\)foo(/|\\)foo.psd1' } } + It 'Updates the Puppet CHANGELOG based on the PowerShell metadata' { + Assert-MockCalled Update-PuppetModuleChangelog -ParameterFilter { + $PuppetModuleFolderPath -match 'import(/|\\)foo' -and + $PowerShellModuleManifestPath -match 'import(/|\\)foo\S+(/|\\)foo(/|\\)foo.psd1' + } + } It 'Temporarily sets the PSModulePath' { Assert-MockCalled Set-PSModulePath -ParameterFilter { $Path -match 'import(/|\\)foo\S*dsc_resources$' @@ -119,6 +126,7 @@ Describe "New-PuppetDscModule" { Mock Update-PuppetModuleMetadata {} Mock Update-PuppetModuleFixture {} Mock Update-PuppetModuleReadme {} + Mock Update-PuppetModuleChangelog {} Mock Set-PSModulePath {} Mock Get-DscResource { [Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo[]]@( @@ -224,6 +232,7 @@ Describe "New-PuppetDscModule" { Mock Update-PuppetModuleMetadata {} Mock Update-PuppetModuleFixture {} Mock Update-PuppetModuleReadme {} + Mock Update-PuppetModuleChangelog {} Mock Set-PSModulePath {} Mock Get-DscResource {} Mock ConvertTo-PuppetResourceApi {} @@ -270,6 +279,7 @@ Describe "New-PuppetDscModule" { Mock Update-PuppetModuleMetadata {} Mock Update-PuppetModuleFixture {} Mock Update-PuppetModuleReadme {} + Mock Update-PuppetModuleChangelog {} Mock Set-PSModulePath {} Mock Get-DscResource {} Mock ConvertTo-PuppetResourceApi {} @@ -313,6 +323,7 @@ Describe "New-PuppetDscModule" { Mock Update-PuppetModuleMetadata {} Mock Update-PuppetModuleFixture {} Mock Update-PuppetModuleReadme {} + Mock Update-PuppetModuleChangelog {} Mock Set-PSModulePath {} Mock Get-DscResource {} Mock ConvertTo-PuppetResourceApi {} @@ -340,6 +351,7 @@ Describe "New-PuppetDscModule" { Mock Update-PuppetModuleMetadata {} Mock Update-PuppetModuleFixture {} Mock Update-PuppetModuleReadme {} + Mock Update-PuppetModuleChangelog {} Mock Set-PSModulePath {} Mock Get-DscResource {} Mock ConvertTo-PuppetResourceApi {}