Skip to content
Merged
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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).
Comment thread
johlju marked this conversation as resolved.
- 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)).
Expand Down
4 changes: 3 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
)
Expand Down
13 changes: 10 additions & 3 deletions source/Private/Invoke-SetupAction.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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:\'
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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)]
Expand Down
53 changes: 10 additions & 43 deletions source/Public/Repair-SqlDscServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
{
Expand All @@ -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,
Expand Down
53 changes: 43 additions & 10 deletions tests/Integration/Commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<!-- markdownlint-disable MD013 -->
Command | Run order # | Depends on # | Use instance | Creates persistent objects
Expand Down Expand Up @@ -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) | - | -
<!-- markdownlint-enable MD013 -->

### Integration_Test_Commands_ReportingServices

Tests for SQL Server Reporting Services commands.

<!-- markdownlint-disable MD013 -->
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) | - | -
<!-- markdownlint-enable MD013 -->

### Integration_Test_Commands_BIReportServer

Tests for Power BI Report Server commands.

<!-- markdownlint-disable MD013 -->
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) | - | -
<!-- markdownlint-enable MD013 -->
Expand Down
Loading