Skip to content

Commit e2072c7

Browse files
so that the database checks dont break the PowerBi Add Pester V5 Database Level Checks #884
1 parent aa3b2f5 commit e2072c7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

source/checks/Databasev5.Tests.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ Describe "Query Store Disabled" -Tag QueryStoreDisabled, Medium, Database -ForEa
216216
Describe "Compatibility Level" -Tag CompatibilityLevel, High, Database -ForEach $InstancesToTest {
217217
$Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.database.compatibilitylevel').Value
218218

219-
Context "Compatibility level matches server compatibility level" {
219+
Context "Compatibility level matches server compatibility level on <_.Name>" {
220220
It "Database <_.Name> has the expected compatibility level on <_.SqlInstance>" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.compatexclude -notcontains $psitem.Name } } {
221221
$psitem.CompatibilityLevel | Should -Be $psitem.ServerLevel -Because "it means you are on the appropriate compatibility level for your SQL Server version to use all available features."
222222
}
@@ -226,7 +226,7 @@ Describe "Compatibility Level" -Tag CompatibilityLevel, High, Database -ForEach
226226
Describe "Guest User" -Tag GuestUserConnect, Security, CIS, Medium, Database -ForEach $InstancesToTest {
227227
$Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.security.guestuserconnect').Value
228228

229-
Context "Testing Guest user has CONNECT permission" {
229+
Context "Testing Guest user has CONNECT permission on <_.Name>" {
230230
It "Database Guest user should return no CONNECT permissions in <_.Name> on <_.SqlInstance>" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.guestuserexclude -notcontains $psitem.Name } } {
231231
$psitem.GuestUserConnect | Should -BeFalse -Because "we don't want the guest user to have connect access to our database."
232232
}
@@ -236,7 +236,7 @@ Describe "Guest User" -Tag GuestUserConnect, Security, CIS, Medium, Database -Fo
236236
Describe "Recovery Model" -Tag RecoveryModel, DISA, Medium, Database -ForEach $InstancesToTest {
237237
$Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.database.recoverymodel').Value
238238

239-
Context "Testing Recovery Model" {
239+
Context "Testing Recovery Model on <_.Name>" {
240240
It "Database <_.Name> should be set to <_.ConfigValues.recoverymodeltype> on <_.SqlInstance>" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.recoverymodelexclude -notcontains $psitem.Name } } {
241241
$psitem.RecoveryModel | Should -Be $psitem.ConfigValues.recoverymodeltype -Because "You expect this recovery model."
242242
}
@@ -246,7 +246,7 @@ Describe "Recovery Model" -Tag RecoveryModel, DISA, Medium, Database -ForEach $I
246246
Describe "PseudoSimple Recovery Model" -Tag PseudoSimple, Medium, Database -ForEach $InstancesToTest {
247247
$Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.database.pseudosimple').Value
248248

249-
Context "Testing database is not in PseudoSimple recovery model" {
249+
Context "Testing database is not in PseudoSimple recovery model on <_.Name>" {
250250
It "Database <_.Name> has PseudoSimple recovery model equal false on <_.SqlInstance>" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database -and $_.RecoveryModel -eq 'Full' } else { $psitem.ConfigValues.pseudosimpleexclude -notcontains $psitem.Name -and $_.RecoveryModel -eq 'Full' } } {
251251
$psitem.PseudoSimple | Should -BeFalse -Because "PseudoSimple means that a FULL backup has not been taken and the database is still effectively in SIMPLE mode"
252252
}
@@ -256,7 +256,7 @@ Describe "PseudoSimple Recovery Model" -Tag PseudoSimple, Medium, Database -ForE
256256
Describe "Contained Database Auto Close" -Tag ContainedDBAutoClose, CIS, Database -ForEach $InstancesToTest {
257257
$Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.security.containedbautoclose').Value
258258

259-
Context "Testing contained database auto close option" {
259+
Context "Testing contained database auto close option on <_.Name>" {
260260
It "Database <_.Name> should have auto close set to false on <_.SqlInstance>" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database -and $_.ContainmentType -ne "NONE" } else { $psitem.ConfigValues.contdbautocloseexclude -notcontains $psitem.Name -and $_.ContainmentType -ne "NONE" } } {
261261
$psitem.ContainedDbAutoClose | Should -BeFalse -Because "Contained Databases should have auto close set to false for CIS compliance."
262262
}
@@ -268,7 +268,7 @@ Describe "Contained Database SQL Authenticated Users" -Tag ContainedDBSQLAuth, C
268268

269269
#if ($version -lt 13 ) { $skip = $true }
270270

271-
Context "Testing contained database to see if sql authenticated users exist" {
271+
Context "Testing contained database to see if sql authenticated users exist on <_.Name>" {
272272
It "Database <_.Name> should have no sql authenticated users on <_.SqlInstance>" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database -and $_.ContainmentType -ne "NONE" } else { $psitem.ConfigValues.contdbsqlauthexclude -notcontains $psitem.Name -and $_.ContainmentType -ne "NONE" } } {
273273
$psitem.ContainedDbSqlAuthUsers | Should -Be 0 -Because "We expect there to be no sql authenticated users in contained database."
274274
}

0 commit comments

Comments
 (0)