Skip to content

Commit

Permalink
Fix test for Set-DbaNetworkConfiguration (#9514)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasjordan authored Oct 16, 2024
1 parent 21daecf commit 8b886a2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/Set-DbaNetworkConfiguration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" {
Context "Command works with piped input" {
$netConf = Get-DbaNetworkConfiguration -SqlInstance $script:instance2
$netConf.TcpIpProperties.KeepAlive = 60000
$results = $netConf | Set-DbaNetworkConfiguration -Confirm:$false
$results = $netConf | Set-DbaNetworkConfiguration -Confirm:$false -WarningAction SilentlyContinue

It "Should Return a Result" {
$results.ComputerName | Should -Be $netConf.ComputerName
Expand All @@ -25,14 +25,18 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" {
It "Should Return a Change" {
$results.Changes | Should -Match "Changed TcpIpProperties.KeepAlive to 60000"
}

$netConf = Get-DbaNetworkConfiguration -SqlInstance $script:instance2
$netConf.TcpIpProperties.KeepAlive = 30000
$null = $netConf | Set-DbaNetworkConfiguration -Confirm:$false -WarningAction SilentlyContinue
}

Context "Command works with commandline input" {
$netConf = Get-DbaNetworkConfiguration -SqlInstance $script:instance2
if ($netConf.NamedPipesEnabled) {
$results = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -DisableProtocol NamedPipes -Confirm:$false
$results = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -DisableProtocol NamedPipes -Confirm:$false -WarningAction SilentlyContinue
} else {
$results = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -EnableProtocol NamedPipes -Confirm:$false
$results = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -EnableProtocol NamedPipes -Confirm:$false -WarningAction SilentlyContinue
}

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

if ($netConf.NamedPipesEnabled) {
$null = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -EnableProtocol NamedPipes -Confirm:$false
$null = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -EnableProtocol NamedPipes -Confirm:$false -WarningAction SilentlyContinue
} else {
$null = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -DisableProtocol NamedPipes -Confirm:$false
$null = Set-DbaNetworkConfiguration -SqlInstance $script:instance2 -DisableProtocol NamedPipes -Confirm:$false -WarningAction SilentlyContinue
}
}
}

0 comments on commit 8b886a2

Please sign in to comment.