@@ -100,13 +100,15 @@ LEFT JOIN dbo.TestTable2 t2 ON t1.Id = t2.TestTable1Id;
100100 It " Builds a DACPAC from a directory with SQL files recursively" {
101101 $outputDacpac = " $testFolder \output-recursive.dacpac"
102102 $splatBuildRecursive = @ {
103- Path = $sqlSourcePath
104- OutputPath = $outputDacpac
105- Recursive = $true
106- DatabaseName = " TestDatabase"
103+ Path = $sqlSourcePath
104+ OutputPath = $outputDacpac
105+ Recursive = $true
106+ DatabaseName = " TestDatabase"
107+ WarningAction = " SilentlyContinue"
107108 }
108109 $result = New-DbaDacPackage @splatBuildRecursive
109110
111+ $WarnVar | Should - BeLike " *Skipping empty file: *\Schema\EmptyFile.sql"
110112 $result | Should -Not - BeNullOrEmpty
111113 $result.Success | Should - BeTrue
112114 $result.Path | Should - Be $outputDacpac
@@ -125,9 +127,11 @@ LEFT JOIN dbo.TestTable2 t2 ON t1.Id = t2.TestTable1Id;
125127 DatabaseName = " VersionedDB"
126128 DacVersion = " 2.1.0.0"
127129 DacDescription = " Test DACPAC with version"
130+ WarningAction = " SilentlyContinue"
128131 }
129132 $result = New-DbaDacPackage @splatBuildVersioned
130133
134+ $WarnVar | Should - BeLike " *Skipping empty file: *\Schema\EmptyFile.sql"
131135 $result | Should -Not - BeNullOrEmpty
132136 $result.Success | Should - BeTrue
133137 $result.Version | Should - Be " 2.1.0.0"
@@ -142,9 +146,11 @@ LEFT JOIN dbo.TestTable2 t2 ON t1.Id = t2.TestTable1Id;
142146 Recursive = $true
143147 DatabaseName = " Sql2017DB"
144148 SqlServerVersion = " Sql140"
149+ WarningAction = " SilentlyContinue"
145150 }
146151 $result = New-DbaDacPackage @splatBuildTargeted
147152
153+ $WarnVar | Should - BeLike " *Skipping empty file: *\Schema\EmptyFile.sql"
148154 $result | Should -Not - BeNullOrEmpty
149155 $result.Success | Should - BeTrue
150156 Test-Path $outputDacpac | Should - BeTrue
@@ -153,13 +159,15 @@ LEFT JOIN dbo.TestTable2 t2 ON t1.Id = t2.TestTable1Id;
153159 It " Builds from non-recursive directory scan" {
154160 $outputDacpac = " $testFolder \output-nonrecursive.dacpac"
155161 $splatBuildNonRecursive = @ {
156- Path = $sqlSourcePath
157- OutputPath = $outputDacpac
158- DatabaseName = " NonRecursiveDB"
162+ Path = $sqlSourcePath
163+ OutputPath = $outputDacpac
164+ DatabaseName = " NonRecursiveDB"
165+ WarningAction = " SilentlyContinue"
159166 }
160167 $result = New-DbaDacPackage @splatBuildNonRecursive
161168
162169 # Non-recursive should only find the EmptyFile.sql in the root
170+ $WarnVar | Should - BeLike " *Skipping empty file: *\Schema\EmptyFile.sql"
163171 $result | Should -Not - BeNullOrEmpty
164172 # May succeed or fail depending on if there are valid SQL files in root
165173 }
@@ -169,13 +177,15 @@ LEFT JOIN dbo.TestTable2 t2 ON t1.Id = t2.TestTable1Id;
169177 It " Returns object with Path property for pipeline compatibility" {
170178 $outputDacpac = " $testFolder \output-pipeline.dacpac"
171179 $splatBuildPipeline = @ {
172- Path = $sqlSourcePath
173- OutputPath = $outputDacpac
174- Recursive = $true
175- DatabaseName = " PipelineDB"
180+ Path = $sqlSourcePath
181+ OutputPath = $outputDacpac
182+ Recursive = $true
183+ DatabaseName = " PipelineDB"
184+ WarningAction = " SilentlyContinue"
176185 }
177186 $result = New-DbaDacPackage @splatBuildPipeline
178187
188+ $WarnVar | Should - BeLike " *Skipping empty file: *\Schema\EmptyFile.sql"
179189 $result | Should -Not - BeNullOrEmpty
180190 $result.Path | Should -Not - BeNullOrEmpty
181191 $result.Database | Should -Not - BeNullOrEmpty
@@ -199,13 +209,15 @@ LEFT JOIN dbo.TestTable2 t2 ON t1.Id = t2.TestTable1Id;
199209 It " Built DACPAC can be loaded by DacFx" {
200210 $outputDacpac = " $testFolder \output-loadtest.dacpac"
201211 $splatBuildLoadTest = @ {
202- Path = $sqlSourcePath
203- OutputPath = $outputDacpac
204- Recursive = $true
205- DatabaseName = " LoadTestDB"
212+ Path = $sqlSourcePath
213+ OutputPath = $outputDacpac
214+ Recursive = $true
215+ DatabaseName = " LoadTestDB"
216+ WarningAction = " SilentlyContinue"
206217 }
207218 $result = New-DbaDacPackage @splatBuildLoadTest
208219
220+ $WarnVar | Should - BeLike " *Skipping empty file: *\Schema\EmptyFile.sql"
209221 $result.Success | Should - BeTrue
210222
211223 # Verify the DACPAC can be loaded
0 commit comments