@@ -457,9 +457,8 @@ Describe "Install-DBOScript integration tests" -Tag $commandName, IntegrationTes
457457 }
458458 }
459459 Context " deployments with errors should throw terminating errors" {
460- BeforeAll {
460+ BeforeEach {
461461 $null = Invoke-DBOQuery @connParams - InputFile $cleanupScript
462- $null = Install-DBOScript - Absolute - ScriptPath $v1scripts @connParams - SchemaVersionTable $null
463462 }
464463 It " Should return terminating error when object exists" {
465464 # Running package
@@ -474,6 +473,23 @@ Describe "Install-DBOScript integration tests" -Tag $commandName, IntegrationTes
474473 $errorObject | Should Not BeNullOrEmpty
475474 $errorObject.Exception.Message | Should Be " There is already an object named 'a' in the database."
476475 }
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+ }
477493 It " should not deploy anything after throwing an error" {
478494 # Running package
479495 try {
@@ -490,7 +506,7 @@ Describe "Install-DBOScript integration tests" -Tag $commandName, IntegrationTes
490506 # Verifying objects
491507 $testResults = Invoke-DBOQuery @connParams - InputFile $verificationScript
492508 ' a' | Should BeIn $testResults.name
493- ' b' | Should BeIn $testResults.name
509+ ' b' | Should Not BeIn $testResults.name
494510 ' c' | Should Not BeIn $testResults.name
495511 ' d' | Should Not BeIn $testResults.name
496512 }
0 commit comments