Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlAG: unit tests converted to Pester 5 #1987

Merged
merged 9 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix sort to get the latest version
- `Assert-Feature`
- Fixed unit tests.
- SqlAGReplica
- Fix unit test FailedRemoveAvailabilityGroupReplica

### Changed

- SqlAG
- Converted unit test to Pester 5
- DtcSupportEnabled option in Set-TargetResource and TestTargetResource
- SqlServerDsc
- Bump PSResourceGet to v1.0.0 (used when resolving dependencies).
- Update markdown highlights with newly supported keywords.
Expand Down
8 changes: 7 additions & 1 deletion source/DSCResources/DSC_SqlAG/DSC_SqlAG.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,12 @@ function Set-TargetResource
Update-AvailabilityGroup -AvailabilityGroup $availabilityGroup
}

if ( ( $submittedParameters -contains 'DtcSupportEnabled' ) -and ( $sqlMajorVersion -ge 13 ) -and ( $DtcSupportEnabled -ne $availabilityGroup.DtcSupportEnabled ) )
{
$availabilityGroup.DtcSupportEnabled = $DtcSupportEnabled
Update-AvailabilityGroup -AvailabilityGroup $availabilityGroup
}

# Make sure ConnectionModeInPrimaryRole has a value in order to avoid false positive matches when the parameter is not defined
if ( ( $submittedParameters -contains 'ConnectionModeInPrimaryRole' ) -and ( -not [System.String]::IsNullOrEmpty($ConnectionModeInPrimaryRole) ) -and ( $ConnectionModeInPrimaryRole -ne $availabilityGroup.AvailabilityReplicas[$serverObject.DomainInstanceName].ConnectionModeInPrimaryRole ) )
{
Expand Down Expand Up @@ -746,13 +752,13 @@ function Test-TargetResource

<#
Add properties compatible with SQL Server 2016 or later versions
DtcSupportEnabled is enabled at the creation of the Availability Group only, hence it will not be checked in this block
SeedingMode should be checked only in case if New-SqlAvailabilityReplica support the SeedingMode parameter
#>
if ( $sqlMajorVersion -ge 13 )
{
$parametersToCheck += 'BasicAvailabilityGroup'
$parametersToCheck += 'DatabaseHealthTrigger'
$parametersToCheck += 'DtcSupportEnabled'
if ( $getTargetResourceResult.SeedingMode )
{
$parametersToCheck += 'SeedingMode'
Expand Down
Loading
Loading