Skip to content

Commit 07955d0

Browse files
authored
Integration test use -ErrorAction 'Stop' for Test-DscConfiguration (#2088)
1 parent eefcd14 commit 07955d0

28 files changed

+127
-120
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ The format is based on and uses the types of changes according to [Keep a Change
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

66
## [Unreleased]
7+
78
### Removed
89

910
- SqlServerDsc.Common
@@ -58,6 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5859
- Fix style formatting in all PowerShell script files.
5960
- Update module description on GitHub, in the conceptual help, and in
6061
the module manifest.
62+
- Now integration tests will fail on an exception when the command `Test-DscConfiguration`
63+
is run.
6164
- Added Test-SqlDscIsRole to be used like Test-SqlDscIsLogin but tests for a server role as principal.
6265
- SqlSetup
6366
- Fixed issue with AddNode where cluster IP information was not being passed to
@@ -92,6 +95,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9295
- Change the alias command to real command name, to pass HQRM tests.
9396
- `SqlServiceAccount`
9497
- Change the alias command to real command name, to pass HQRM tests.
98+
- `Get-SqlDscRSSetupConfiguration`
99+
- The integration test was updated to verify so that the `CurrentVersion`
100+
and `ProductVersion` strings can be converted to valid versions and
101+
that they always are higher than what we expect.
95102

96103
## [17.0.0] - 2024-09-30
97104

tests/Integration/Commands/Get-SqlDscRSSetupConfiguration.Integration.Tests.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Describe 'Get-SqlDscRSSetupConfiguration' {
3737
$result.InstallFolder | Should -Be 'C:\Program Files\SSRS'
3838
$result.ServiceName | Should -Be 'SQLServerReportingServices'
3939
$result.ErrorDumpDirectory | Should -Be 'C:\Program Files\SSRS\SSRS\LogFiles'
40-
$result.CurrentVersion | Should -Be '14.0.601.20'
40+
[System.Version] $result.CurrentVersion | Should -BeGreaterOrEqual ([System.Version] '14.0.601.20')
4141
$result.ProductVersion | Should -BeNullOrEmpty
4242
$result.CustomerFeedback | Should -Be 1
4343
$result.EnableErrorReporting | Should -Be 1
@@ -59,8 +59,8 @@ Describe 'Get-SqlDscRSSetupConfiguration' {
5959
$result.InstallFolder | Should -Be 'C:\Program Files\SSRS'
6060
$result.ServiceName | Should -Be 'SQLServerReportingServices'
6161
$result.ErrorDumpDirectory | Should -Be 'C:\Program Files\SSRS\SSRS\LogFiles'
62-
$result.CurrentVersion | Should -Be '15.0.1103.41'
63-
$result.ProductVersion | Should -Be '15.0.9098.6826'
62+
[System.Version] $result.CurrentVersion | Should -BeGreaterOrEqual ([System.Version] '15.0.1103.41')
63+
[System.Version] $result.ProductVersion | Should -BeGreaterOrEqual ([System.Version] '15.0.9098.6826')
6464
$result.CustomerFeedback | Should -Be 1
6565
$result.EnableErrorReporting | Should -Be 1
6666
$result.VirtualRootServer | Should -Be 'ReportServer'
@@ -81,8 +81,8 @@ Describe 'Get-SqlDscRSSetupConfiguration' {
8181
$result.InstallFolder | Should -Be 'C:\Program Files\SSRS'
8282
$result.ServiceName | Should -Be 'SQLServerReportingServices'
8383
$result.ErrorDumpDirectory | Should -Be 'C:\Program Files\SSRS\SSRS\LogFiles'
84-
$result.CurrentVersion | Should -Be '16.0.1116.38'
85-
$result.ProductVersion | Should -Be '16.0.9101.19239'
84+
[System.Version] $result.CurrentVersion | Should -BeGreaterOrEqual ([System.Version] '16.0.1116.38')
85+
[System.Version] $result.ProductVersion | Should -BeGreaterOrEqual ([System.Version] '16.0.9101.19239')
8686
$result.CustomerFeedback | Should -Be 1
8787
$result.EnableErrorReporting | Should -Be 1
8888
$result.VirtualRootServer | Should -Be 'ReportServer'
@@ -102,8 +102,8 @@ Describe 'Get-SqlDscRSSetupConfiguration' {
102102
$result.InstallFolder | Should -Be 'C:\Program Files\PBIRS'
103103
$result.ServiceName | Should -Be 'PowerBIReportServer'
104104
$result.ErrorDumpDirectory | Should -Be 'C:\Program Files\PBIRS\PBIRS\LogFiles'
105-
$result.CurrentVersion | Should -Be '15.0.1117.98'
106-
$result.ProductVersion | Should -Be '1.22.9153.7886'
105+
[System.Version] $result.CurrentVersion | Should -BeGreaterOrEqual ([System.Version] '15.0.1117.98')
106+
[System.Version] $result.ProductVersion | Should -BeGreaterOrEqual ([System.Version] '1.22.9153.7886')
107107
$result.CustomerFeedback | Should -Be 1
108108
$result.EnableErrorReporting | Should -Be 1
109109
$result.VirtualRootServer | Should -Be 'ReportServer'

tests/Integration/Resources/DSC_SqlAgentAlert.Integration.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Describe "<dscResourceFriendlyName>_Integration" -Tag @('Integration_SQL2016', '
107107
}
108108

109109
It 'Should return $true when Test-DscConfiguration is run' {
110-
Test-DscConfiguration -Verbose | Should -Be 'True'
110+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
111111
}
112112
}
113113

@@ -163,7 +163,7 @@ Describe "<dscResourceFriendlyName>_Integration" -Tag @('Integration_SQL2016', '
163163
}
164164

165165
It 'Should return $true when Test-DscConfiguration is run' {
166-
Test-DscConfiguration -Verbose | Should -Be 'True'
166+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
167167
}
168168
}
169169
}

tests/Integration/Resources/DSC_SqlAgentFailsafe.Integration.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
107107
}
108108

109109
It 'Should return $true when Test-DscConfiguration is run' {
110-
Test-DscConfiguration -Verbose | Should -Be 'True'
110+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
111111
}
112112
}
113113

@@ -163,7 +163,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
163163
}
164164

165165
It 'Should return $true when Test-DscConfiguration is run' {
166-
Test-DscConfiguration -Verbose | Should -Be 'True'
166+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
167167
}
168168
}
169169
}

tests/Integration/Resources/DSC_SqlAgentOperator.Integration.Tests.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
107107
}
108108

109109
It 'Should return $true when Test-DscConfiguration is run' {
110-
Test-DscConfiguration -Verbose | Should -Be 'True'
110+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
111111
}
112112
}
113113

@@ -163,7 +163,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
163163
}
164164

165165
It 'Should return $true when Test-DscConfiguration is run' {
166-
Test-DscConfiguration -Verbose | Should -Be 'True'
166+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
167167
}
168168
}
169169

@@ -219,7 +219,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
219219
}
220220

221221
It 'Should return $true when Test-DscConfiguration is run' {
222-
Test-DscConfiguration -Verbose | Should -Be 'True'
222+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
223223
}
224224
}
225225

@@ -275,7 +275,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
275275
}
276276

277277
It 'Should return $true when Test-DscConfiguration is run' {
278-
Test-DscConfiguration -Verbose | Should -Be 'True'
278+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
279279
}
280280
}
281281
}

tests/Integration/Resources/DSC_SqlAlwaysOnService.Integration.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag 'Skip' {
160160
}
161161

162162
It 'Should return $true when Test-DscConfiguration is run' {
163-
Test-DscConfiguration -Verbose | Should -Be 'True'
163+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
164164
}
165165
}
166166

@@ -214,7 +214,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag 'Skip' {
214214
}
215215

216216
It 'Should return $true when Test-DscConfiguration is run' {
217-
Test-DscConfiguration -Verbose | Should -Be 'True'
217+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
218218
}
219219
}
220220

tests/Integration/Resources/DSC_SqlAudit.Integration.Tests.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
147147
}
148148

149149
It 'Should return $true when Test-DscConfiguration is run' {
150-
Test-DscConfiguration -Verbose | Should -Be 'True'
150+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
151151
}
152152
}
153153

@@ -206,7 +206,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
206206
}
207207

208208
It 'Should return $true when Test-DscConfiguration is run' {
209-
Test-DscConfiguration -Verbose | Should -Be 'True'
209+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
210210
}
211211
}
212212

@@ -265,7 +265,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
265265
}
266266

267267
It 'Should return $true when Test-DscConfiguration is run' {
268-
Test-DscConfiguration -Verbose | Should -Be 'True'
268+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
269269
}
270270
}
271271

@@ -326,7 +326,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
326326
}
327327

328328
It 'Should return $true when Test-DscConfiguration is run' {
329-
Test-DscConfiguration -Verbose | Should -Be 'True'
329+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
330330
}
331331
}
332332

@@ -385,7 +385,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
385385
}
386386

387387
It 'Should return $true when Test-DscConfiguration is run' {
388-
Test-DscConfiguration -Verbose | Should -Be 'True'
388+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
389389
}
390390
}
391391
}

tests/Integration/Resources/DSC_SqlDatabase.Integration.Tests.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
112112
}
113113

114114
It 'Should return $true when Test-DscConfiguration is run' {
115-
Test-DscConfiguration -Verbose | Should -Be 'True'
115+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
116116
}
117117
}
118118

@@ -170,7 +170,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
170170
}
171171

172172
It 'Should return $true when Test-DscConfiguration is run' {
173-
Test-DscConfiguration -Verbose | Should -Be 'True'
173+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
174174
}
175175
}
176176

@@ -228,7 +228,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
228228
}
229229

230230
It 'Should return $true when Test-DscConfiguration is run' {
231-
Test-DscConfiguration -Verbose | Should -Be 'True'
231+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
232232
}
233233
}
234234

@@ -286,7 +286,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
286286
}
287287

288288
It 'Should return $true when Test-DscConfiguration is run' {
289-
Test-DscConfiguration -Verbose | Should -Be 'True'
289+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
290290
}
291291
}
292292

@@ -344,7 +344,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
344344
}
345345

346346
It 'Should return $true when Test-DscConfiguration is run' {
347-
Test-DscConfiguration -Verbose | Should -Be 'True'
347+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
348348
}
349349
}
350350

@@ -405,7 +405,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
405405
}
406406

407407
It 'Should return $true when Test-DscConfiguration is run' {
408-
Test-DscConfiguration -Verbose | Should -Be 'True'
408+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
409409
}
410410
}
411411

tests/Integration/Resources/DSC_SqlDatabaseDefaultLocation.Integration.Tests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
106106
}
107107

108108
It 'Should return $true when Test-DscConfiguration is run' {
109-
Test-DscConfiguration -Verbose | Should -Be 'True'
109+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
110110
}
111111
}
112112

@@ -161,7 +161,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
161161
}
162162

163163
It 'Should return $true when Test-DscConfiguration is run' {
164-
Test-DscConfiguration -Verbose | Should -Be 'True'
164+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
165165
}
166166
}
167167

@@ -217,7 +217,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
217217
}
218218

219219
It 'Should return $true when Test-DscConfiguration is run' {
220-
Test-DscConfiguration -Verbose | Should -Be 'True'
220+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
221221
}
222222
}
223223
}

tests/Integration/Resources/DSC_SqlDatabaseMail.Integration.Tests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
114114
}
115115

116116
It 'Should return $true when Test-DscConfiguration is run' {
117-
Test-DscConfiguration -Verbose | Should -Be 'True'
117+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
118118
}
119119
}
120120

@@ -159,7 +159,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
159159
}
160160

161161
It 'Should return $true when Test-DscConfiguration is run' {
162-
Test-DscConfiguration -Verbose | Should -Be 'True'
162+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
163163
}
164164
}
165165

@@ -222,7 +222,7 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
222222
}
223223

224224
It 'Should return $true when Test-DscConfiguration is run' {
225-
Test-DscConfiguration -Verbose | Should -Be 'True'
225+
Test-DscConfiguration -Verbose -ErrorAction 'Stop' | Should -Be 'True'
226226
}
227227
}
228228
}

0 commit comments

Comments
 (0)