Skip to content

Commit c570082

Browse files
committed
Adjusting pathing tests s'more
1 parent f09cbc2 commit c570082

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

tests/Add-DBOBuild.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,11 @@ Describe "Add-DBOBuild tests" -Tag $commandName, UnitTests {
192192
$testResults.Name | Should Be (Split-Path $packageNameTest -Leaf)
193193
Test-Path $packageNameTest | Should Be $true
194194
$scripts = $testResults.GetBuild('2.0').Scripts
195-
Join-PSFPath -Normalize 'content\2.0' ((Resolve-Path $v2scripts -Relative) -replace '^\.\\', '')| Should BeIn $scripts.GetPackagePath()
195+
Join-PSFPath -Normalize 'content\2.0' ((Resolve-Path $v2scripts -Relative) -replace '^\.\\|^\.\/', '')| Should BeIn $scripts.GetPackagePath()
196196
Join-PSFPath -Normalize 'content\2.0\1.sql' | Should Not BeIn $scripts.GetPackagePath()
197197
$items = Get-ArchiveItem $packageNameTest
198198
Join-PSFPath -Normalize 'content\1.0\1.sql' | Should BeIn $items.Path
199-
Join-PSFPath -Normalize 'content\2.0' ((Resolve-Path $v2scripts -Relative) -replace '^\.\\', '') | Should BeIn $items.Path
199+
Join-PSFPath -Normalize 'content\2.0' ((Resolve-Path $v2scripts -Relative) -replace '^\.\\|^\.\/', '') | Should BeIn $items.Path
200200
}
201201
It "should add new build to existing package as an absolute path" {
202202
$testResults = Add-DBOBuild -ScriptPath $v2scripts -Name $packageNameTest -Build 2.0 -Absolute

tests/DBOpsFile.class.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Describe "DBOpsFile class tests" -Tag $commandName, UnitTests, DBOpsFile {
160160
$pkg = [DBOpsPackage]::new()
161161
$build = $pkg.NewBuild('1.0')
162162
$pkg.SaveToFile($packageName, $true)
163-
$file = [DBOpsFile]::new($fileObject1, $script1, 'success\1.sql', $true)
163+
$file = [DBOpsFile]::new($fileObject1, $script1, (Join-PSFPath -Normalize 'success\1.sql'), $true)
164164
$cFile = [DBOpsFile]::new($fileObject1, 'whatever.ps1', 'whatever.ps1')
165165
$build.AddFile($file, 'Scripts')
166166
$pkg.AddFile($cfile, 'PreDeployFile')

tests/mysql/Install-DBOSqlScript.Tests.ps1

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
4747
It "should deploy version 1.0 to a new database using -CreateDatabase switch" {
4848
# drop the database before installing the package
4949
$null = Invoke-DBOQuery -Type MySQL -SqlInstance $script:mysqlInstance -Silent -Credential $script:mysqlCredential -Database mysql -Query $dropDatabaseScript
50-
$testResults = Install-DBOSqlScript -Type MySQL -ScriptPath $v1scripts -CreateDatabase -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -OutputFile "$workFolder\log.txt" -Silent
50+
$testResults = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath $v1scripts -CreateDatabase -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -OutputFile "$workFolder\log.txt" -Silent
5151
$testResults.Successful | Should Be $true
5252
$testResults.Scripts.Name | Should Be (Resolve-Path $v1scripts).Path
5353
$testResults.SqlInstance | Should Be $script:mysqlInstance
@@ -81,7 +81,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
8181
It "Should throw an error and not create any objects" {
8282
#Running package
8383
try {
84-
$null = Install-DBOSqlScript -Type MySQL -Path $tranFailScripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -DeploymentMethod SingleTransaction -Silent
84+
$null = Install-DBOSqlScript -Absolute -Type MySQL -Path $tranFailScripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -DeploymentMethod SingleTransaction -Silent
8585
}
8686
catch {
8787
$testResults = $_
@@ -104,7 +104,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
104104
It "Should throw an error and create one object" {
105105
#Running package
106106
try {
107-
$null = Install-DBOSqlScript -Type MySQL -Path $tranFailScripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -DeploymentMethod NoTransaction -Silent
107+
$null = Install-DBOSqlScript -Absolute -Type MySQL -Path $tranFailScripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -DeploymentMethod NoTransaction -Silent
108108
}
109109
catch {
110110
$testResults = $_
@@ -124,7 +124,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
124124
$null = Invoke-DBOQuery -Type MySQL -SqlInstance $script:mysqlInstance -Silent -Credential $script:mysqlCredential -Database $newDbName -InputFile $cleanupScript
125125
}
126126
It "should deploy version 1.0" {
127-
$testResults = Install-DBOSqlScript -Type MySQL -ScriptPath $v1scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -Silent
127+
$testResults = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath $v1scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -Silent
128128
$testResults.Successful | Should Be $true
129129
$testResults.Scripts.Name | Should Be (Resolve-Path $v1scripts).Path
130130
$testResults.SqlInstance | Should Be $script:mysqlInstance
@@ -148,7 +148,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
148148
'd' | Should Not BeIn $testResults.name
149149
}
150150
It "should deploy version 2.0" {
151-
$testResults = Install-DBOSqlScript -Type MySQL -ScriptPath $v2scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -Silent
151+
$testResults = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath $v2scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -Silent
152152
$testResults.Successful | Should Be $true
153153
$testResults.Scripts.Name | Should Be (Resolve-Path $v2scripts).Path
154154
$testResults.SqlInstance | Should Be $script:mysqlInstance
@@ -177,7 +177,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
177177
$null = Invoke-DBOQuery -Type MySQL -SqlInstance $script:mysqlInstance -Silent -Credential $script:mysqlCredential -Database $newDbName -InputFile $cleanupScript
178178
}
179179
It "should deploy 2.sql before 1.sql" {
180-
$testResults = Install-DBOSqlScript -Type MySQL -ScriptPath $v2scripts, $v1scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -Silent
180+
$testResults = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath $v2scripts, $v1scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -Silent
181181
$testResults.Successful | Should Be $true
182182
$testResults.Scripts.Name | Should Be (Resolve-Path $v2scripts, $v1scripts).Path
183183
$testResults.SqlInstance | Should Be $script:mysqlInstance
@@ -215,7 +215,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
215215
}
216216
It "should throw timeout error" {
217217
try {
218-
$null = Install-DBOSqlScript -Type MySQL -ScriptPath "$workFolder\delay.sql" -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -OutputFile "$workFolder\log.txt" -Silent -ExecutionTimeout 2
218+
$null = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath "$workFolder\delay.sql" -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -OutputFile "$workFolder\log.txt" -Silent -ExecutionTimeout 2
219219
}
220220
catch {
221221
$testResults = $_
@@ -227,7 +227,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
227227
$output | Should Not BeLike '*Successful!*'
228228
}
229229
It "should successfully run within specified timeout" {
230-
$testResults = Install-DBOSqlScript -Type MySQL -ScriptPath "$workFolder\delay.sql" -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -OutputFile "$workFolder\log.txt" -Silent -ExecutionTimeout 6
230+
$testResults = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath "$workFolder\delay.sql" -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -OutputFile "$workFolder\log.txt" -Silent -ExecutionTimeout 6
231231
$testResults.Successful | Should Be $true
232232
$testResults.Scripts.Name | Should Be (Join-PSFPath -Normalize "$workFolder\delay.sql")
233233
$testResults.SqlInstance | Should Be $script:mysqlInstance
@@ -246,7 +246,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
246246
$output | Should BeLike '*Successful!*'
247247
}
248248
It "should successfully run with infinite timeout" {
249-
$testResults = Install-DBOSqlScript -Type MySQL -ScriptPath "$workFolder\delay.sql" -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -OutputFile "$workFolder\log.txt" -Silent -ExecutionTimeout 0
249+
$testResults = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath "$workFolder\delay.sql" -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -OutputFile "$workFolder\log.txt" -Silent -ExecutionTimeout 0
250250
$testResults.Successful | Should Be $true
251251
$testResults.Scripts.Name | Should Be (Join-PSFPath -Normalize "$workFolder\delay.sql")
252252
$testResults.SqlInstance | Should Be $script:mysqlInstance
@@ -273,7 +273,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
273273
AfterAll {
274274
}
275275
It "should deploy nothing" {
276-
$testResults = Install-DBOSqlScript -Type MySQL -ScriptPath $v1scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -Silent -WhatIf
276+
$testResults = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath $v1scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -Silent -WhatIf
277277
$testResults.Successful | Should Be $true
278278
$testResults.Scripts.Name | Should Be $v1scripts
279279
$testResults.SqlInstance | Should Be $script:mysqlInstance
@@ -308,7 +308,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
308308
It "should deploy version 1.0" {
309309
$before = Invoke-DBOQuery -Type MySQL -SqlInstance $script:mysqlInstance -Silent -Credential $script:mysqlCredential -Database $newDbName -InputFile $verificationScript
310310
$rowsBefore = ($before | Measure-Object).Count
311-
$testResults = Install-DBOSqlScript -Type MySQL -ScriptPath $v1scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -Silent
311+
$testResults = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath $v1scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -Silent
312312
$testResults.Successful | Should Be $true
313313
$testResults.Scripts.Name | Should Be (Resolve-Path $v1scripts).Path
314314
$testResults.SqlInstance | Should Be $script:mysqlInstance
@@ -335,7 +335,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
335335
It "should deploy version 2.0" {
336336
$before = Invoke-DBOQuery -Type MySQL -SqlInstance $script:mysqlInstance -Silent -Credential $script:mysqlCredential -Database $newDbName -InputFile $verificationScript
337337
$rowsBefore = ($before | Measure-Object).Count
338-
$testResults = Install-DBOSqlScript -Type MySQL -ScriptPath $v2scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -Silent
338+
$testResults = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath $v2scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -Silent
339339
$testResults.Successful | Should Be $true
340340
$testResults.Scripts.Name | Should Be (Resolve-Path $v2scripts).Path
341341
$testResults.SqlInstance | Should Be $script:mysqlInstance
@@ -370,7 +370,7 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
370370
It "should deploy version 1.0 without creating SchemaVersions" {
371371
$before = Invoke-DBOQuery -Type MySQL -SqlInstance $script:mysqlInstance -Silent -Credential $script:mysqlCredential -Database $newDbName -InputFile $verificationScript
372372
$rowsBefore = ($before | Measure-Object).Count
373-
$testResults = Install-DBOSqlScript -Type MySQL -ScriptPath $v1scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -Silent -SchemaVersionTable $null
373+
$testResults = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath $v1scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -Silent -SchemaVersionTable $null
374374
$testResults.Successful | Should Be $true
375375
$testResults.Scripts.Name | Should Be (Resolve-Path $v1scripts).Path
376376
$testResults.SqlInstance | Should Be $script:mysqlInstance
@@ -399,13 +399,13 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
399399
Context "deployments with errors should throw terminating errors" {
400400
BeforeAll {
401401
$null = Invoke-DBOQuery -Type MySQL -SqlInstance $script:mysqlInstance -Silent -Credential $script:mysqlCredential -Database $newDbName -InputFile $cleanupScript
402-
$null = Install-DBOSqlScript -Type MySQL -ScriptPath $v1scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -Silent -SchemaVersionTable $null
402+
$null = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath $v1scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -Silent -SchemaVersionTable $null
403403
}
404404
It "Should return terminating error when object exists" {
405405
#Running package
406406
try {
407407
$testResults = $null
408-
$testResults = Install-DBOSqlScript -Type MySQL -Path $tranFailScripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -DeploymentMethod NoTransaction -Silent
408+
$testResults = Install-DBOSqlScript -Absolute -Type MySQL -Path $tranFailScripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -DeploymentMethod NoTransaction -Silent
409409
}
410410
catch {
411411
$errorObject = $_
@@ -418,8 +418,8 @@ Describe "Install-DBOSqlScript MySQL integration tests" -Tag $commandName, Integ
418418
#Running package
419419
try {
420420
$testResults = $null
421-
$null = Install-DBOSqlScript -Type MySQL -Path $tranFailScripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -DeploymentMethod NoTransaction -Silent
422-
$testResults = Install-DBOSqlScript -Type MySQL -ScriptPath $v2scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -Silent
421+
$null = Install-DBOSqlScript -Absolute -Type MySQL -Path $tranFailScripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -DeploymentMethod NoTransaction -Silent
422+
$testResults = Install-DBOSqlScript -Absolute -Type MySQL -ScriptPath $v2scripts -SqlInstance $script:mysqlInstance -Credential $script:mysqlCredential -Database $newDbName -SchemaVersionTable $logTable -Silent
423423
}
424424
catch {
425425
$errorObject = $_

0 commit comments

Comments
 (0)