Skip to content

Commit

Permalink
SqlRSSetup: Fix EditionUpgrade set to $false (#1665)
Browse files Browse the repository at this point in the history
- SqlRSSetup
  - If parameter `EditionUpgrade` is set to `$false` the `/EditionUpgrade`
    argument is no longer wrongly added (issue #1398).
  • Loading branch information
johlju authored Jan 6, 2021
1 parent 5758153 commit be1f7ce
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
Expand Down
7 changes: 5 additions & 2 deletions source/DSCResources/DSC_SqlRSSetup/DSC_SqlRSSetup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down
27 changes: 27 additions & 0 deletions tests/Unit/DSC_SqlRSSetup.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit be1f7ce

Please sign in to comment.