From 8b20a79c39e3abfe84c97097fdb8579bd5f86e74 Mon Sep 17 00:00:00 2001 From: Claudio Spizzi Date: Mon, 2 Sep 2019 13:04:50 +0200 Subject: [PATCH 1/3] Fixed: Ignore UseRootHint in xDnsServerForwarder test function if it was not specified in the resource --- .../MSFT_xDnsServerForwarder.psm1 | 8 ++++++-- README.md | 3 +++ Tests/Unit/MSFT_xDnsServerForwarder.Tests.ps1 | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 b/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 index 1b06bdb7..4858b976 100644 --- a/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 +++ b/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 @@ -91,8 +91,12 @@ function Test-TargetResource return $false } } - if($currentConfiguration.UseRootHint -ne $UseRootHint){ - return $false + if ($PSBoundParameters.ContainsKey('UseRootHint')) + { + if($currentConfiguration.UseRootHint -ne $UseRootHint) + { + return $false + } } return $true diff --git a/README.md b/README.md index 858070ec..847ab561 100644 --- a/README.md +++ b/README.md @@ -231,6 +231,9 @@ Requires Windows Server 2016 onwards ### Unreleased +* Fixed: Ignore UseRootHint in xDnsServerForwarder test function if it was not + specified in the resource [Claudio Spizzi (@claudiospizzi)](https://github.com/claudiospizzi) + ### 1.14.0.0 * Copied enhancements to Test-DscParameterState from NetworkingDsc diff --git a/Tests/Unit/MSFT_xDnsServerForwarder.Tests.ps1 b/Tests/Unit/MSFT_xDnsServerForwarder.Tests.ps1 index adbeafce..be6075a2 100644 --- a/Tests/Unit/MSFT_xDnsServerForwarder.Tests.ps1 +++ b/Tests/Unit/MSFT_xDnsServerForwarder.Tests.ps1 @@ -36,10 +36,18 @@ try IPAddresses = $forwarders UseRootHint = $UseRootHint } + $testParamLimited = @{ + IsSingleInstance = 'Yes' + IPAddresses = $forwarders + } $fakeDNSForwarder = @{ IPAddress = $forwarders UseRootHint = $UseRootHint } + $fakeUseRootHint = @{ + IPAddress = $forwarders + UseRootHint = -not $UseRootHint + } #endregion @@ -81,10 +89,16 @@ try Test-TargetResource @testParams | Should Be $true } + It 'Passes when forwarders match but root hint do not and are not spcified' { + Mock -CommandName Get-DnsServerForwarder -MockWith {return $fakeUseRootHint} + Test-TargetResource @testParamLimited | Should Be $true + } + It "Fails when forwarders don't match" { Mock -CommandName Get-DnsServerForwarder -MockWith {return @{IPAddress = @(); UseRootHint = $true}} Test-TargetResource @testParams | Should Be $false } + It "Fails when UseRootHint don't match" { Mock -CommandName Get-DnsServerForwarder -MockWith {return @{IPAddress = $fakeDNSForwarder.IpAddress; UseRootHint = $false}} Test-TargetResource @testParams | Should Be $false From 0c0efb1b318c7fe6f6203202c4dced3a8a11764e Mon Sep 17 00:00:00 2001 From: Claudio Spizzi Date: Mon, 2 Sep 2019 15:32:10 +0200 Subject: [PATCH 2/3] Add space (code style) --- .../MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 b/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 index 4858b976..916e6253 100644 --- a/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 +++ b/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 @@ -93,7 +93,7 @@ function Test-TargetResource } if ($PSBoundParameters.ContainsKey('UseRootHint')) { - if($currentConfiguration.UseRootHint -ne $UseRootHint) + if ($currentConfiguration.UseRootHint -ne $UseRootHint) { return $false } From 93c8adb4954995cbb22c75a0ddef6dd47162d28a Mon Sep 17 00:00:00 2001 From: Michael Greene Date: Wed, 18 Sep 2019 16:55:52 -0500 Subject: [PATCH 3/3] Releasing version 1.14.0.0 --- README.md | 2 ++ xDnsServer.psd1 | 10 +++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 847ab561..1bbc3f8d 100644 --- a/README.md +++ b/README.md @@ -231,6 +231,8 @@ Requires Windows Server 2016 onwards ### Unreleased +### 1.14.0.0 + * Fixed: Ignore UseRootHint in xDnsServerForwarder test function if it was not specified in the resource [Claudio Spizzi (@claudiospizzi)](https://github.com/claudiospizzi) diff --git a/xDnsServer.psd1 b/xDnsServer.psd1 index e6b779a6..7608dd21 100644 --- a/xDnsServer.psd1 +++ b/xDnsServer.psd1 @@ -47,13 +47,8 @@ PrivateData = @{ # IconUri = '' # ReleaseNotes of this module - ReleaseNotes = '* Copied enhancements to Test-DscParameterState from NetworkingDsc -* Put the helper module to its own folder -* Copied enhancements to Test-DscParameterState from NetworkingDsc -* Put the helper module to its own folder -* Added xDnsServerRootHint resource -* Added xDnsServerClientSubnet resource -* Added xDnsServerZoneScope resource + ReleaseNotes = '* Fixed: Ignore UseRootHint in xDnsServerForwarder test function if it was not + specified in the resource [Claudio Spizzi (@claudiospizzi)](https://github.com/claudiospizzi) ' @@ -71,3 +66,4 @@ PrivateData = @{ +