Skip to content

Commit

Permalink
add quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee committed Oct 20, 2024
1 parent 88abefe commit 1064bbf
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion tests/Add-DbaComputerCertificate.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/Backup-DbaComputerCertificate.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion tests/Copy-DbaDatabase.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions tests/Export-DbaBinaryFile.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions tests/Get-DbaBinaryFileTable.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/Get-DbaComputerCertificate.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions tests/Import-DbaBinaryFile.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Mount-DbaDatabase.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Remove-DbaComputerCertificate.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
16 changes: 8 additions & 8 deletions tests/Restore-DbaDatabase.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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" {
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -863,7 +863,7 @@ 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
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Test-DbaComputerCertificateExpiration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions tests/Test-DbaLastBackup.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1064bbf

Please sign in to comment.