diff --git a/CHANGELOG.md b/CHANGELOG.md index aa6fd6c347..a15539d7e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added integration tests for `Repair-SqlDscServer` command to ensure command + reliability. The test runs in group 8, before `Uninstall-SqlDscServer` in + group 9, to verify the repair functionality on the DSCSQLTEST instance + [issue #2238](https://github.com/dsccommunity/SqlServerDsc/issues/2238). - Added integration tests for `ConvertTo-SqlDscServerPermission` command to ensure command reliability [issue #2207](https://github.com/dsccommunity/SqlServerDsc/issues/2207). - Added post-installation configuration integration test to configure SSL certificate @@ -66,6 +70,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- `Repair-SqlDscServer` + - Removed the `Features` parameter from the command as SQL Server Repair action + does not accept the `/FEATURES` parameter. SQL Server automatically repairs + all installed features when using the Repair action. This fixes the error + "The setting 'FEATURES' is not allowed when the value of setting 'ACTION' + is 'Repair'." that occurred when attempting to repair a SQL Server instance + [issue #2238](https://github.com/dsccommunity/SqlServerDsc/issues/2238). - Corrected error message in test file to recommend 'noop' task instead of 'build' task for resolving dependencies ([issue #2279](https://github.com/dsccommunity/SqlServerDsc/issues/2279)). diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 18b0df8ac1..7cda081556 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -354,7 +354,7 @@ stages: 'tests/Integration/Commands/Disable-SqlDscAgentOperator.Integration.Tests.ps1' 'tests/Integration/Commands/Disable-SqlDscAudit.Integration.Tests.ps1' 'tests/Integration/Commands/Add-SqlDscTraceFlag.Integration.Tests.ps1' - # Group 8 + # Group 7 'tests/Integration/Commands/Remove-SqlDscAgentAlert.Integration.Tests.ps1' 'tests/Integration/Commands/Remove-SqlDscAgentOperator.Integration.Tests.ps1' 'tests/Integration/Commands/Enable-SqlDscAudit.Integration.Tests.ps1' @@ -365,6 +365,8 @@ stages: 'tests/Integration/Commands/Remove-SqlDscRole.Integration.Tests.ps1' 'tests/Integration/Commands/Remove-SqlDscLogin.Integration.Tests.ps1' 'tests/Integration/Commands/Remove-SqlDscTraceFlag.Integration.Tests.ps1' + # Group 8 + 'tests/Integration/Commands/Repair-SqlDscServer.Integration.Tests.ps1' # Group 9 'tests/Integration/Commands/Uninstall-SqlDscServer.Integration.Tests.ps1' ) diff --git a/source/Private/Invoke-SetupAction.ps1 b/source/Private/Invoke-SetupAction.ps1 index 9ee4bc8eb2..be6ba2f5e3 100644 --- a/source/Private/Invoke-SetupAction.ps1 +++ b/source/Private/Invoke-SetupAction.ps1 @@ -421,9 +421,9 @@ Upgrades the instance 'MyInstance' with the SQL Server edition that is provided by the media path. .EXAMPLE - Invoke-SetupAction -Repair -InstanceName 'MyInstance' -Features 'SQLENGINE' -MediaPath 'E:\' + Invoke-SetupAction -Repair -InstanceName 'MyInstance' -MediaPath 'E:\' - Repairs the database engine of the instance 'MyInstance'. + Repairs all installed features of the instance 'MyInstance'. .EXAMPLE Invoke-SetupAction -RebuildDatabase -InstanceName 'MyInstance' -SqlSysAdminAccounts @('MyAdminAccount') -MediaPath 'E:\' @@ -462,6 +462,14 @@ For RebuildDatabase the parameter SAPwd must be set if the instance was installed with SecurityMode = 'SQL'. + + SQL Server Repair action does not accept the FEATURES parameter. Although + Microsoft's documentation lists /FEATURES as required for the Repair action, + the actual SQL Server setup executable (tested with SQL Server 2017 and + SQL Server 2022) rejects this parameter with the error: "The setting + 'FEATURES' is not allowed when the value of setting 'ACTION' is 'Repair'." + SQL Server automatically repairs all installed features during a repair + operation. #> function Invoke-SetupAction { @@ -626,7 +634,6 @@ function Invoke-SetupAction [Parameter(ParameterSetName = 'Install', Mandatory = $true)] [Parameter(ParameterSetName = 'PrepareImage', Mandatory = $true)] - [Parameter(ParameterSetName = 'Repair', Mandatory = $true)] [Parameter(ParameterSetName = 'Uninstall', Mandatory = $true)] [Parameter(ParameterSetName = 'InstallFailoverCluster', Mandatory = $true)] [Parameter(ParameterSetName = 'PrepareFailoverCluster', Mandatory = $true)] diff --git a/source/Public/Repair-SqlDscServer.ps1 b/source/Public/Repair-SqlDscServer.ps1 index 62f5dbf334..a4d6ebd48d 100644 --- a/source/Public/Repair-SqlDscServer.ps1 +++ b/source/Public/Repair-SqlDscServer.ps1 @@ -27,9 +27,6 @@ .PARAMETER Enu See the notes section for more information. - .PARAMETER Features - See the notes section for more information. - .PARAMETER PBEngSvcAccount See the notes section for more information. @@ -55,14 +52,22 @@ None. .EXAMPLE - Repair-SqlDscServer -InstanceName 'MyInstance' -Features 'SQLENGINE' -MediaPath 'E:\' + Repair-SqlDscServer -InstanceName 'MyInstance' -MediaPath 'E:\' - Repairs the database engine of the instance 'MyInstance'. + Repairs all installed features of the instance 'MyInstance'. .NOTES The parameters are intentionally not described since it would take a lot of effort to keep them up to date. Instead there is a link that points to the SQL Server command line setup documentation which will stay relevant. + + SQL Server Repair action does not accept the FEATURES parameter. Although + Microsoft's documentation lists /FEATURES as required for the Repair action, + the actual SQL Server setup executable (tested with SQL Server 2017 and + SQL Server 2022) rejects this parameter with the error: "The setting + 'FEATURES' is not allowed when the value of setting 'ACTION' is 'Repair'." + SQL Server automatically repairs all installed features during a repair + operation. #> function Repair-SqlDscServer { @@ -84,44 +89,6 @@ function Repair-SqlDscServer [System.Management.Automation.SwitchParameter] $Enu, - [Parameter(Mandatory = $true)] - [ValidateSet( - 'SQL', - 'SQLEngine', # Part of parent feature SQL - 'Replication', # Part of parent feature SQL - 'FullText', # Part of parent feature SQL - 'DQ', # Part of parent feature SQL - 'PolyBase', # Part of parent feature SQL - 'PolyBaseCore', # Part of parent feature SQL - 'PolyBaseJava', # Part of parent feature SQL - 'AdvancedAnalytics', # Part of parent feature SQL - 'SQL_INST_MR', # Part of parent feature SQL - 'SQL_INST_MPY', # Part of parent feature SQL - 'SQL_INST_JAVA', # Part of parent feature SQL - 'AS', - 'RS', - 'RS_SHP', - 'RS_SHPWFE', # cspell: disable-line - 'DQC', - 'IS', - 'IS_Master', # Part of parent feature IS - 'IS_Worker', # Part of parent feature IS - 'MDS', - 'SQL_SHARED_MPY', - 'SQL_SHARED_MR', - 'Tools', - 'BC', # Part of parent feature Tools - 'Conn', # Part of parent feature Tools - 'DREPLAY_CTLR', # Part of parent feature Tools (cspell: disable-line) - 'DREPLAY_CLT', # Part of parent feature Tools (cspell: disable-line) - 'SNAC_SDK', # Part of parent feature Tools (cspell: disable-line) - 'SDK', # Part of parent feature Tools - 'LocalDB', # Part of parent feature Tools - 'AZUREEXTENSION' - )] - [System.String[]] - $Features, - [Parameter()] [System.String] $PBEngSvcAccount, diff --git a/tests/Integration/Commands/README.md b/tests/Integration/Commands/README.md index b702dce25b..2d28d66e97 100644 --- a/tests/Integration/Commands/README.md +++ b/tests/Integration/Commands/README.md @@ -35,7 +35,12 @@ a higher run order number than the highest run order of the dependent integration tests. **Below are the integration tests listed in the run order, and with the dependency -to each other. Dependencies are made to speed up the testing.** +to each other. Dependencies are made to speed up the testing. The tests are +organized by Azure Pipeline job.** + +### Integration_Test_Commands_SqlServer + +Tests for SQL Server Database Engine commands. Command | Run order # | Depends on # | Use instance | Creates persistent objects @@ -107,22 +112,50 @@ Disable-SqlDscAgentOperator | 4 | 1 (Install-SqlDscServer), 0 (Prerequisites) | Get-SqlDscAudit | 4 | 1 (Install-SqlDscServer), 0 (Prerequisites) | DSCSQLTEST | - Disable-SqlDscAudit | 4 | 1 (Install-SqlDscServer), 0 (Prerequisites) | DSCSQLTEST | - Add-SqlDscTraceFlag | 4 | 1 (Install-SqlDscServer), 0 (Prerequisites) | DSCSQLTEST | - -Remove-SqlDscAgentAlert | 8 | 4 (New-SqlDscAgentAlert) | DSCSQLTEST | - -Remove-SqlDscAgentOperator | 8 | 4 (New-SqlDscAgentOperator) | DSCSQLTEST | - -Remove-SqlDscAudit | 8 | - | DSCSQLTEST | - -Set-SqlDscAudit | 8 | - | DSCSQLTEST | - -Remove-SqlDscDatabase | 8 | 4 (New-SqlDscDatabase) | DSCSQLTEST | - -Remove-SqlDscRole | 8 | 4 (New-SqlDscRole) | DSCSQLTEST | - -Remove-SqlDscLogin | 8 | 4 (New-SqlDscLogin) | DSCSQLTEST | - -Remove-SqlDscTraceFlag | 8 | 1 (Install-SqlDscServer) | DSCSQLTEST | - -Uninstall-SqlDscServer | 9 | 8 (Remove commands) | - | - +Remove-SqlDscAgentAlert | 7 | 4 (New-SqlDscAgentAlert) | DSCSQLTEST | - +Remove-SqlDscAgentOperator | 7 | 4 (New-SqlDscAgentOperator) | DSCSQLTEST | - +Remove-SqlDscAudit | 7 | - | DSCSQLTEST | - +Set-SqlDscAudit | 7 | - | DSCSQLTEST | - +Remove-SqlDscDatabase | 7 | 4 (New-SqlDscDatabase) | DSCSQLTEST | - +Remove-SqlDscRole | 7 | 4 (New-SqlDscRole) | DSCSQLTEST | - +Remove-SqlDscLogin | 7 | 4 (New-SqlDscLogin) | DSCSQLTEST | - +Remove-SqlDscTraceFlag | 7 | 1 (Install-SqlDscServer) | DSCSQLTEST | - +Repair-SqlDscServer | 8 | 1 (Install-SqlDscServer) | DSCSQLTEST | - +Uninstall-SqlDscServer | 9 | 8 (Repair-SqlDscServer) | - | - + + +### Integration_Test_Commands_ReportingServices + +Tests for SQL Server Reporting Services commands. + + +Command | Run order # | Depends on # | Use instance | Creates persistent objects +--- | --- | --- | --- | --- +Prerequisites | 0 | - | - | Sets up dependencies +Save-SqlDscSqlServerMediaFile | 0 | - | - | Downloads SQL Server media files +Import-SqlDscPreferredModule | 0 | - | - | - Install-SqlDscReportingService | 1 | 0 (Prerequisites) | - | SSRS instance Get-SqlDscInstalledInstance | 2 | 1 (Install-SqlDscReportingService), 0 (Prerequisites) | SSRS | - Get-SqlDscRSSetupConfiguration | 2 | 1 (Install-SqlDscReportingService), 0 (Prerequisites) | SSRS | - Test-SqlDscRSInstalled | 2 | 1 (Install-SqlDscReportingService), 0 (Prerequisites) | SSRS | - Repair-SqlDscReportingService | 8 | 1 (Install-SqlDscReportingService) | SSRS | - Uninstall-SqlDscReportingService | 9 | 8 (Repair-SqlDscReportingService) | - | - + + +### Integration_Test_Commands_BIReportServer + +Tests for Power BI Report Server commands. + + +Command | Run order # | Depends on # | Use instance | Creates persistent objects +--- | --- | --- | --- | --- +Prerequisites | 0 | - | - | Sets up dependencies +Save-SqlDscSqlServerMediaFile | 0 | - | - | Downloads SQL Server media files +Import-SqlDscPreferredModule | 0 | - | - | - Install-SqlDscBIReportServer | 1 | 0 (Prerequisites) | - | PBIRS instance +Get-SqlDscInstalledInstance | 2 | 1 (Install-SqlDscBIReportServer), 0 (Prerequisites) | PBIRS | - +Get-SqlDscRSSetupConfiguration | 2 | 1 (Install-SqlDscBIReportServer), 0 (Prerequisites) | PBIRS | - +Test-SqlDscRSInstalled | 2 | 1 (Install-SqlDscBIReportServer), 0 (Prerequisites) | PBIRS | - Repair-SqlDscBIReportServer | 8 | 1 (Install-SqlDscBIReportServer) | PBIRS | - Uninstall-SqlDscBIReportServer | 9 | 8 (Repair-SqlDscBIReportServer) | - | - diff --git a/tests/Integration/Commands/Repair-SqlDscServer.Integration.Tests.ps1 b/tests/Integration/Commands/Repair-SqlDscServer.Integration.Tests.ps1 new file mode 100644 index 0000000000..f59942d77a --- /dev/null +++ b/tests/Integration/Commands/Repair-SqlDscServer.Integration.Tests.ps1 @@ -0,0 +1,217 @@ +[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Suppressing this rule because Script Analyzer does not understand Pester syntax.')] +param () + +BeforeDiscovery { + try + { + if (-not (Get-Module -Name 'DscResource.Test')) + { + # Assumes dependencies have been resolved, so if this module is not available, run 'noop' task. + if (-not (Get-Module -Name 'DscResource.Test' -ListAvailable)) + { + # Redirect all streams to $null, except the error stream (stream 2) + & "$PSScriptRoot/../../../build.ps1" -Tasks 'noop' 3>&1 4>&1 5>&1 6>&1 > $null + } + + # If the dependencies have not been resolved, this will throw an error. + Import-Module -Name 'DscResource.Test' -Force -ErrorAction 'Stop' + } + } + catch [System.IO.FileNotFoundException] + { + throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks noop" first.' + } +} + +BeforeAll { + $script:moduleName = 'SqlServerDsc' + + Import-Module -Name $script:moduleName -Force -ErrorAction 'Stop' +} + +# cSpell: ignore DSCSQLTEST +Describe 'Repair-SqlDscServer' -Tag @('Integration_SQL2017', 'Integration_SQL2019', 'Integration_SQL2022') { + BeforeAll { + Write-Verbose -Message ('Running integration test as user ''{0}''.' -f $env:UserName) -Verbose + + # Check if SQL Server LocalDB is installed (may be pre-installed on hosted agent) + try + { + Write-Verbose -Message 'Checking for SQL Server LocalDB installations...' -Verbose + $localDbInfo = & sqllocaldb info 2>&1 + if ($LASTEXITCODE -eq 0) + { + Write-Verbose -Message "SQL Server LocalDB is installed. Instances found:" -Verbose + $localDbInfo | ForEach-Object { Write-Verbose -Message " $_" -Verbose } + } + else + { + Write-Verbose -Message 'SQL Server LocalDB is not installed or sqllocaldb.exe is not in PATH.' -Verbose + } + } + catch + { + Write-Verbose -Message "Could not check for LocalDB: $($_.Exception.Message)" -Verbose + } + } + + It 'Should have the named instance SQL Server service running' { + $getServiceResult = Get-Service -Name 'MSSQL$DSCSQLTEST' -ErrorAction 'Stop' + + $getServiceResult.Status | Should -Be 'Running' + } + + It 'Should uninstall SQL Server LocalDB if present to avoid repair conflicts' { + # LocalDB may be pre-installed on hosted agents and cause repair to fail + # because SqlLocalDB.msi is not in our installation media + try + { + Write-Verbose -Message 'Checking if SQL Server LocalDB is installed...' -Verbose + + # Use registry-based detection instead of Win32_Product to avoid MSI consistency checks + $uninstallKeys = @( + 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*', + 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' + ) + + $localDbProducts = Get-ItemProperty -Path $uninstallKeys -ErrorAction SilentlyContinue | + Where-Object { $_.DisplayName -like '*LocalDB*' } + + if ($localDbProducts) + { + foreach ($product in $localDbProducts) + { + Write-Verbose -Message "Uninstalling LocalDB product: $($product.DisplayName) (Product Code: $($product.PSChildName))" -Verbose + + # Uninstall using msiexec with the product code + $uninstallArgs = "/x `"$($product.PSChildName)`" /qn /norestart" + $process = Start-Process -FilePath 'msiexec.exe' -ArgumentList $uninstallArgs -Wait -PassThru + + if ($process.ExitCode -eq 0) + { + Write-Verbose -Message "Successfully uninstalled: $($product.DisplayName)" -Verbose + } + else + { + Write-Warning -Message "Failed to uninstall $($product.DisplayName). Exit code: $($process.ExitCode)" + } + } + } + else + { + Write-Verbose -Message 'No SQL Server LocalDB products found to uninstall.' -Verbose + } + } + catch + { + Write-Warning -Message "Error checking/uninstalling LocalDB: $($_.Exception.Message)" + } + } + + Context 'When repairing a named instance' { + <# + NOTE: This test may fail if the SQL Server installation includes features + for which the installation media does not contain the required MSI files. + For example, if LocalDB is installed but SqlLocalDB.msi is not in the + installation media, the repair will fail with: + "An installation package for the product Microsoft SQL Server 2019 LocalDB + cannot be found. Try the installation again using a valid copy of the + installation package 'SqlLocalDB.msi'." + + This is a limitation of SQL Server's Repair action - it repairs ALL installed + features and requires all MSI files to be present in the installation media. + + This test may also intermittently fail with exit code -2068052310 (0x8424000A). + This appears to be a SQL Server setup behavior where repair completes successfully + but returns a non-zero exit code. The Summary.txt typically shows: + - All features passed + - Warnings: "Service SID support has been enabled on the service" + + The subsequent tests verify the repair was actually successful by checking: + - SQL Server service is running + - Can connect to the instance + If this failure occurs, check the Summary.txt output in the test logs to confirm + the repair actually completed successfully despite the non-zero exit code. + #> + It 'Should run the repair command without throwing' { + # Set splatting parameters for Repair-SqlDscServer + $repairSqlDscServerParameters = @{ + InstanceName = 'DSCSQLTEST' + MediaPath = $env:IsoDrivePath + Verbose = $true + ErrorAction = 'Stop' + Force = $true + } + + try + { + $null = Repair-SqlDscServer @repairSqlDscServerParameters + } + catch + { + # Output Summary.txt if it exists to help diagnose the failure + $summaryFiles = Get-ChildItem -Path 'C:\Program Files\Microsoft SQL Server' -Filter 'Summary.txt' -Recurse -ErrorAction SilentlyContinue | + Where-Object { $_.FullName -match '\\Setup Bootstrap\\Log\\' } | + Sort-Object -Property LastWriteTime -Descending | + Select-Object -First 1 + + if ($summaryFiles) + { + Write-Verbose "==== SQL Server Setup Summary.txt (from $($summaryFiles.FullName)) ====" -Verbose + Get-Content -Path $summaryFiles.FullName | Write-Verbose -Verbose + Write-Verbose "==== End of Summary.txt ====" -Verbose + } + else + { + Write-Verbose 'No Summary.txt file found.' -Verbose + } + + # Check if this is the known LocalDB MSI missing issue + if ($_.Exception.Message -match 'SqlLocalDB\.msi') + { + Write-Warning @' +The repair failed because LocalDB is installed but the SqlLocalDB.msi file is not +available in the installation media. This is a known limitation of SQL Server's +Repair action - it repairs ALL installed features and requires all MSI files to +be present in the installation media. + +Possible solutions: +1. Use installation media that includes SqlLocalDB.msi +2. Uninstall LocalDB before running repair +3. Use a different SQL Server instance that doesn't have LocalDB installed + +This is not a bug in SqlServerDsc but a limitation of SQL Server setup. +'@ + } + + # Re-throw the original error + throw $_ + } + } + + It 'Should still have the named instance SQL Server service running after repair' { + $getServiceResult = Get-Service -Name 'MSSQL$DSCSQLTEST' -ErrorAction 'Stop' + + $getServiceResult | Should -Not -BeNullOrEmpty + $getServiceResult.Status | Should -Be 'Running' + } + + It 'Should be able to connect to the instance after repair' { + $sqlAdministratorUserName = 'SqlAdmin' + $sqlAdministratorPassword = ConvertTo-SecureString -String 'P@ssw0rd1' -AsPlainText -Force + + $connectSqlDscDatabaseEngineParameters = @{ + InstanceName = 'DSCSQLTEST' + Credential = [System.Management.Automation.PSCredential]::new($sqlAdministratorUserName, $sqlAdministratorPassword) + ErrorAction = 'Stop' + } + + $sqlServerObject = Connect-SqlDscDatabaseEngine @connectSqlDscDatabaseEngineParameters + + $sqlServerObject | Should -Not -BeNullOrEmpty + $sqlServerObject.InstanceName | Should -Be 'DSCSQLTEST' + + Disconnect-SqlDscDatabaseEngine -ServerObject $sqlServerObject -ErrorAction 'Stop' + } + } +} diff --git a/tests/Unit/Private/Invoke-SetupAction.Tests.ps1 b/tests/Unit/Private/Invoke-SetupAction.Tests.ps1 index 6d9bdb95b2..65cae4712a 100644 --- a/tests/Unit/Private/Invoke-SetupAction.Tests.ps1 +++ b/tests/Unit/Private/Invoke-SetupAction.Tests.ps1 @@ -97,7 +97,7 @@ Describe 'Invoke-SetupAction' -Tag 'Private' { @{ MockParameterSetName = 'Repair' # cSpell: disable-next - MockExpectedParameters = '-Repair -MediaPath -InstanceName -Features [-Enu] [-PBEngSvcAccount ] [-PBEngSvcPassword ] [-PBEngSvcStartupType ] [-PBStartPortRange ] [-PBEndPortRange ] [-PBScaleOut] [-Timeout ] [-Force] [-WhatIf] [-Confirm] []' + MockExpectedParameters = '-Repair -MediaPath -InstanceName [-Enu] [-PBEngSvcAccount ] [-PBEngSvcPassword ] [-PBEngSvcStartupType ] [-PBStartPortRange ] [-PBEndPortRange ] [-PBScaleOut] [-Timeout ] [-Force] [-WhatIf] [-Confirm] []' } @{ MockParameterSetName = 'RebuildDatabase' @@ -2886,8 +2886,6 @@ Describe 'Invoke-SetupAction' -Tag 'Private' { Repair = $true MediaPath = '\SqlMedia' InstanceName = 'INSTANCE' - # Intentionally using both upper- and lower-case in the value. - Features = 'SqlEngine' } } } @@ -2899,7 +2897,6 @@ Describe 'Invoke-SetupAction' -Tag 'Private' { Should -Invoke -CommandName Start-SqlSetupProcess -ParameterFilter { $ArgumentList | Should -MatchExactly '\/ACTION=Repair' - $ArgumentList | Should -MatchExactly '\/FEATURES=SQLENGINE' $ArgumentList | Should -MatchExactly '\/INSTANCENAME="INSTANCE"' # cspell: disable-line # Return $true if none of the above throw. @@ -2916,7 +2913,6 @@ Describe 'Invoke-SetupAction' -Tag 'Private' { Should -Invoke -CommandName Start-SqlSetupProcess -ParameterFilter { $ArgumentList | Should -MatchExactly '\/ACTION=Repair' - $ArgumentList | Should -MatchExactly '\/FEATURES=SQLENGINE' $ArgumentList | Should -MatchExactly '\/INSTANCENAME="INSTANCE"' # cspell: disable-line # Return $true if none of the above throw. @@ -2948,8 +2944,6 @@ Describe 'Invoke-SetupAction' -Tag 'Private' { Repair = $true MediaPath = '\SqlMedia' InstanceName = 'INSTANCE' - # Intentionally using both upper- and lower-case in the value. - Features = 'SqlEngine' Force = $true PBStartPortRange = 16450 PBEndPortRange = 16460 @@ -3008,8 +3002,6 @@ Describe 'Invoke-SetupAction' -Tag 'Private' { Repair = $true MediaPath = '\SqlMedia' InstanceName = 'INSTANCE' - # Intentionally using both upper- and lower-case in the value. - Features = 'SqlEngine' Force = $true } } diff --git a/tests/Unit/Public/Repair-SqlDscServer.Tests.ps1 b/tests/Unit/Public/Repair-SqlDscServer.Tests.ps1 index 07fa76da42..b268b0ac47 100644 --- a/tests/Unit/Public/Repair-SqlDscServer.Tests.ps1 +++ b/tests/Unit/Public/Repair-SqlDscServer.Tests.ps1 @@ -52,7 +52,7 @@ Describe 'Repair-SqlDscServer' -Tag 'Public' { @{ MockParameterSetName = '__AllParameterSets' # cSpell: disable-next - MockExpectedParameters = '[-MediaPath] [-InstanceName] [-Features] [[-PBEngSvcAccount] ] [[-PBEngSvcPassword] ] [[-PBEngSvcStartupType] ] [[-PBStartPortRange] ] [[-PBEndPortRange] ] [[-Timeout] ] [-Enu] [-PBScaleOut] [-Force] [-WhatIf] [-Confirm] []' + MockExpectedParameters = '[-MediaPath] [-InstanceName] [[-PBEngSvcAccount] ] [[-PBEngSvcPassword] ] [[-PBEngSvcStartupType] ] [[-PBStartPortRange] ] [[-PBEndPortRange] ] [[-Timeout] ] [-Enu] [-PBScaleOut] [-Force] [-WhatIf] [-Confirm] []' } ) { $result = (Get-Command -Name 'Repair-SqlDscServer').ParameterSets | @@ -94,8 +94,6 @@ Describe 'Repair-SqlDscServer' -Tag 'Public' { $mockDefaultParameters = @{ MediaPath = '\SqlMedia' InstanceName = 'INSTANCE' - # Intentionally using both upper- and lower-case in the value. - Features = 'SqlEngine' ErrorAction = 'Stop' } } @@ -106,7 +104,6 @@ Describe 'Repair-SqlDscServer' -Tag 'Public' { Should -Invoke -CommandName Start-SqlSetupProcess -ParameterFilter { $ArgumentList | Should -MatchExactly '\/ACTION=Repair' - $ArgumentList | Should -MatchExactly '\/FEATURES=SQLENGINE' $ArgumentList | Should -MatchExactly '\/INSTANCENAME="INSTANCE"' # cspell: disable-line # Return $true if none of the above throw. @@ -121,7 +118,6 @@ Describe 'Repair-SqlDscServer' -Tag 'Public' { Should -Invoke -CommandName Start-SqlSetupProcess -ParameterFilter { $ArgumentList | Should -MatchExactly '\/ACTION=Repair' - $ArgumentList | Should -MatchExactly '\/FEATURES=SQLENGINE' $ArgumentList | Should -MatchExactly '\/INSTANCENAME="INSTANCE"' # cspell: disable-line # Return $true if none of the above throw. @@ -148,8 +144,6 @@ Describe 'Repair-SqlDscServer' -Tag 'Public' { $repairSqlDscServerParameters = @{ MediaPath = '\SqlMedia' InstanceName = 'INSTANCE' - # Intentionally using both upper- and lower-case in the value. - Features = 'SqlEngine' Force = $true PBStartPortRange = 16450 PBEndPortRange = 16460 @@ -204,8 +198,6 @@ Describe 'Repair-SqlDscServer' -Tag 'Public' { $mockDefaultParameters = @{ MediaPath = '\SqlMedia' InstanceName = 'INSTANCE' - # Intentionally using both upper- and lower-case in the value. - Features = 'SqlEngine' Force = $true ErrorAction = 'Stop' }