Skip to content

Commit

Permalink
Fixed test for Copy-DbaEndpoint (#9515)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasjordan authored Oct 16, 2024
1 parent e7e5b2b commit 21daecf
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions tests/Copy-DbaEndpoint.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,21 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' {

Describe "$commandname Integration Tests" -Tag "IntegrationTests" {
BeforeAll {
$endpoint = Get-DbaEndpoint -SqlInstance $script:instance2 | Where-Object EndpointType -eq DatabaseMirroring
$create = $endpoint | Export-DbaScript -Passthru
$null = $endpoint | Remove-DbaEndpoint -Confirm:$false
$results = New-DbaEndpoint -SqlInstance $script:instance2 -Type DatabaseMirroring -Role Partner -Name Mirroring -Confirm:$false
Get-DbaEndpoint -SqlInstance $script:instance2 -Type DatabaseMirroring | Remove-DbaEndpoint -Confirm:$false
New-DbaEndpoint -SqlInstance $script:instance2 -Name dbatoolsci_MirroringEndpoint -Type DatabaseMirroring -Port 5022 -Owner sa
Get-DbaEndpoint -SqlInstance $script:instance3 -Type DatabaseMirroring | Remove-DbaEndpoint -Confirm:$false
}
AfterAll {
if ($create) {
$null = Get-DbaEndpoint -SqlInstance $script:instance2, $script:instance3 | Where-Object EndpointType -eq DatabaseMirroring | Remove-DbaEndpoint -Confirm:$false
Invoke-DbaQuery -SqlInstance $script:instance2 -Query "$create"
}
Get-DbaEndpoint -SqlInstance $script:instance2 -Type DatabaseMirroring | Remove-DbaEndpoint -Confirm:$false
New-DbaEndpoint -SqlInstance $script:instance2 -Name dbatoolsci_MirroringEndpoint -Type DatabaseMirroring -Port 5022 -Owner sa
Get-DbaEndpoint -SqlInstance $script:instance3 -Type DatabaseMirroring | Remove-DbaEndpoint -Confirm:$false
New-DbaEndpoint -SqlInstance $script:instance3 -Name dbatoolsci_MirroringEndpoint -Type DatabaseMirroring -Port 5023 -Owner sa
}

It "copies an endpoint" {
$results = Copy-DbaEndpoint -Source $script:instance2 -Destination $script:instance3 -Endpoint Mirroring
$results = Copy-DbaEndpoint -Source $script:instance2 -Destination $script:instance3 -Endpoint dbatoolsci_MirroringEndpoint
$results.DestinationServer | Should -Be $script:instance3
$results.Status | Should -Be 'Successful'
$results.Name | Should -Be 'Mirroring'
$results.Name | Should -Be 'dbatoolsci_MirroringEndpoint'
}
}

0 comments on commit 21daecf

Please sign in to comment.