@@ -80,15 +80,18 @@ Describe "Install-DBOPackage PostgreSQL tests" -Tag $commandName, IntegrationTes
80
80
AfterAll {
81
81
if ((Test-Path $workFolder ) -and $workFolder -like ' *.Tests.dbops' ) { Remove-Item $workFolder - Recurse }
82
82
$null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
83
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
83
84
}
84
85
Context " testing transactional deployment" {
85
86
BeforeAll {
86
87
$null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
88
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
87
89
$null = Invoke-DBOQuery @connParams - Database postgres - Query $createDatabaseScript
88
90
$null = New-DBOPackage - ScriptPath $tranFailScripts - Name $packageName - Build 1.0 - Force
89
91
}
90
92
AfterAll {
91
93
$null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
94
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
92
95
}
93
96
It " Should throw an error and create no tables" {
94
97
# Running package
@@ -105,11 +108,14 @@ Describe "Install-DBOPackage PostgreSQL tests" -Tag $commandName, IntegrationTes
105
108
}
106
109
Context " testing non transactional deployment" {
107
110
BeforeAll {
108
- $null = Invoke-DBOQuery @connParams - Database postgres - Query ($dropDatabaseScript + $createDatabaseScript )
111
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
112
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
113
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $createDatabaseScript
109
114
$null = New-DBOPackage - ScriptPath $tranFailScripts - Name $packageName - Build 1.0 - Force
110
115
}
111
116
AfterAll {
112
117
$null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
118
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
113
119
}
114
120
It " Should throw an error and create one object" {
115
121
# Running package
@@ -125,7 +131,9 @@ Describe "Install-DBOPackage PostgreSQL tests" -Tag $commandName, IntegrationTes
125
131
}
126
132
Context " testing regular deployment" {
127
133
BeforeAll {
128
- $null = Invoke-DBOQuery @connParams - Database postgres - Query ($dropDatabaseScript + $createDatabaseScript )
134
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
135
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
136
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $createDatabaseScript
129
137
$p1 = New-DBOPackage - ScriptPath $v1scripts - Name " $workFolder \pv1" - Build 1.0 - Force
130
138
$p1 = Add-DBOBuild - ScriptPath $v2scripts - Name $p1 - Build 2.0
131
139
# versions should not be sorted by default - creating a package where 1.0 is the second build
@@ -265,7 +273,9 @@ Describe "Install-DBOPackage PostgreSQL tests" -Tag $commandName, IntegrationTes
265
273
}
266
274
Context " testing timeouts" {
267
275
BeforeAll {
268
- $null = Invoke-DBOQuery @connParams - Database postgres - Query ($dropDatabaseScript + $createDatabaseScript )
276
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
277
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
278
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $createDatabaseScript
269
279
$file = Join-PSFPath - Normalize " $workFolder \delay.sql"
270
280
' SELECT pg_sleep(3); SELECT '' Successful!'' ;' | Set-Content $file
271
281
$null = New-DBOPackage - ScriptPath $file - Name " $workFolder \delay" - Build 1.0 - Force - Configuration @ { ExecutionTimeout = 2 }
@@ -322,11 +332,14 @@ Describe "Install-DBOPackage PostgreSQL tests" -Tag $commandName, IntegrationTes
322
332
}
323
333
Context " $commandName whatif tests" {
324
334
BeforeAll {
325
- $null = Invoke-DBOQuery @connParams - Database postgres - Query ($dropDatabaseScript + $createDatabaseScript )
335
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
336
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
337
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $createDatabaseScript
326
338
$null = New-DBOPackage - ScriptPath $v1scripts - Name $packageNamev1 - Build 1.0
327
339
}
328
340
AfterAll {
329
341
$null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
342
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
330
343
}
331
344
It " should deploy nothing" {
332
345
$testResults = Install-DBOPackage $packageNamev1 @connParams - Database $newDbName - SchemaVersionTable $logTable - WhatIf
@@ -356,6 +369,7 @@ Describe "Install-DBOPackage PostgreSQL tests" -Tag $commandName, IntegrationTes
356
369
Context " testing regular deployment with CreateDatabase specified" {
357
370
BeforeAll {
358
371
$null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
372
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
359
373
$p1 = New-DBOPackage - ScriptPath $v1scripts - Name " $workFolder \pv1" - Build 1.0 - Force
360
374
}
361
375
It " should deploy version 1.0 to a new database using -CreateDatabase switch" {
@@ -387,7 +401,9 @@ Describe "Install-DBOPackage PostgreSQL tests" -Tag $commandName, IntegrationTes
387
401
}
388
402
Context " testing regular deployment with configuration overrides" {
389
403
BeforeAll {
390
- $null = Invoke-DBOQuery @connParams - Database postgres - Query ($dropDatabaseScript + $createDatabaseScript )
404
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
405
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
406
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $createDatabaseScript
391
407
$p1 = New-DBOPackage - ScriptPath $v1scripts - Name " $workFolder \pv1" - Build 1.0 - Force - ConfigurationFile $fullConfig
392
408
$p2 = New-DBOPackage - ScriptPath $v2scripts - Name " $workFolder \pv2" - Build 2.0 - Force - Configuration @ {
393
409
SqlInstance = ' nonexistingServer'
@@ -470,7 +486,9 @@ Describe "Install-DBOPackage PostgreSQL tests" -Tag $commandName, IntegrationTes
470
486
}
471
487
Context " testing deployment without specifying SchemaVersion table" {
472
488
BeforeAll {
473
- $null = Invoke-DBOQuery @connParams - Database postgres - Query ($dropDatabaseScript + $createDatabaseScript )
489
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
490
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
491
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $createDatabaseScript
474
492
$p1 = New-DBOPackage - ScriptPath $v1scripts - Name " $workFolder \pv1" - Build 1.0 - Force
475
493
$p2 = New-DBOPackage - ScriptPath $v2scripts - Name " $workFolder \pv2" - Build 2.0 - Force
476
494
$outputFile = " $workFolder \log.txt"
@@ -536,7 +554,9 @@ Describe "Install-DBOPackage PostgreSQL tests" -Tag $commandName, IntegrationTes
536
554
Context " testing deployment with no history`: SchemaVersion is null" {
537
555
BeforeEach {
538
556
$null = New-DBOPackage - ScriptPath $v1scripts - Name " $workFolder \pv1" - Build 1.0 - Force
539
- $null = Invoke-DBOQuery @connParams - Database postgres - Query ($dropDatabaseScript + $createDatabaseScript )
557
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
558
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
559
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $createDatabaseScript
540
560
}
541
561
AfterEach {
542
562
$null = Invoke-DBOQuery @connParams - Database $newDbName - Query " DROP TABLE IF EXISTS SchemaVersions"
@@ -571,12 +591,15 @@ Describe "Install-DBOPackage PostgreSQL tests" -Tag $commandName, IntegrationTes
571
591
}
572
592
Context " testing deployment with defined schema" {
573
593
BeforeAll {
574
- $null = Invoke-DBOQuery @connParams - Database postgres - Query ($dropDatabaseScript + $createDatabaseScript )
594
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
595
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
596
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $createDatabaseScript
575
597
$null = Invoke-DBOQuery @connParams - Database $newDbName - Query " CREATE SCHEMA testschema"
576
598
$null = New-DBOPackage - ScriptPath $v1scripts - Name " $workFolder \pv1" - Build 1.0 - Force
577
599
}
578
600
AfterAll {
579
601
$null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
602
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
580
603
}
581
604
It " should deploy version 1.0 into testschema" {
582
605
$before = Invoke-DBOQuery @connParams - Database $newDbName - InputFile $verificationScript
@@ -610,7 +633,9 @@ Describe "Install-DBOPackage PostgreSQL tests" -Tag $commandName, IntegrationTes
610
633
BeforeAll {
611
634
$p1 = New-DBOPackage - ScriptPath $v1scripts - Name " $workFolder \pv1" - Build 1.0 - Force - Configuration @ {SqlInstance = ' #{srv}' ; Database = ' #{db}' }
612
635
$outputFile = " $workFolder \log.txt"
613
- $null = Invoke-DBOQuery @connParams - Database postgres - Query ($dropDatabaseScript + $createDatabaseScript )
636
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
637
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
638
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $createDatabaseScript
614
639
}
615
640
AfterAll {
616
641
$null = Invoke-DBOQuery @connParams - Database $newDbName - Query " DROP TABLE IF EXISTS SchemaVersions"
@@ -648,7 +673,9 @@ Describe "Install-DBOPackage PostgreSQL tests" -Tag $commandName, IntegrationTes
648
673
Context " testing deployment with custom connection string" {
649
674
BeforeAll {
650
675
$p1 = New-DBOPackage - ScriptPath $v1scripts - Name " $workFolder \pv1" - Build 1.0 - Force
651
- $null = Invoke-DBOQuery @connParams - Database postgres - Query ($dropDatabaseScript + $createDatabaseScript )
676
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $dropDatabaseScript
677
+ [Npgsql.NpgsqlConnection ]::ClearAllPools()
678
+ $null = Invoke-DBOQuery @connParams - Database postgres - Query $createDatabaseScript
652
679
}
653
680
It " should deploy version 1.0" {
654
681
$configCS = New-DBOConfig - Configuration @ {
0 commit comments