@@ -177,6 +177,35 @@ Describe "Install-DBOSqlScript PostgreSQL integration tests" -Tag $commandName,
177
177
' d' | Should BeIn $testResults.name
178
178
}
179
179
}
180
+ Context " testing relative paths" {
181
+ BeforeAll {
182
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
183
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
184
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $createDatabaseScript
185
+ }
186
+ It " should deploy version 1.0" {
187
+ $testResults = Install-DBOSqlScript - Relative - Type PostgreSQL - ScriptPath $v1scripts - SqlInstance $script :postgresqlInstance - Credential $script :postgresqlCredential - Database $newDbName - SchemaVersionTable $logTable - Silent
188
+ $testResults.Successful | Should Be $true
189
+ $testResults.Scripts.Name | Should Be ((Resolve-Path $v1scripts - Relative) -replace ' ^.[\\|\/]' , ' ' )
190
+ $testResults.SqlInstance | Should Be $script :postgresqlInstance
191
+ $testResults.Database | Should Be $newDbName
192
+ $testResults.SourcePath | Should Be $v1scripts
193
+ $testResults.ConnectionType | Should Be ' PostgreSQL'
194
+ $testResults.Configuration.SchemaVersionTable | Should Be $logTable
195
+ $testResults.Error | Should BeNullOrEmpty
196
+ $testResults.Duration.TotalMilliseconds | Should - BeGreaterOrEqual 0
197
+ $testResults.StartTime | Should Not BeNullOrEmpty
198
+ $testResults.EndTime | Should Not BeNullOrEmpty
199
+ $testResults.EndTime | Should - BeGreaterOrEqual $testResults.StartTime
200
+ ' Upgrade successful' | Should BeIn $testResults.DeploymentLog
201
+
202
+ # Verifying objects
203
+ $testResults = Invoke-DBOQuery - Type PostgreSQL - SqlInstance $script :postgresqlInstance - Silent - Credential $script :postgresqlCredential - Database $newDbName - InputFile $verificationScript
204
+ $logTable | Should BeIn $testResults.name
205
+ ' a' | Should BeIn $testResults.name
206
+ ' b' | Should BeIn $testResults.name
207
+ }
208
+ }
180
209
Context " testing deployment order" {
181
210
BeforeAll {
182
211
$null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
@@ -329,9 +358,9 @@ Describe "Install-DBOSqlScript PostgreSQL integration tests" -Tag $commandName,
329
358
It " should deploy version 1.0" {
330
359
$before = Invoke-DBOQuery - Type PostgreSQL - SqlInstance $script :postgresqlInstance - Silent - Credential $script :postgresqlCredential - Database $newDbName - InputFile $verificationScript
331
360
$rowsBefore = ($before | Measure-Object ).Count
332
- $testResults = Install-DBOSqlScript - Absolute - Type PostgreSQL - ScriptPath $v1scripts - SqlInstance $script :postgresqlInstance - Credential $script :postgresqlCredential - Database $newDbName - Silent
361
+ $testResults = Install-DBOSqlScript - Type PostgreSQL - ScriptPath $v1scripts - SqlInstance $script :postgresqlInstance - Credential $script :postgresqlCredential - Database $newDbName - Silent
333
362
$testResults.Successful | Should Be $true
334
- $testResults.Scripts.Name | Should Be (Resolve-Path $v1scripts ).Path
363
+ $testResults.Scripts.Name | Should Be (Get-Item $v1scripts ).Name
335
364
$testResults.SqlInstance | Should Be $script :postgresqlInstance
336
365
$testResults.Database | Should Be $newDbName
337
366
$testResults.SourcePath | Should Be $v1scripts
@@ -356,9 +385,9 @@ Describe "Install-DBOSqlScript PostgreSQL integration tests" -Tag $commandName,
356
385
It " should deploy version 2.0" {
357
386
$before = Invoke-DBOQuery - Type PostgreSQL - SqlInstance $script :postgresqlInstance - Silent - Credential $script :postgresqlCredential - Database $newDbName - InputFile $verificationScript
358
387
$rowsBefore = ($before | Measure-Object ).Count
359
- $testResults = Install-DBOSqlScript - Absolute - Type PostgreSQL - ScriptPath $v2scripts - SqlInstance $script :postgresqlInstance - Credential $script :postgresqlCredential - Database $newDbName - Silent
388
+ $testResults = Install-DBOSqlScript - Type PostgreSQL - ScriptPath $v2scripts - SqlInstance $script :postgresqlInstance - Credential $script :postgresqlCredential - Database $newDbName - Silent
360
389
$testResults.Successful | Should Be $true
361
- $testResults.Scripts.Name | Should Be (Resolve-Path $v2scripts ).Path
390
+ $testResults.Scripts.Name | Should Be (Get-Item $v2scripts ).Name
362
391
$testResults.SqlInstance | Should Be $script :postgresqlInstance
363
392
$testResults.Database | Should Be $newDbName
364
393
$testResults.SourcePath | Should Be $v2scripts
0 commit comments