@@ -457,9 +457,8 @@ Describe "Install-DBOScript integration tests" -Tag $commandName, IntegrationTes
457
457
}
458
458
}
459
459
Context " deployments with errors should throw terminating errors" {
460
- BeforeAll {
460
+ BeforeEach {
461
461
$null = Invoke-DBOQuery @connParams - InputFile $cleanupScript
462
- $null = Install-DBOScript - Absolute - ScriptPath $v1scripts @connParams - SchemaVersionTable $null
463
462
}
464
463
It " Should return terminating error when object exists" {
465
464
# Running package
@@ -474,6 +473,23 @@ Describe "Install-DBOScript integration tests" -Tag $commandName, IntegrationTes
474
473
$errorObject | Should Not BeNullOrEmpty
475
474
$errorObject.Exception.Message | Should Be " There is already an object named 'a' in the database."
476
475
}
476
+ It " Should return failure results with SilentlyContinue" {
477
+ $testResults = Install-DBOScript - Absolute - Path $tranFailScripts - SchemaVersionTable $logTable - DeploymentMethod NoTransaction @connParams - ErrorAction SilentlyContinue
478
+ $testResults | Should -Not - Be $null
479
+ $testResults.Successful | Should - Be $false
480
+ $testResults.SqlInstance | Should Be $script :mssqlInstance
481
+ $testResults.Database | Should Be $newDbName
482
+ $testResults.SourcePath | Should Be (Get-ChildItem $tranFailScripts ).FullName
483
+ $testResults.ConnectionType | Should Be ' SQLServer'
484
+ $testResults.Configuration.SchemaVersionTable | Should - Be $logTable
485
+ $testResults.Error.Message | Should Be " There is already an object named 'a' in the database."
486
+ $testResults.ErrorScript | Should - Be (Get-ChildItem $tranFailScripts )[1 ].FullName
487
+ $testResults.Scripts.Name | Should Be (Get-ChildItem $tranFailScripts )[0 ].FullName
488
+ $testResults.Duration.TotalMilliseconds | Should - BeGreaterOrEqual 0
489
+ $testResults.StartTime | Should -Not - BeNullOrEmpty
490
+ $testResults.EndTime | Should -Not - BeNullOrEmpty
491
+ $testResults.EndTime | Should - BeGreaterOrEqual $testResults.StartTime
492
+ }
477
493
It " should not deploy anything after throwing an error" {
478
494
# Running package
479
495
try {
@@ -490,7 +506,7 @@ Describe "Install-DBOScript integration tests" -Tag $commandName, IntegrationTes
490
506
# Verifying objects
491
507
$testResults = Invoke-DBOQuery @connParams - InputFile $verificationScript
492
508
' a' | Should BeIn $testResults.name
493
- ' b' | Should BeIn $testResults.name
509
+ ' b' | Should Not BeIn $testResults.name
494
510
' c' | Should Not BeIn $testResults.name
495
511
' d' | Should Not BeIn $testResults.name
496
512
}
0 commit comments