diff --git a/CHANGELOG.md b/CHANGELOG.md index 28b913221..a43191190 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - When the SqlSetup detects that the expected components was not installed and consequently throws an exception, that exception message now presents a link to an article on how to find the SQL Server setup logs ([issue #1420](https://github.com/dsccommunity/SqlServerDsc/issues/1420)). +- SqlRSSetup + - If parameter `EditionUpgrade` is set to `$false` the `/EditionUpgrade` + argument is no longer wrongly added ([issue #1398](https://github.com/dsccommunity/SqlServerDsc/issues/1398)). - SqlServerDsc.Common - Updated `Get-ServerProtocolObject`, helper function to ensure an exception is thrown if the specified instance cannot be obtained ([issue #1628](https://github.com/dsccommunity/SqlServerDsc/issues/1628)). diff --git a/source/DSCResources/DSC_SqlRSSetup/DSC_SqlRSSetup.psm1 b/source/DSCResources/DSC_SqlRSSetup/DSC_SqlRSSetup.psm1 index b00e013c8..3fa01b354 100644 --- a/source/DSCResources/DSC_SqlRSSetup/DSC_SqlRSSetup.psm1 +++ b/source/DSCResources/DSC_SqlRSSetup/DSC_SqlRSSetup.psm1 @@ -404,8 +404,11 @@ function Set-TargetResource 'EditionUpgrade' { - $setupArguments += @{ - 'EditionUpgrade' = [System.Management.Automation.SwitchParameter] $true + if ($EditionUpgrade -eq $true) + { + $setupArguments += @{ + 'EditionUpgrade' = [System.Management.Automation.SwitchParameter] $true + } } } diff --git a/tests/Unit/DSC_SqlRSSetup.Tests.ps1 b/tests/Unit/DSC_SqlRSSetup.Tests.ps1 index 3b9c0fd15..29eeb5c82 100644 --- a/tests/Unit/DSC_SqlRSSetup.Tests.ps1 +++ b/tests/Unit/DSC_SqlRSSetup.Tests.ps1 @@ -652,6 +652,33 @@ try } } + Context 'When Reporting Services are installed with parameters EditionUpgrade set to $false' { + BeforeEach { + $mockSetTargetResourceParameters['ProductKey'] = $mockProductKey + $mockSetTargetResourceParameters['EditionUpgrade'] = $false + + $mockStartSqlSetupProcess_ExpectedArgumentList = @{ + Quiet = [System.Management.Automation.SwitchParameter] $true + IAcceptLicenseTerms = [System.Management.Automation.SwitchParameter] $true + PID = $mockProductKey + } + + Mock -CommandName Start-SqlSetupProcess -MockWith { + Test-SetupArgument -Argument $ArgumentList -ExpectedArgument $mockStartSqlSetupProcess_ExpectedArgumentList + + return 0 + } + } + + It 'Should call the correct mocks' { + { Set-TargetResource @mockSetTargetResourceParameters } | Should -Not -Throw + + Assert-MockCalled -CommandName Start-SqlSetupProcess -ParameterFilter { + $FilePath -eq $mockSetTargetResourceParameters.SourcePath + } -Exactly -Times 1 -Scope 'It' + } + } + Context 'When Reporting Services are installed using parameter SourceCredential' { BeforeAll { $mockLocalPath = 'C:\LocalPath'