dsccommunity / SqlServerDsc

This module contains DSC resources for deployment and configuration of Microsoft SQL Server.
MIT License
360 stars 227 forks source link

SqlAGReplica: `Get-TargetResource` does not return key properties when absent #1822

Closed johlju closed 1 year ago

johlju commented 1 year ago

Problem description

The resource does not return the key properties of Name and AvailabilityGorupName when the current state is Absent. This result in unneccassry logic in Test-TargetResource.

https://github.com/dsccommunity/SqlServerDsc/blob/d5692e24b3b6303556729639cbb0b2a6763198af/source/DSCResources/DSC_SqlAGReplica/DSC_SqlAGReplica.psm1#L675-L676

Verbose logs

Found when converting unit tests to Pester 5.

DSC configuration

Not available

Suggested solution

The key properties Name and AvailabilityGorupName should always be returned from the Get-TargetResource. Test-TargetResource should not evaluate those two properties.

SQL Server edition and version

n/a

SQL Server PowerShell modules

n/a

Operating system

n/a

PowerShell version

n/a

SqlServerDsc version

main branch