Skip to content

Commit 8b886a2

Browse files
Fix test for Set-DbaNetworkConfiguration (#9514)
1 parent 21daecf commit 8b886a2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/Set-DbaNetworkConfiguration.Tests.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" {
1616
Context "Command works with piped input" {
1717
$netConf = Get-DbaNetworkConfiguration -SqlInstance $script:instance2
1818
$netConf.TcpIpProperties.KeepAlive = 60000
19-
$results = $netConf | Set-DbaNetworkConfiguration -Confirm:$false
19+
$results = $netConf | Set-DbaNetworkConfiguration -Confirm:$false -WarningAction SilentlyContinue
2020

2121
It "Should Return a Result" {
2222
$results.ComputerName | Should -Be $netConf.ComputerName
@@ -25,14 +25,18 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" {
2525
It "Should Return a Change" {
2626
$results.Changes | Should -Match "Changed TcpIpProperties.KeepAlive to 60000"
2727
}
28+
29+
$netConf = Get-DbaNetworkConfiguration -SqlInstance $script:instance2
30+
$netConf.TcpIpProperties.KeepAlive = 30000
31+
$null = $netConf | Set-DbaNetworkConfiguration -Confirm:$false -WarningAction SilentlyContinue
2832
}
2933

3034
Context "Command works with commandline input" {
3135
$netConf = Get-DbaNetworkConfiguration -SqlInstance $script:instance2
3236
if ($netConf.NamedPipesEnabled) {
33-
$results = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -DisableProtocol NamedPipes -Confirm:$false
37+
$results = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -DisableProtocol NamedPipes -Confirm:$false -WarningAction SilentlyContinue
3438
} else {
35-
$results = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -EnableProtocol NamedPipes -Confirm:$false
39+
$results = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -EnableProtocol NamedPipes -Confirm:$false -WarningAction SilentlyContinue
3640
}
3741

3842
It "Should Return a Result" {
@@ -44,9 +48,9 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" {
4448
}
4549

4650
if ($netConf.NamedPipesEnabled) {
47-
$null = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -EnableProtocol NamedPipes -Confirm:$false
51+
$null = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -EnableProtocol NamedPipes -Confirm:$false -WarningAction SilentlyContinue
4852
} else {
49-
$null = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -DisableProtocol NamedPipes -Confirm:$false
53+
$null = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -DisableProtocol NamedPipes -Confirm:$false -WarningAction SilentlyContinue
5054
}
5155
}
5256
}

0 commit comments

Comments
 (0)