From f45a1c3419785843178bbd1dd97b8559f9cbf083 Mon Sep 17 00:00:00 2001 From: Chrissy LeMaire Date: Sun, 27 Oct 2024 11:10:03 +0100 Subject: [PATCH] try to fix errors --- tests/Copy-DbaLinkedServer.Tests.ps1 | 29 ++++++++++++++-------------- tests/Dismount-DbaDatabase.Tests.ps1 | 7 +++---- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/tests/Copy-DbaLinkedServer.Tests.ps1 b/tests/Copy-DbaLinkedServer.Tests.ps1 index bfb15187ae..a0cc40e262 100644 --- a/tests/Copy-DbaLinkedServer.Tests.ps1 +++ b/tests/Copy-DbaLinkedServer.Tests.ps1 @@ -96,21 +96,20 @@ Describe "Copy-DbaLinkedServer" -Tag "IntegrationTests" { $results.Status | Should -BeExactly "Skipped" } - # SQLNCLI10 and SQLNCLI11 are not used on newer versions, not sure which versions, but skipping if later than 2017 - It "Upgrades SQLNCLI provider based on what is registered" -Skip:($server1.VersionMajor -gt 14 -or $server2.VersionMajor -gt 14) { - $upgradeSplat = @{ - Source = $TestConfig.instance2 - Destination = $TestConfig.instance3 - LinkedServer = 'dbatoolsci_localhost2' - UpgradeSqlClient = $true - } - $result = Copy-DbaLinkedServer @upgradeSplat + # SQLNCLI10 and SQLNCLI11 are not used on newer versions, not sure which versions, but skipping if later than 2017 + Context "When upgrading SQL Client provider" -Skip:($server1.VersionMajor -gt 14 -or $server2.VersionMajor -gt 14) { + BeforeAll { + $result = Copy-DbaLinkedServer -Source $TestConfig.instance2 -Destination $TestConfig.instance3 -LinkedServer dbatoolsci_localhost2 -UpgradeSqlClient + $sourceLinked = Get-DbaLinkedServer -SqlInstance $TestConfig.instance2 + $destLinked = Get-DbaLinkedServer -SqlInstance $TestConfig.instance3 + } - $server1 = Connect-DbaInstance -SqlInstance $TestConfig.instance2 - $server2 = Connect-DbaInstance -SqlInstance $TestConfig.instance3 + It "Should retain SQLNCLI10 on source" { + $sourceLinked.Script() | Should -Match 'SQLNCLI10' + } - $server1.LinkedServers.Script() | Should -Match 'SQLNCLI10' - $server2.LinkedServers.Script() | Should -Match 'SQLNCLI11' - } - } + It "Should upgrade to SQLNCLI11 on destination" { + $destLinked.Script() | Should -Match 'SQLNCLI11' + } + } } \ No newline at end of file diff --git a/tests/Dismount-DbaDatabase.Tests.ps1 b/tests/Dismount-DbaDatabase.Tests.ps1 index 436c1f2e83..727cc38fc3 100644 --- a/tests/Dismount-DbaDatabase.Tests.ps1 +++ b/tests/Dismount-DbaDatabase.Tests.ps1 @@ -106,10 +106,9 @@ Describe "Dismount-DbaDatabase" -Tag "IntegrationTests" { It "Should detach database without snapshots" { $null = Stop-DbaProcess -SqlInstance $TestConfig.instance3 -Database $dbDetached $null = Dismount-DbaDatabase -SqlInstance $TestConfig.instance3 -Database $dbDetached - - $database = Get-DbaDatabase -SqlInstance $TestConfig.instance3 -Database $dbDetached - $database | Should -BeNullOrEmpty + $result = Get-DbaDatabase -SqlInstance $TestConfig.instance3 -Database $dbDetached + $result | Should -BeNullOrEmpty } } } -#$TestConfig.instance2 - to make it show up in appveyor, long story \ No newline at end of file +#$TestConfig.instance2 - to make it show up in appveyor, long story