From 2e9e64f75f3a8840fcf171cf6bf7621ee297a89e Mon Sep 17 00:00:00 2001 From: Chrissy LeMaire Date: Sun, 20 Oct 2024 23:07:26 +0200 Subject: [PATCH] fix appveyor repo --- tests/Add-DbaComputerCertificate.Tests.ps1 | 2 +- tests/Backup-DbaComputerCertificate.Tests.ps1 | 2 +- tests/Backup-DbaDatabase.Tests.ps1 | 2 +- tests/Copy-DbaDatabase.Tests.ps1 | 2 +- tests/Copy-DbaDbCertificate.Tests.ps1 | 2 +- tests/Copy-DbaLogin.Tests.ps1 | 4 +- tests/Export-DbaBinaryFile.Tests.ps1 | 4 +- tests/Get-DbaBackupInformation.Tests.ps1 | 6 +- tests/Get-DbaBinaryFileTable.Tests.ps1 | 4 +- tests/Get-DbaComputerCertificate.Tests.ps1 | 2 +- tests/Get-DbaDbBackupHistory.Tests.ps1 | 2 +- tests/Get-DbaDbRestoreHistory.Tests.ps1 | 10 +- tests/Get-DbaDbSharePoint.Tests.ps1 | 2 +- tests/Get-DbaWaitResource.Tests.ps1 | 2 +- tests/Grant-DbaAgPermission.Tests.ps1 | 2 +- tests/Import-DbaBinaryFile.Tests.ps1 | 6 +- tests/Import-DbaCsv.Tests.ps1 | 10 +- tests/Invoke-DbaWhoisActive.Tests.ps1 | 2 +- tests/Mount-DbaDatabase.Tests.ps1 | 2 +- tests/New-DbaDbAsymmetricKey.Tests.ps1 | 4 +- tests/Remove-DbaComputerCertificate.Tests.ps1 | 2 +- tests/Remove-DbaDatabase.Tests.ps1 | 4 +- tests/Restore-DbaDatabase.Tests.ps1 | 120 +++++++++--------- tests/Revoke-DbaAgPermission.Tests.ps1 | 2 +- ...DbaComputerCertificateExpiration.Tests.ps1 | 2 +- tests/Test-DbaLastBackup.Tests.ps1 | 4 +- 26 files changed, 103 insertions(+), 103 deletions(-) diff --git a/tests/Add-DbaComputerCertificate.Tests.ps1 b/tests/Add-DbaComputerCertificate.Tests.ps1 index 04b2a739db..2aa73c122f 100644 --- a/tests/Add-DbaComputerCertificate.Tests.ps1 +++ b/tests/Add-DbaComputerCertificate.Tests.ps1 @@ -15,7 +15,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Describe "$commandname Integration Tests" -Tags "IntegrationTests" { Context "Certificate is added properly" { - $results = Add-DbaComputerCertificate -Path $TestConfig.appveyorlabrepo\certificates\localhost.crt -Confirm:$false + $results = Add-DbaComputerCertificate -Path $($TestConfig.appveyorlabrepo)\certificates\localhost.crt -Confirm:$false It "Should show the proper thumbprint has been added" { $results.Thumbprint | Should Be "29C469578D6C6211076A09CEE5C5797EEA0C2713" diff --git a/tests/Backup-DbaComputerCertificate.Tests.ps1 b/tests/Backup-DbaComputerCertificate.Tests.ps1 index 59e303f6ce..358d32402b 100644 --- a/tests/Backup-DbaComputerCertificate.Tests.ps1 +++ b/tests/Backup-DbaComputerCertificate.Tests.ps1 @@ -15,7 +15,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Describe "$commandname Integration Tests" -Tags "IntegrationTests" { Context "Certificate is added properly" { - $null = Add-DbaComputerCertificate -Path $TestConfig.appveyorlabrepo\certificates\localhost.crt -Confirm:$false + $null = Add-DbaComputerCertificate -Path $($TestConfig.appveyorlabrepo)\certificates\localhost.crt -Confirm:$false It "returns the proper results" { $result = Get-DbaComputerCertificate -Thumbprint 29C469578D6C6211076A09CEE5C5797EEA0C2713 | Backup-DbaComputerCertificate -Path C:\temp $result.Name -match '29C469578D6C6211076A09CEE5C5797EEA0C2713.cer' diff --git a/tests/Backup-DbaDatabase.Tests.ps1 b/tests/Backup-DbaDatabase.Tests.ps1 index 3fd3721612..0bce18bde6 100644 --- a/tests/Backup-DbaDatabase.Tests.ps1 +++ b/tests/Backup-DbaDatabase.Tests.ps1 @@ -237,7 +237,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } Context "Backup can pipe to restore" { - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName "dbatoolsci_singlerestore" + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName "dbatoolsci_singlerestore" $results = Backup-DbaDatabase -SqlInstance $TestConfig.instance1 -BackupDirectory $DestBackupDir -Database "dbatoolsci_singlerestore" | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName $DestDbRandom -TrustDbBackupHistory -ReplaceDbNameInFile It "Should return successful restore" { $results.RestoreComplete | Should -Be $true diff --git a/tests/Copy-DbaDatabase.Tests.ps1 b/tests/Copy-DbaDatabase.Tests.ps1 index d33a544149..e2dc362ac8 100644 --- a/tests/Copy-DbaDatabase.Tests.ps1 +++ b/tests/Copy-DbaDatabase.Tests.ps1 @@ -218,7 +218,7 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { $null = Remove-DbaDatabase -SqlInstance $TestConfig.instance3 -Database "$prefix$backuprestoredb" } - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $TestConfig.appveyorlabrepo\RestoreTimeClean2016 -useDestinationDefaultDirectories + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $($TestConfig.appveyorlabrepo)\RestoreTimeClean2016 -useDestinationDefaultDirectories It "Should warn and exit if newname and >1 db specified" { $null = Copy-DbaDatabase -Source $TestConfig.instance2 -Destination $TestConfig.instance3 -Database $backuprestoredb, RestoreTimeClean -DetachAttach -Reattach -NewName warn -WarningVariable warnvar 3> $null $warnvar | Should -BeLike "*Cannot use NewName when copying multiple databases" diff --git a/tests/Copy-DbaDbCertificate.Tests.ps1 b/tests/Copy-DbaDbCertificate.Tests.ps1 index 38be88a025..7fd3634d71 100644 --- a/tests/Copy-DbaDbCertificate.Tests.ps1 +++ b/tests/Copy-DbaDbCertificate.Tests.ps1 @@ -39,7 +39,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { EncryptionPassword = $passwd MasterKeyPassword = $passwd Database = "dbatoolscopycred" - SharedPath = $TestConfig.appveyorlabrepo + SharedPath = $($TestConfig.appveyorlabrepo) } $results = Copy-DbaDbCertificate @paramscopydb -Confirm:$false | Where-Object SourceDatabase -eq dbatoolscopycred | Select-Object -First 1 $results.Notes | Should -Be $null diff --git a/tests/Copy-DbaLogin.Tests.ps1 b/tests/Copy-DbaLogin.Tests.ps1 index 3869b05ad3..eefed81844 100644 --- a/tests/Copy-DbaLogin.Tests.ps1 +++ b/tests/Copy-DbaLogin.Tests.ps1 @@ -40,7 +40,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } # create objects - $null = Invoke-DbaQuery -SqlInstance $TestConfig.instance1 -InputFile $TestConfig.appveyorlabrepo\sql2008-scripts\logins.sql + $null = Invoke-DbaQuery -SqlInstance $TestConfig.instance1 -InputFile $($TestConfig.appveyorlabrepo)\sql2008-scripts\logins.sql $tableQuery = @("CREATE TABLE tester_table (a int)", "CREATE USER tester FOR LOGIN tester", "GRANT INSERT ON tester_table TO tester;") $null = Invoke-DbaQuery -SqlInstance $TestConfig.instance1 -Database tempdb -Query ($tableQuery -join '; ') @@ -97,7 +97,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { Context "No overwrite" { BeforeAll { - $null = Invoke-DbaQuery -SqlInstance $TestConfig.instance2 -InputFile $TestConfig.appveyorlabrepo\sql2008-scripts\logins.sql + $null = Invoke-DbaQuery -SqlInstance $TestConfig.instance2 -InputFile $($TestConfig.appveyorlabrepo)\sql2008-scripts\logins.sql } $results = Copy-DbaLogin -Source $TestConfig.instance1 -Destination $TestConfig.instance2 -Login tester It "Should say skipped" { diff --git a/tests/Export-DbaBinaryFile.Tests.ps1 b/tests/Export-DbaBinaryFile.Tests.ps1 index 77cd6f56db..a2852ad001 100644 --- a/tests/Export-DbaBinaryFile.Tests.ps1 +++ b/tests/Export-DbaBinaryFile.Tests.ps1 @@ -17,8 +17,8 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { BeforeEach { $db = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -Database tempdb $null = $db.Query("CREATE TABLE [dbo].[BunchOFilezz]([FileName123] [nvarchar](50) NULL, [TheFile123] [image] NULL)") - $null = Import-DbaBinaryFile -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFilezz -FilePath $TestConfig.appveyorlabrepo\azure\adalsql.msi - $null = Get-ChildItem $TestConfig.appveyorlabrepo\certificates | Import-DbaBinaryFile -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFilezz + $null = Import-DbaBinaryFile -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFilezz -FilePath $($TestConfig.appveyorlabrepo)\azure\adalsql.msi + $null = Get-ChildItem $($TestConfig.appveyorlabrepo)\certificates | Import-DbaBinaryFile -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFilezz } AfterEach { try { diff --git a/tests/Get-DbaBackupInformation.Tests.ps1 b/tests/Get-DbaBackupInformation.Tests.ps1 index dfa54b97fa..e58bce5cdf 100644 --- a/tests/Get-DbaBackupInformation.Tests.ps1 +++ b/tests/Get-DbaBackupInformation.Tests.ps1 @@ -25,7 +25,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $random = Get-Random $dbname = "dbatoolsci_Backuphistory_$random" $null = Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database $dbname | Remove-DbaDatabase -Confirm:$false - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $dbname -DestinationFilePrefix $dbname + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $dbname -DestinationFilePrefix $dbname $db = Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database $dbname $db | Backup-DbaDatabase -Type Full -BackupDirectory $DestBackupDir $db | Backup-DbaDatabase -Type Differential -BackupDirectory $DestBackupDir @@ -33,7 +33,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $dbname2 = "dbatoolsci_Backuphistory2_$random" $null = Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database $dbname2 | Remove-DbaDatabase -Confirm:$false - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $dbname2 -DestinationFilePrefix $dbname2 + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $dbname2 -DestinationFilePrefix $dbname2 $db2 = Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database $dbname2 $db2 | Backup-DbaDatabase -Type Full -BackupDirectory $DestBackupDir $db2 | Backup-DbaDatabase -Type Differential -BackupDirectory $DestBackupDir @@ -53,7 +53,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $dbname3 = "dbatoolsci_BackuphistoryOla_$random" $null = Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database $dbname3 | Remove-DbaDatabase -Confirm:$false - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $dbname3 -DestinationFilePrefix $dbname3 + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $dbname3 -DestinationFilePrefix $dbname3 $db3 = Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database $dbname3 $db3 | Backup-DbaDatabase -Type Full -BackupDirectory "$DestBackupDirOla\FULL" $db3 | Backup-DbaDatabase -Type Differential -BackupDirectory "$DestBackupDirOla\Diff" diff --git a/tests/Get-DbaBinaryFileTable.Tests.ps1 b/tests/Get-DbaBinaryFileTable.Tests.ps1 index e6bb6abf0c..0a95e9ed79 100644 --- a/tests/Get-DbaBinaryFileTable.Tests.ps1 +++ b/tests/Get-DbaBinaryFileTable.Tests.ps1 @@ -17,8 +17,8 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { BeforeAll { $db = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -Database tempdb $null = $db.Query("CREATE TABLE [dbo].[BunchOFilez]([FileName123] [nvarchar](50) NULL, [TheFile123] [image] NULL)") - $null = Import-DbaBinaryFile -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFilez -FilePath $TestConfig.appveyorlabrepo\azure\adalsql.msi - $null = Get-ChildItem $TestConfig.appveyorlabrepo\certificates | Import-DbaBinaryFile -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFilez + $null = Import-DbaBinaryFile -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFilez -FilePath $($TestConfig.appveyorlabrepo)\azure\adalsql.msi + $null = Get-ChildItem $($TestConfig.appveyorlabrepo)\certificates | Import-DbaBinaryFile -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFilez } AfterAll { try { diff --git a/tests/Get-DbaComputerCertificate.Tests.ps1 b/tests/Get-DbaComputerCertificate.Tests.ps1 index 4f3b3fbaba..29f9785a40 100644 --- a/tests/Get-DbaComputerCertificate.Tests.ps1 +++ b/tests/Get-DbaComputerCertificate.Tests.ps1 @@ -16,7 +16,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { Context "Can get a certificate" { BeforeAll { - $null = Add-DbaComputerCertificate -Path $TestConfig.appveyorlabrepo\certificates\localhost.crt -Confirm:$false + $null = Add-DbaComputerCertificate -Path $($TestConfig.appveyorlabrepo)\certificates\localhost.crt -Confirm:$false $thumbprint = "29C469578D6C6211076A09CEE5C5797EEA0C2713" } AfterAll { diff --git a/tests/Get-DbaDbBackupHistory.Tests.ps1 b/tests/Get-DbaDbBackupHistory.Tests.ps1 index 8add4fffbb..69119c0515 100644 --- a/tests/Get-DbaDbBackupHistory.Tests.ps1 +++ b/tests/Get-DbaDbBackupHistory.Tests.ps1 @@ -23,7 +23,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $dbname = "dbatoolsci_history_$random" $dbnameForked = "dbatoolsci_history_forked_$random" $null = Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database $dbname, $dbnameForked | Remove-DbaDatabase -Confirm:$false - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $dbname -DestinationFilePrefix $dbname + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $dbname -DestinationFilePrefix $dbname $server = Connect-DbaInstance -SqlInstance $TestConfig.instance1 $server.Databases['master'].ExecuteNonQuery("CREATE DATABASE $dbnameForked; ALTER DATABASE $dbnameForked SET AUTO_CLOSE OFF WITH ROLLBACK IMMEDIATE") $db = Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database $dbname diff --git a/tests/Get-DbaDbRestoreHistory.Tests.ps1 b/tests/Get-DbaDbRestoreHistory.Tests.ps1 index 95873650d3..af37b73b01 100644 --- a/tests/Get-DbaDbRestoreHistory.Tests.ps1 +++ b/tests/Get-DbaDbRestoreHistory.Tests.ps1 @@ -20,9 +20,9 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $dbname1 = "dbatoolsci_restorehistory1_$random" $dbname2 = "dbatoolsci_restorehistory2_$random" $null = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -Database $dbname1, $dbname2 | Remove-DbaDatabase -Confirm:$false - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $dbname1 -DestinationFilePrefix $dbname1 - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $dbname2 -DestinationFilePrefix $dbname2 - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $dbname2 -DestinationFilePrefix "rsh_pre_$dbname2" -WithReplace + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $dbname1 -DestinationFilePrefix $dbname1 + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $dbname2 -DestinationFilePrefix $dbname2 + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $dbname2 -DestinationFilePrefix "rsh_pre_$dbname2" -WithReplace $fullBackup = Backup-DbaDatabase -SqlInstance $TestConfig.instance2 -Database $dbname1 -Type Full $diffBackup = Backup-DbaDatabase -SqlInstance $TestConfig.instance2 -Database $dbname1 -Type Diff $logBackup = Backup-DbaDatabase -SqlInstance $TestConfig.instance2 -Database $dbname1 -Type Log @@ -47,7 +47,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } It "Should return the full restore with the correct properties" { $results[0].RestoreType | Should -Be "Database" - $results[0].From | Should -Be $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak + $results[0].From | Should -Be $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak $results[0].To | Should -Match "\\rsh_pre_$dbname2" } } @@ -59,7 +59,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { It "Should return the full restore with the correct properties" { $results[0].RestoreType | Should -Be "Database" $results[1].RestoreType | Should -Be "Log" - $results[0].From | Should -Be $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak + $results[0].From | Should -Be $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak $results[1].From | Should -Be $logBackup.BackupPath ($results | Where-Object Database -eq $dbname1).To | Should -Match "\\$dbname1" ($results | Where-Object Database -eq $dbname2).To | Should -Match "\\rsh_pre_$dbname2" diff --git a/tests/Get-DbaDbSharePoint.Tests.ps1 b/tests/Get-DbaDbSharePoint.Tests.ps1 index 651e4200c6..7ec685f6bc 100644 --- a/tests/Get-DbaDbSharePoint.Tests.ps1 +++ b/tests/Get-DbaDbSharePoint.Tests.ps1 @@ -26,7 +26,7 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" { } # Andreas Jordan: We should try to get a backup working again or even better just a sql script to set this up. # This takes a long time but I cannot figure out why every backup of this db is malformed - $bacpac = "$TestConfig.appveyorlabrepo\bacpac\sharepoint_config.bacpac" + $bacpac = "$($TestConfig.appveyorlabrepo)\bacpac\sharepoint_config.bacpac" if (Test-Path -Path $bacpac) { $sqlpackage = (Get-Command sqlpackage -ErrorAction Ignore).Source if (-not $sqlpackage) { diff --git a/tests/Get-DbaWaitResource.Tests.ps1 b/tests/Get-DbaWaitResource.Tests.ps1 index 511e5bf5ce..2f59a78c42 100644 --- a/tests/Get-DbaWaitResource.Tests.ps1 +++ b/tests/Get-DbaWaitResource.Tests.ps1 @@ -18,7 +18,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { $random = Get-Random $WaitResourceDB = "WaitResource$random" - Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -DatabaseName $WaitResourceDB -ReplaceDbNameInFile -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak + Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -DatabaseName $WaitResourceDB -ReplaceDbNameInFile -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak $sql = " create table waittest ( col1 int, diff --git a/tests/Grant-DbaAgPermission.Tests.ps1 b/tests/Grant-DbaAgPermission.Tests.ps1 index 6186eee016..b0713df071 100644 --- a/tests/Grant-DbaAgPermission.Tests.ps1 +++ b/tests/Grant-DbaAgPermission.Tests.ps1 @@ -15,7 +15,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Describe "$commandname Integration Tests" -Tag "IntegrationTests" { BeforeAll { - $null = Invoke-DbaQuery -SqlInstance $TestConfig.instance3 -InputFile $TestConfig.appveyorlabrepo\sql2008-scripts\logins.sql -ErrorAction SilentlyContinue + $null = Invoke-DbaQuery -SqlInstance $TestConfig.instance3 -InputFile $($TestConfig.appveyorlabrepo)\sql2008-scripts\logins.sql -ErrorAction SilentlyContinue $agname = "dbatoolsci_ag_grant" $null = New-DbaAvailabilityGroup -Primary $TestConfig.instance3 -Name $agname -ClusterType None -FailoverMode Manual -Confirm:$false -Certificate dbatoolsci_AGCert } diff --git a/tests/Import-DbaBinaryFile.Tests.ps1 b/tests/Import-DbaBinaryFile.Tests.ps1 index 173c95568e..af22da4ce0 100644 --- a/tests/Import-DbaBinaryFile.Tests.ps1 +++ b/tests/Import-DbaBinaryFile.Tests.ps1 @@ -27,18 +27,18 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } It "imports files into table data" { - $results = Import-DbaBinaryFile -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFiles -FilePath $TestConfig.appveyorlabrepo\azure\adalsql.msi -WarningAction Continue -ErrorAction Stop -EnableException + $results = Import-DbaBinaryFile -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFiles -FilePath $($TestConfig.appveyorlabrepo)\azure\adalsql.msi -WarningAction Continue -ErrorAction Stop -EnableException $results.Database | Should -Be "tempdb" $results.FilePath | Should -match "adalsql.msi" } It "imports files into table data from piped" { - $results = Get-ChildItem -Path $TestConfig.appveyorlabrepo\certificates | Import-DbaBinaryFile -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFiles -WarningAction Continue -ErrorAction Stop -EnableException + $results = Get-ChildItem -Path $($TestConfig.appveyorlabrepo)\certificates | Import-DbaBinaryFile -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFiles -WarningAction Continue -ErrorAction Stop -EnableException $results.Database | Should -Be @("tempdb", "tempdb") Split-Path -Path $results.FilePath -Leaf | Should -Be @("localhost.crt", "localhost.pfx") } It "piping from Get-DbaBinaryFileTable works" { - $results = Get-DbaBinaryFileTable -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFiles | Import-DbaBinaryFile -WarningAction Continue -ErrorAction Stop -EnableException -Path $TestConfig.appveyorlabrepo\certificates + $results = Get-DbaBinaryFileTable -SqlInstance $TestConfig.instance2 -Database tempdb -Table BunchOFiles | Import-DbaBinaryFile -WarningAction Continue -ErrorAction Stop -EnableException -Path $($TestConfig.appveyorlabrepo)\certificates $results.Database | Should -Be @("tempdb", "tempdb") Split-Path -Path $results.FilePath -Leaf | Should -Be @("localhost.crt", "localhost.pfx") } diff --git a/tests/Import-DbaCsv.Tests.ps1 b/tests/Import-DbaCsv.Tests.ps1 index 00e67c88f7..eb76dbb6e8 100644 --- a/tests/Import-DbaCsv.Tests.ps1 +++ b/tests/Import-DbaCsv.Tests.ps1 @@ -18,11 +18,11 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Invoke-DbaQuery -SqlInstance $TestConfig.instance1, $TestConfig.instance2 -Database tempdb -Query "drop table SuperSmall; drop table CommaSeparatedWithHeader" } - $path = "$TestConfig.appveyorlabrepo\csv\SuperSmall.csv" - $CommaSeparatedWithHeader = "$TestConfig.appveyorlabrepo\csv\CommaSeparatedWithHeader.csv" - $col1 = "$TestConfig.appveyorlabrepo\csv\cols.csv" - $col2 = "$TestConfig.appveyorlabrepo\csv\col2.csv" - $pipe3 = "$TestConfig.appveyorlabrepo\csv\pipe3.psv" + $path = "$($TestConfig.appveyorlabrepo)\csv\SuperSmall.csv" + $CommaSeparatedWithHeader = "$($TestConfig.appveyorlabrepo)\csv\CommaSeparatedWithHeader.csv" + $col1 = "$($TestConfig.appveyorlabrepo)\csv\cols.csv" + $col2 = "$($TestConfig.appveyorlabrepo)\csv\col2.csv" + $pipe3 = "$($TestConfig.appveyorlabrepo)\csv\pipe3.psv" Context "Works as expected" { diff --git a/tests/Invoke-DbaWhoisActive.Tests.ps1 b/tests/Invoke-DbaWhoisActive.Tests.ps1 index be56e3a6af..44dceabb70 100644 --- a/tests/Invoke-DbaWhoisActive.Tests.ps1 +++ b/tests/Invoke-DbaWhoisActive.Tests.ps1 @@ -15,7 +15,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Describe "$commandname Integration Tests" -Tags "IntegrationTests" { BeforeAll { - $testzippath = "$TestConfig.appveyorlabrepo\CommunitySoftware\sp_whoisactive-12.00.zip" + $testzippath = "$($TestConfig.appveyorlabrepo)\CommunitySoftware\sp_whoisactive-12.00.zip" $resultInstallMaster = Install-DbaWhoIsActive -SqlInstance $TestConfig.instance1 -LocalFile $testzippath -Database master -WarningVariable warnInstallMaster $resultInstallTempdb = Install-DbaWhoIsActive -SqlInstance $TestConfig.instance1 -LocalFile $testzippath -Database tempdb -WarningVariable warnInstallTempdb } diff --git a/tests/Mount-DbaDatabase.Tests.ps1 b/tests/Mount-DbaDatabase.Tests.ps1 index 5118e4299e..1800f9af45 100644 --- a/tests/Mount-DbaDatabase.Tests.ps1 +++ b/tests/Mount-DbaDatabase.Tests.ps1 @@ -16,7 +16,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { Context "Setup removes, restores and backups on the local drive for Mount-DbaDatabase" { $null = Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database detachattach | Remove-DbaDatabase -Confirm:$false - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $TestConfig.appveyorlabrepo\detachattach\detachattach.bak -WithReplace + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $($TestConfig.appveyorlabrepo)\detachattach\detachattach.bak -WithReplace $null = Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database detachattach | Backup-DbaDatabase -Type Full $null = Detach-DbaDatabase -SqlInstance $TestConfig.instance1 -Database detachattach -Force } diff --git a/tests/New-DbaDbAsymmetricKey.Tests.ps1 b/tests/New-DbaDbAsymmetricKey.Tests.ps1 index f63e9dcb68..68631e0038 100644 --- a/tests/New-DbaDbAsymmetricKey.Tests.ps1 +++ b/tests/New-DbaDbAsymmetricKey.Tests.ps1 @@ -103,7 +103,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $keyname = 'filekey' $dbuser = 'keyowner' $database = 'enctest' - $path = "$($TestConfig.appveyorlabrepo)\keytests\keypair.snk" + $path = "$($($TestConfig.appveyorlabrepo))\keytests\keypair.snk" if (Test-Path -Path $path) { $key = New-DbaDbAsymmetricKey -SqlInstance $TestConfig.instance2 -Database $database -Name $keyname -Owner keyowner -WarningVariable warnvar -KeySourceType File -KeySource $path $results = Get-DbaDbAsymmetricKey -SqlInstance $TestConfig.instance2 -Name $keyname -Database $database @@ -124,7 +124,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $keyname = 'filekeybad' $dbuser = 'keyowner' $database = 'enctest' - $path = "$($TestConfig.appveyorlabrepo)\keytests\keypair.bad" + $path = "$($($TestConfig.appveyorlabrepo))\keytests\keypair.bad" $key = New-DbaDbAsymmetricKey -SqlInstance $TestConfig.instance2 -Database $database -Name $keyname -Owner keyowner -WarningVariable warnvar -KeySourceType File -KeySource $path 3> $null $results = Get-DbaDbAsymmetricKey -SqlInstance $TestConfig.instance2 -Name $keyname -Database $database It "Should not Create new key in $database called $keyname" { diff --git a/tests/Remove-DbaComputerCertificate.Tests.ps1 b/tests/Remove-DbaComputerCertificate.Tests.ps1 index 7dd3826a10..44346541dd 100644 --- a/tests/Remove-DbaComputerCertificate.Tests.ps1 +++ b/tests/Remove-DbaComputerCertificate.Tests.ps1 @@ -16,7 +16,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { Context "Can remove a certificate" { BeforeAll { - $null = Add-DbaComputerCertificate -Path $TestConfig.appveyorlabrepo\certificates\localhost.crt -Confirm:$false + $null = Add-DbaComputerCertificate -Path $($TestConfig.appveyorlabrepo)\certificates\localhost.crt -Confirm:$false $thumbprint = "29C469578D6C6211076A09CEE5C5797EEA0C2713" } diff --git a/tests/Remove-DbaDatabase.Tests.ps1 b/tests/Remove-DbaDatabase.Tests.ps1 index 814835c7cb..77705fc4db 100644 --- a/tests/Remove-DbaDatabase.Tests.ps1 +++ b/tests/Remove-DbaDatabase.Tests.ps1 @@ -41,7 +41,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { It "Should remove a non system database." { Remove-DbaDatabase -Confirm:$false -SqlInstance $TestConfig.instance1 -Database singlerestore Get-DbaProcess -SqlInstance $TestConfig.instance1 -Database singlerestore | Stop-DbaProcess - Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -WithReplace + Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -WithReplace (Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database singlerestore).IsAccessible | Should Be $true Remove-DbaDatabase -Confirm:$false -SqlInstance $TestConfig.instance1 -Database singlerestore Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database singlerestore | Should Be $null @@ -51,7 +51,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { It "Should remove a non system database." { Remove-DbaDatabase -Confirm:$false -SqlInstance $TestConfig.instance1 -Database singlerestore Get-DbaProcess -SqlInstance $TestConfig.instance1 -Database singlerestore | Stop-DbaProcess - Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -WithReplace -NoRecovery + Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -WithReplace -NoRecovery (Connect-DbaInstance -SqlInstance $TestConfig.instance1).Databases['singlerestore'].IsAccessible | Should Be $false Remove-DbaDatabase -Confirm:$false -SqlInstance $TestConfig.instance1 -Database singlerestore Get-DbaDatabase -SqlInstance $TestConfig.instance1 -Database singlerestore | Should Be $null diff --git a/tests/Restore-DbaDatabase.Tests.ps1 b/tests/Restore-DbaDatabase.Tests.ps1 index 92385c1864..ad26c6888a 100644 --- a/tests/Restore-DbaDatabase.Tests.ps1 +++ b/tests/Restore-DbaDatabase.Tests.ps1 @@ -23,9 +23,9 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "Properly restores a database on the local drive using Path" { $null = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -ExcludeSystem | Remove-DbaDatabase -Confirm:$false - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak It "Should Return the proper backup file location" { - $results.BackupFile | Should Be "$TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak" + $results.BackupFile | Should Be $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak } It "Should return successful restore" { $results.RestoreComplete | Should Be $true @@ -33,7 +33,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Ensuring warning is thrown if database already exists" { - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -WarningVariable warning -WarningAction SilentlyContinue + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -WarningVariable warning -WarningAction SilentlyContinue It "Should warn" { $warning | Where-Object { $_ -like '*Test-DbaBackupInformation*Database*' } | Should Match "exists, so WithReplace must be specified" } @@ -54,9 +54,9 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Get-DbaProcess $TestConfig.instance2 -ExcludeSystemSpids | Stop-DbaProcess -WarningVariable warn -WarningAction SilentlyContinue Context "Properly restores a database on the local drive using piped Get-ChildItem results" { - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 It "Should Return the proper backup file location" { - $results.BackupFile | Should Be "$TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak" + $results.BackupFile | Should Be $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak } It "Should return successful restore" { $results.RestoreComplete | Should Be $true @@ -64,7 +64,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Test VerifyOnly works with db in existence" { - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -VerifyOnly + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -VerifyOnly It "Should have verified Successfully" { $results[0] | Should Be "Verify successful" } @@ -79,15 +79,15 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Allows continues with Differential Backups" { - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\DoubleDiffing\difftest-full.bak -NoRecovery + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\DoubleDiffing\difftest-full.bak -NoRecovery It "Should restore the root full cleanly" { $results.RestoreComplete | Should -Be $True } - $results1 = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\DoubleDiffing\difftest-diff1.bak -NoRecovery -Continue + $results1 = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\DoubleDiffing\difftest-diff1.bak -NoRecovery -Continue It "Should restore the first diff cleanly" { $results1.RestoreComplete | Should -Be $True } - $results2 = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\DoubleDiffing\difftest-diff2.bak -Continue + $results2 = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\DoubleDiffing\difftest-diff2.bak -Continue It "Should restore the second diff cleanly" { $results2.RestoreComplete | Should -Be $True } @@ -99,21 +99,21 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Start-Sleep -Seconds 2 Context "Database is restored with correct renamings" { - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DestinationFilePrefix prefix + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DestinationFilePrefix prefix It "Should return successful restore with prefix" { $results.RestoreComplete | Should Be $true } It "Should return the 2 prefixed files" { (($results.RestoredFile -split ',').substring(0, 6) -eq 'prefix').count | Should be 2 } - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DestinationFileSuffix suffix -WithReplace + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DestinationFileSuffix suffix -WithReplace It "Should return successful restore with suffix" { ($results.RestoreComplete -eq $true) | Should Be $true } It "Should return the 2 suffixed files" { (($Results.RestoredFile -split ',') -match "suffix\.").count | Should be 2 } - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DestinationFileSuffix suffix -DestinationFilePrefix prefix -WithReplace + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DestinationFileSuffix suffix -DestinationFilePrefix prefix -WithReplace It "Should return successful restore with suffix and prefix" { ($results.RestoreComplete -eq $true) | Should Be $true } @@ -132,7 +132,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Replace databasename in Restored File" { - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace It "Should return the 2 files swapping singlerestore for pestering (output)" { (($Results.RestoredFile -split ',') -like "*pestering*").count | Should be 2 } @@ -144,7 +144,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Replace databasename in Restored File, but don't change backup history #5036" { - $bh = Get-DbaBackupInformation -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -SqlInstance $TestConfig.instance2 + $bh = Get-DbaBackupInformation -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -SqlInstance $TestConfig.instance2 $firstPhysicalName = $bh.FileList.PhysicalName[0] $null = $bh | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace -OutputScriptOnly @@ -163,7 +163,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "Test restoring as other login #6992" { #Check first that the db isn't owned by SA - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace $db = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -Database Pestering It "Should Not be owned by SA this time" { $db.owner | Should Not Be "sa" @@ -171,13 +171,13 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Remove-DbaDatabase -SqlInstance $TestConfig.instance2 -Database Pestering -Confirm:$false - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace -ExecuteAs badlogin -WarningVariable warnvar + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace -ExecuteAs badlogin -WarningVariable warnvar $db = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -Database Pestering It "Should throw a warning if login doesn't exist" { $warnvar | Should BeLike "*You specified a Login to execute the restore, but the login 'badlogin' does not exist" } - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace -ExecuteAs sa + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace -ExecuteAs sa $db = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -Database Pestering It "Should be owned by SA this time" { $db.owner | Should Be "sa" @@ -188,13 +188,13 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $RestoreAsUser = 'RestoreAs' New-DbaLogin -SqlInstance $TestConfig.instance2 -Login $RestoreAsUser -SecurePassword (ConvertTo-SecureString 'P@ssw0rdl!ng' -AsPlainText -Force) -force Add-DbaServerRoleMember -SqlInstance $TestConfig.instance2 -ServerRole sysadmin -Login $RestoreAsUser -confirm:$false - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace -ExecuteAs $RestoreAsUser + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace -ExecuteAs $RestoreAsUser $db2 = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -Database Pestering It "Should be owned by $RestoreAsUser this time" { $db2.owner | Should Be "$RestoreAsUser" } - $results6 = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace -ExecuteAs $RestoreAsUser -OutputScriptOnly + $results6 = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName Pestering -replaceDbNameInFile -WithReplace -ExecuteAs $RestoreAsUser -OutputScriptOnly It "Should prefix the script with the Execute As statement" { $results6 | Should BeLike "EXECUTE AS LOGIN='$RestoreAsUser'*" } @@ -205,7 +205,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Start-Sleep -Seconds 2 Context "Folder restore options" { - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DestinationDataDirectory $DataFolder + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DestinationDataDirectory $DataFolder It "Should return successful restore with DestinationDataDirectory" { $results.RestoreComplete | Should Be $true } @@ -218,7 +218,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } } - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DestinationDataDirectory $DataFolder -DestinationLogDirectory $LogFolder -WithReplace + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DestinationDataDirectory $DataFolder -DestinationLogDirectory $LogFolder -WithReplace It "Should have moved data file to $DataFolder" { (($results.RestoredFileFull -split ',') -like "$DataFolder*").count | Should be 1 } @@ -242,7 +242,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Clear-DbaConnectionPool Start-Sleep -Seconds 2 Context "Putting all restore file modification options together" { - $results = Get-ChildItem $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DestinationDataDirectory $DataFolder -DestinationLogDirectory $LogFolder -DestinationFileSuffix Suffix -DestinationFilePrefix prefix + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DestinationDataDirectory $DataFolder -DestinationLogDirectory $LogFolder -DestinationFileSuffix Suffix -DestinationFilePrefix prefix It "Should return successful restore with all file mod options" { $results.RestoreComplete | Should Be $true } @@ -278,7 +278,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Clear-DbaConnectionPool Context "Properly restores an instance using ola-style backups via pipe" { - $results = Get-ChildItem $TestConfig.appveyorlabrepo\sql2008-backups | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\sql2008-backups | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 It "Restored files count should be the right number" { $results.DatabaseName.Count | Should Be 33 } @@ -289,7 +289,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Should proceed if backups from multiple dbs passed in and databasename specified" { - $results = Get-ChildItem $TestConfig.appveyorlabrepo\sql2008-backups | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName test -WarningVariable warnvar + $results = Get-ChildItem $($TestConfig.appveyorlabrepo)\sql2008-backups | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName test -WarningVariable warnvar It "Should return nothing" { $null -eq $results | Should be $True } @@ -313,7 +313,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Properly restores an instance using ola-style backups via string" { - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\sql2008-backups + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\sql2008-backups It "Restored files count should be the right number" { $results.DatabaseName.Count | Should Be 33 } @@ -337,7 +337,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Start-Sleep -Seconds 2 Context "RestoreTime setup checks" { - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $TestConfig.appveyorlabrepo\RestoreTimeClean2016 + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $($TestConfig.appveyorlabrepo)\RestoreTimeClean2016 $sqlResults = Invoke-DbaQuery -SqlInstance $TestConfig.instance2 -Query "select convert(datetime,convert(varchar(20),max(dt),120)) as maxdt, convert(datetime,convert(varchar(20),min(dt),120)) as mindt from RestoreTimeClean.dbo.steps" It "Should restore cleanly" { ($results.RestoreComplete -contains $false) | Should Be $false @@ -368,7 +368,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Start-Sleep -Seconds 1 Context "RestoreTime point in time" { - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $TestConfig.appveyorlabrepo\RestoreTimeClean2016 -RestoreTime (Get-Date "2019-05-02 21:12:27") -WarningVariable warnvar -ErrorVariable errvar + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $($TestConfig.appveyorlabrepo)\RestoreTimeClean2016 -RestoreTime (Get-Date "2019-05-02 21:12:27") -WarningVariable warnvar -ErrorVariable errvar $sqlResults = Invoke-DbaQuery -SqlInstance $TestConfig.instance2 -Query "select convert(datetime,convert(varchar(20),max(dt),120)) as maxdt, convert(datetime,convert(varchar(20),min(dt),120)) as mindt from RestoreTimeClean.dbo.steps" It "Should have restored 4 files" { $results.count | Should be 4 @@ -392,7 +392,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Start-Sleep -Seconds 1 Context "RestoreTime point in time with Simple Model" { - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $TestConfig.appveyorlabrepo\sql2008-backups\SimpleRecovery\ -RestoreTime (Get-Date "2018-04-06 10:37:44") + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $($TestConfig.appveyorlabrepo)\sql2008-backups\SimpleRecovery\ -RestoreTime (Get-Date "2018-04-06 10:37:44") $sqlResults = Invoke-DbaQuery -SqlInstance $TestConfig.instance2 -Query "select convert(datetime,convert(varchar(20),max(dt),120)) as maxdt, convert(datetime,convert(varchar(20),min(dt),120)) as mindt from SimpleBackTest.dbo.steps" It "Should have restored 2 files" { @@ -427,7 +427,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } return } - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $TestConfig.appveyorlabrepo\RestoreTimeClean2016 -RestoreTime (Get-Date "2019-05-02 21:12:27") -StandbyDirectory c:\temp -WarningVariable warnvar -ErrorVariable errvar -ErrorAction SilentlyContinue + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $($TestConfig.appveyorlabrepo)\RestoreTimeClean2016 -RestoreTime (Get-Date "2019-05-02 21:12:27") -StandbyDirectory c:\temp -WarningVariable warnvar -ErrorVariable errvar -ErrorAction SilentlyContinue $sqlResults = Invoke-DbaQuery -SqlInstance $TestConfig.instance2 -Query "select convert(datetime,convert(varchar(20),max(dt),120)) as maxdt, convert(datetime,convert(varchar(20),min(dt),120)) as mindt from RestoreTimeClean.dbo.steps" $warnvar It "Should not warn" { @@ -443,7 +443,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { It "Should have restored to 05/02/2019 21:12:26" { $sqlResults.maxdt | Should be (Get-Date "02 May 2019 21:12:26") } - $results2 = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $TestConfig.appveyorlabrepo\RestoreTimeClean2016 -Continue + $results2 = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $($TestConfig.appveyorlabrepo)\RestoreTimeClean2016 -Continue $sqlResults2 = Invoke-DbaQuery -SqlInstance $TestConfig.instance2 -Query "select convert(datetime,convert(varchar(20),max(dt),120)) as maxdt, convert(datetime,convert(varchar(20),min(dt),120)) as mindt from RestoreTimeClean.dbo.steps" It "Should have restored 4 files" { $results2.count | Should be 4 @@ -468,7 +468,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } return } - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Databasename contest -path $TestConfig.appveyorlabrepo\RestoreTimeClean2016 -RestoreTime (Get-Date "2019-05-02 21:23:58") -StandbyDirectory c:\temp + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Databasename contest -path $($TestConfig.appveyorlabrepo)\RestoreTimeClean2016 -RestoreTime (Get-Date "2019-05-02 21:23:58") -StandbyDirectory c:\temp $sqlResults = Invoke-DbaQuery -SqlInstance $TestConfig.instance2 -Query "select convert(datetime,convert(varchar(20),max(dt),120)) as maxdt, convert(datetime,convert(varchar(20),min(dt),120)) as mindt from contest.dbo.steps" It "Should have restored 4 files" { $results.count | Should be 4 @@ -479,7 +479,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { It "Should have restored to 05/02/2019 21:23:56" { $sqlResults.maxdt | Should be (Get-Date "02 May 2019 21:23:56") } - $results2 = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Databasename contest -path $TestConfig.appveyorlabrepo\RestoreTimeClean2016 -Continue + $results2 = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Databasename contest -path $($TestConfig.appveyorlabrepo)\RestoreTimeClean2016 -Continue $sqlResults2 = Invoke-DbaQuery -SqlInstance $TestConfig.instance2 -Query "select convert(datetime,convert(varchar(20),max(dt),120)) as maxdt, convert(datetime,convert(varchar(20),min(dt),120)) as mindt from contest.dbo.steps" It "Should have restored 2 files" { $results2.count | Should be 2 @@ -496,7 +496,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { AfterAll { $null = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -ExcludeSystem | Remove-DbaDatabase -Confirm:$false } - $Results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\sql2008-backups\ft1\FULL\ -NoRecovery + $Results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\sql2008-backups\ft1\FULL\ -NoRecovery It "Should Have restored the database cleanly" { ($results.RestoreComplete -contains $false) | Should be $False (($results | Measure-Object).count -gt 0) | Should be $True @@ -504,7 +504,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { It "Should have left the db in a norecovery state" { (Get-DbaDatabase -SqlInstance $TestConfig.instance2 -Database ft1).Status | Should Be "Restoring" } - $Results2 = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\sql2008-backups\ft1\ -Continue + $Results2 = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\sql2008-backups\ft1\ -Continue It "Should Have restored the database cleanly" { ($results.RestoreComplete -contains $false) | Should be $False (($results | Measure-Object).count -gt 0) | Should be $True @@ -518,7 +518,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { AfterAll { $null = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -ExcludeSystem | Remove-DbaDatabase -Confirm:$false } - $Results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName contest -Path $TestConfig.appveyorlabrepo\sql2008-backups\ft1\FULL\ -NoRecovery + $Results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName contest -Path $($TestConfig.appveyorlabrepo)\sql2008-backups\ft1\FULL\ -NoRecovery It "Should Have restored the database cleanly" { ($results.RestoreComplete -contains $false) | Should be $False (($results | Measure-Object).count -gt 0) | Should be $True @@ -526,7 +526,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { It "Should have left the db in a norecovery state" { (Get-DbaDatabase -SqlInstance $TestConfig.instance2 -Database contest).Status | Should Be "Restoring" } - $Results2 = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName contest -Path $TestConfig.appveyorlabrepo\sql2008-backups\ft1\ -Continue + $Results2 = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName contest -Path $($TestConfig.appveyorlabrepo)\sql2008-backups\ft1\ -Continue It "Should Have restored the database cleanly" { ($results2.RestoreComplete -contains $false) | Should be $False (($results2 | Measure-Object).count -gt 0) | Should be $True @@ -541,8 +541,8 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $null = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -ExcludeSystem | Remove-DbaDatabase -Confirm:$false } $files = @() - $files += Get-ChildItem $TestConfig.appveyorlabrepo\sql2008-backups\db1\FULL\ - $files += Get-ChildItem $TestConfig.appveyorlabrepo\sql2008-backups\dbareports\FULL + $files += Get-ChildItem $($TestConfig.appveyorlabrepo)\sql2008-backups\db1\FULL\ + $files += Get-ChildItem $($TestConfig.appveyorlabrepo)\sql2008-backups\dbareports\FULL $Results = $files | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -NoRecovery It "Should Have restored the database cleanly" { ($results.RestoreComplete -contains $false) | Should be $False @@ -552,8 +552,8 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { (Get-DbaDatabase -SqlInstance $TestConfig.instance2 | Where-Object { $_.Status -eq 'Recovering' }).count | Should Be 0 } $files = @() - $files += Get-ChildItem $TestConfig.appveyorlabrepo\sql2008-backups\db1\ -Recurse - $files += Get-ChildItem $TestConfig.appveyorlabrepo\sql2008-backups\dbareports\ -Recurse + $files += Get-ChildItem $($TestConfig.appveyorlabrepo)\sql2008-backups\db1\ -Recurse + $files += Get-ChildItem $($TestConfig.appveyorlabrepo)\sql2008-backups\dbareports\ -Recurse $Results2 = $files | Where-Object { $_.PsIsContainer -eq $false } | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Continue It "Should Have restored the database cleanly" { ($results2.RestoreComplete -contains $false) | Should be $False @@ -565,7 +565,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Backup DB For next test" { - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $TestConfig.appveyorlabrepo\RestoreTimeClean2016\restoretimeclean.bak + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $($TestConfig.appveyorlabrepo)\RestoreTimeClean2016\restoretimeclean.bak $results = Backup-DbaDatabase -SqlInstance $TestConfig.instance2 -Database RestoreTimeClean -BackupDirectory C:\temp It "Should return successful backup" { $results.BackupComplete | Should Be $true @@ -603,7 +603,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Restores a db with log and file files missing extensions" { - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $TestConfig.appveyorlabrepo\sql2008-backups\Noextension.bak -ErrorVariable Errvar -WarningVariable WarnVar + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -path $($TestConfig.appveyorlabrepo)\sql2008-backups\Noextension.bak -ErrorVariable Errvar -WarningVariable WarnVar It "Should Restore successfully" { ($results.RestoreComplete -contains $false) | Should Be $false (($results | Measure-Object).count -gt 0) | Should be $True @@ -621,7 +621,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "Setup for Recovery Tests" { $DatabaseName = 'rectest' - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -NoRecovery -DatabaseName $DatabaseName -DestinationFilePrefix $DatabaseName -WithReplace + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -NoRecovery -DatabaseName $DatabaseName -DestinationFilePrefix $DatabaseName -WithReplace It "Should have restored everything successfully" { ($results.RestoreComplete -contains $false) | Should be $False (($results | Measure-Object).count -gt 0) | Should be $True @@ -653,7 +653,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "Setup for Recovery Tests" { $DatabaseName = 'rectest' - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -NoRecovery -DatabaseName $DatabaseName -DestinationFilePrefix $DatabaseName -WithReplace + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -NoRecovery -DatabaseName $DatabaseName -DestinationFilePrefix $DatabaseName -WithReplace It "Should have restored everything successfully" { ($results.RestoreComplete -contains $false) | Should be $False (($results | Measure-Object).count -gt 0) | Should be $True @@ -685,7 +685,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "Checking we cope with a port number (#244)" { $DatabaseName = 'rectest' - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2_detailed -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -DestinationFilePrefix $DatabaseName -WithReplace + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2_detailed -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -DestinationFilePrefix $DatabaseName -WithReplace It "Should have restored everything successfully" { ($results.RestoreComplete -contains $false) | Should be $False (($results | Measure-Object).count -gt 0) | Should be $True @@ -701,7 +701,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "Checking OutputScriptOnly only outputs script" { $DatabaseName = 'rectestSO' - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -OutputScriptOnly + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -OutputScriptOnly $db = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -Database $DatabaseName It "Should only output a script" { $results -match 'RESTORE DATABASE' | Should be $True @@ -713,7 +713,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Get-DbaDatabase -SqlInstance $TestConfig.instance2 -Database $DatabaseName | Remove-DbaDatabase -Confirm:$false $server = Connect-DbaInstance $TestConfig.instance2 $server.Query("CREATE DATABASE $DatabaseName") - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -OutputScriptOnly -WithReplace + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -OutputScriptOnly -WithReplace $db = Get-DbaDatabase -SqlInstance $TestConfig.instance2 -Database $DatabaseName It "Should only output a script" { $results -match 'RESTORE DATABASE' | Should be $True @@ -731,7 +731,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Checking Output vs input" { $DatabaseName = 'rectestSO' - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -BufferCount 24 -MaxTransferSize 128kb -BlockSize 64kb + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -BufferCount 24 -MaxTransferSize 128kb -BlockSize 64kb It "Should return the destination instance" { $results.SqlInstance = $TestConfig.instance2 @@ -758,16 +758,16 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Checking CDC parameter " { - $output = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -OutputScriptOnly -KeepCDC -WithReplace + $output = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -OutputScriptOnly -KeepCDC -WithReplace It "Should have KEEP_CDC in the SQL" { ($output -like '*KEEP_CDC*') | Should be $True } - $output = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -OutputScriptOnly -KeepCDC -WithReplace -WarningVariable warnvar -NoRecovery -WarningAction SilentlyContinue + $output = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -OutputScriptOnly -KeepCDC -WithReplace -WarningVariable warnvar -NoRecovery -WarningAction SilentlyContinue It "Should not output, and warn if Norecovery and KeepCDC specified" { ($warnvar -like '*KeepCDC cannot be specified with Norecovery or Standby as it needs recovery to work') | Should be $True $output | Should be $null } - $output = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -OutputScriptOnly -KeepCDC -WithReplace -WarningVariable warnvar -StandbyDirectory c:\temp\ -WarningAction SilentlyContinue + $output = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -OutputScriptOnly -KeepCDC -WithReplace -WarningVariable warnvar -StandbyDirectory c:\temp\ -WarningAction SilentlyContinue It "Should not output, and warn if StandbyDirectory and KeepCDC specified" { ($warnvar -like '*KeepCDC cannot be specified with Norecovery or Standby as it needs recovery to work') | Should be $True $output | Should be $null @@ -776,7 +776,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "Page level restores" { Get-DbaDatabase -SqlInstance $TestConfig.instance2 -ExcludeSystem | Remove-DbaDatabase -confirm:$false - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName PageRestore -DestinationFilePrefix PageRestore + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName PageRestore -DestinationFilePrefix PageRestore $sql = "alter database PageRestore set Recovery Full Create table testpage( Filler char(8000) @@ -846,7 +846,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "Testing Backup to Restore piping" { Get-DbaDatabase -SqlInstance $TestConfig.instance2 -ExcludeSystem | Remove-DbaDatabase -Confirm:$false - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName PipeTest -DestinationFilePrefix PipeTest + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName PipeTest -DestinationFilePrefix PipeTest $results = Backup-DbaDatabase -SqlInstance $TestConfig.instance2 -Database Pipetest -BackupDirectory c:\temp -CopyOnly -WarningAction SilentlyContinue -WarningVariable bwarnvar -ErrorAction SilentlyContinue -ErrorVariable berrvar | Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -DatabaseName restored -ReplaceDbNameInFile -WarningAction SilentlyContinue -WarningVariable rwarnvar -ErrorAction SilentlyContinue -ErrorVariable rerrvar It "Should backup and restore cleanly" { $results.RestoreComplete | Should Be $True @@ -855,7 +855,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { Context "Check we restore striped database" { Get-DbaDatabase -SqlInstance $TestConfig.instance2 -ExcludeSystem | Remove-DbaDatabase -Confirm:$false - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\sql2008-backups\RestoreTimeStripe -DatabaseName StripeTest -DestinationFilePrefix StripeTest + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\sql2008-backups\RestoreTimeStripe -DatabaseName StripeTest -DestinationFilePrefix StripeTest It "Should backup and restore cleanly" { ($results | Where-Object { $_.RestoreComplete -eq $True }).count | Should Be $Results.count } @@ -863,14 +863,14 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Don't try to create/test folders with OutputScriptOnly (Issue 4046)" { - $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\RestoreTimeClean2016\RestoreTimeClean.bak -DestinationDataDirectory g:\DoesNtExist -OutputScriptOnly -WarningVariable warnvar + $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\RestoreTimeClean2016\RestoreTimeClean.bak -DestinationDataDirectory g:\DoesNtExist -OutputScriptOnly -WarningVariable warnvar It "Should not raise a warning" { ('' -eq $warnvar) | Should -Be $True } } Context "Checking that WITH KEEP_REPLICATION gets properly added" { $DatabaseName = 'reptestSO' - $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $TestConfig.appveyorlabrepo\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -OutputScriptOnly -KeepReplication + $results = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Path $($TestConfig.appveyorlabrepo)\singlerestore\singlerestore.bak -DatabaseName $DatabaseName -OutputScriptOnly -KeepReplication It "Should output a script with keep replication clause" { $results -match 'RESTORE DATABASE.*WITH.*KEEP_REPLICATION' | Should be $True } @@ -896,7 +896,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Test restoring with StopAt" { - $restoreOutput = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Name StopAt2 -Path $TestConfig.appveyorlabrepo\sql2008-backups\StopAt -StopMark dbatoolstest -WithReplace + $restoreOutput = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Name StopAt2 -Path $($TestConfig.appveyorlabrepo)\sql2008-backups\StopAt -StopMark dbatoolstest -WithReplace $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Name StopAt2 -Recover $sqlOut = Invoke-DbaQuery -SqlInstance $TestConfig.instance2 -Database StopAt2 -Query "select max(step) as ms from steps" It "Should have stoped at mark" { @@ -906,7 +906,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Test restoring with StopAtBefore" { - $restoreOutput = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Name StopAt2 -Path $TestConfig.appveyorlabrepo\sql2008-backups\StopAt -StopMark dbatoolstest -WithReplace -StopBefore + $restoreOutput = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Name StopAt2 -Path $($TestConfig.appveyorlabrepo)\sql2008-backups\StopAt -StopMark dbatoolstest -WithReplace -StopBefore $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Name StopAt2 -Recover $sqlOut = Invoke-DbaQuery -SqlInstance $TestConfig.instance2 -Database StopAt2 -Query "select max(step) as ms from steps" It "Should have stoped at mark" { @@ -916,7 +916,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Test restoring with StopAt and StopAfterDate" { - $restoreOutput = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Name StopAt2 -Path $TestConfig.appveyorlabrepo\sql2008-backups\StopAt -StopMark dbatoolstest -StopAfterDate (Get-Date '2020-05-12 13:33:35') -WithReplace + $restoreOutput = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Name StopAt2 -Path $($TestConfig.appveyorlabrepo)\sql2008-backups\StopAt -StopMark dbatoolstest -StopAfterDate (Get-Date '2020-05-12 13:33:35') -WithReplace $null = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Name StopAt2 -Recover $sqlOut = Invoke-DbaQuery -SqlInstance $TestConfig.instance2 -Database StopAt2 -Query "select max(step) as ms from steps" It "Should have stoped at mark" { @@ -926,7 +926,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { } Context "Warn if OutputScriptOnly and VerifyOnly specified together #6987" { - $restoreOutput = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Name StopAt2 -Path $TestConfig.appveyorlabrepo\sql2008-backups\StopAt -OutputScriptOnly -VerifyOnly -WarningVariable warnvar + $restoreOutput = Restore-DbaDatabase -SqlInstance $TestConfig.instance2 -Name StopAt2 -Path $($TestConfig.appveyorlabrepo)\sql2008-backups\StopAt -OutputScriptOnly -VerifyOnly -WarningVariable warnvar It "Should return a warning" { $warnvar | Should -BeLike '*The switches OutputScriptOnly and VerifyOnly cannot both be specified at the same time, stopping' } diff --git a/tests/Revoke-DbaAgPermission.Tests.ps1 b/tests/Revoke-DbaAgPermission.Tests.ps1 index 45c920055a..8dc8c7c9c2 100644 --- a/tests/Revoke-DbaAgPermission.Tests.ps1 +++ b/tests/Revoke-DbaAgPermission.Tests.ps1 @@ -15,7 +15,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Describe "$commandname Integration Tests" -Tag "IntegrationTests" { BeforeAll { - $null = Invoke-DbaQuery -SqlInstance $TestConfig.instance3 -InputFile $TestConfig.appveyorlabrepo\sql2008-scripts\logins.sql -ErrorAction SilentlyContinue + $null = Invoke-DbaQuery -SqlInstance $TestConfig.instance3 -InputFile $($TestConfig.appveyorlabrepo)\sql2008-scripts\logins.sql -ErrorAction SilentlyContinue $agname = "dbatoolsci_ag_revoke" $null = New-DbaAvailabilityGroup -Primary $TestConfig.instance3 -Name $agname -ClusterType None -FailoverMode Manual -Confirm:$false -Certificate dbatoolsci_AGCert } diff --git a/tests/Test-DbaComputerCertificateExpiration.Tests.ps1 b/tests/Test-DbaComputerCertificateExpiration.Tests.ps1 index 5066026424..c29e8a5bc8 100644 --- a/tests/Test-DbaComputerCertificateExpiration.Tests.ps1 +++ b/tests/Test-DbaComputerCertificateExpiration.Tests.ps1 @@ -20,7 +20,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } It "reports that the certificate is expired" { - $null = Add-DbaComputerCertificate -Path $TestConfig.appveyorlabrepo\certificates\localhost.crt -Confirm:$false + $null = Add-DbaComputerCertificate -Path $($TestConfig.appveyorlabrepo)\certificates\localhost.crt -Confirm:$false $thumbprint = "29C469578D6C6211076A09CEE5C5797EEA0C2713" $results = Test-DbaComputerCertificateExpiration -Thumbprint $thumbprint $results | Select-Object -ExpandProperty Note | Should -Be "This certificate has expired and is no longer valid" diff --git a/tests/Test-DbaLastBackup.Tests.ps1 b/tests/Test-DbaLastBackup.Tests.ps1 index 4c0ac45550..deb7890b86 100644 --- a/tests/Test-DbaLastBackup.Tests.ps1 +++ b/tests/Test-DbaLastBackup.Tests.ps1 @@ -90,9 +90,9 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { } Context "Test dbsize skip and cleanup (Issue 3968)" { - $results1 = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Database bigtestrest -Path $TestConfig.appveyorlabrepo\sql2008-backups\db1\FULL -ReplaceDbNameInFile + $results1 = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Database bigtestrest -Path $($TestConfig.appveyorlabrepo)\sql2008-backups\db1\FULL -ReplaceDbNameInFile Backup-DbaDatabase -SqlInstance $TestConfig.instance1 -Database bigtestrest - $results1 = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Database smalltestrest -Path $TestConfig.appveyorlabrepo\sql2008-backups\db2\FULL\SQL2008_db2_FULL_20170518_041738.bak -ReplaceDbNameInFile + $results1 = Restore-DbaDatabase -SqlInstance $TestConfig.instance1 -Database smalltestrest -Path $($TestConfig.appveyorlabrepo)\sql2008-backups\db2\FULL\SQL2008_db2_FULL_20170518_041738.bak -ReplaceDbNameInFile Backup-DbaDatabase -SqlInstance $TestConfig.instance1 -Database smalltestrest $results = Test-DbaLastBackup -SqlInstance $TestConfig.instance1 -Database bigtestrest, smalltestrest -CopyFile -CopyPath c:\temp -MaxSize 3 -Prefix testlast