Skip to content

Commit f8a93ec

Browse files
Merge branch 'main' into agentV5
2 parents ceef968 + e23709f commit f8a93ec

File tree

4 files changed

+47
-12
lines changed

4 files changed

+47
-12
lines changed

containers/JessAndBeard.psm1

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2372,6 +2372,13 @@ The Tags are the same"
23722372
PassedChange = -5 # + or - the number of tests passed for v4
23732373
FailedChange = -1 # + or - the number of tests failed for v4
23742374
SkippedChange = +3 # + or - the number of tests skipped for v4
2375+
},
2376+
@{
2377+
Name = 'SqlEngineServiceAccount'
2378+
RunChange = -3 # + or - the number of tests run for v5
2379+
PassedChange = 0 # + or - the number of tests passed for v5
2380+
FailedChange = 0 # + or - the number of tests failed for v5
2381+
SkippedChange = -3 # + or - the number of tests skipped for v5
23752382
}
23762383
)
23772384
$runchange = 0
@@ -2421,6 +2428,7 @@ The Total Tests Run are the same {0} {1}
24212428

24222429
#total passed checks
24232430
If ($v5Passed -ne $v4code.PassedCount) {
2431+
24242432
$Message = "
24252433
Uh-Oh - The total tests Passed between v4 and v5 are not the same somehow.
24262434
For v4 We Passed
@@ -2429,11 +2437,16 @@ and
24292437
for v4 we Passed
24302438
{1} tests
24312439
{2}
2440+
2441+
" -f $v4code.PassedCount, $v5Passed, $messageAppend
2442+
if($MessageAppend){
2443+
$Message += "
24322444
v4 TestNames
2433-
{3}
2445+
{0}
24342446
v5 TestNames
2435-
{4}
2436-
" -f $v4code.PassedCount, $v5Passed, $messageAppend, ($v4code.TestResult.Where{$_.Result -eq 'Passed'}.Name |Out-String),($v5code.Passed.ExpandedName |Out-String)
2447+
{1}
2448+
" -f ($v4code.TestResult.Where{$_.Result -eq 'Passed'}.Name |Out-String),($v5code.Passed.ExpandedName |Out-String)
2449+
}
24372450
Write-PSFMessage -Message $Message -Level Warning
24382451
} else {
24392452
$message = "
@@ -2450,11 +2463,16 @@ For v4 We Failed
24502463
and
24512464
for v4 we Failed
24522465
{1} tests
2466+
2467+
" -f $v4code.FailedCount, $v5Failed, $messageAppend
2468+
if($MessageAppend){
2469+
$Message += "
24532470
v4 TestNames
2454-
{2}
2471+
{0}
24552472
v5 TestNames
2456-
{3}
2457-
" -f $v4code.FailedCount, $v5failed,($v4code.TestResult.Where{$_.Result -eq 'Failed'}.Name |Out-String),($v5code.Failed.ExpandedName |Out-String)
2473+
{1}
2474+
" -f ($v4code.TestResult.Where{$_.Result -eq 'Failed'}.Name |Out-String),($v5code.Failed.ExpandedName |Out-String)
2475+
}
24582476
Write-PSFMessage -Message $Message -Level Warning
24592477
} else {
24602478
$message = "
@@ -2471,11 +2489,16 @@ For v4 We Skipped
24712489
and
24722490
For v5 we Skipped
24732491
{1}
2492+
2493+
" -f $v4code.SkippedCount, $v5Skipped, $messageAppend
2494+
if($MessageAppend){
2495+
$Message += "
24742496
v4 TestNames
2475-
{3}
2497+
{0}
24762498
v5 TestNames
2477-
{4}
2478-
{2}" -f $v4code.SkippedCount, $v5skipped, $messageAppend,($v4code.TestResult.Where{$_.Result -eq 'Skipped'}.Name |Out-String),($v5code.Skipped.ExpandedName |Out-String)
2499+
{1}
2500+
" -f ($v4code.TestResult.Where{$_.Result -eq 'Skipped'}.Name |Out-String),($v5code.Skipped.ExpandedName |Out-String)
2501+
}
24792502
Write-PSFMessage -Message $Message -Level Warning
24802503
} else {
24812504
$message = "

source/checks/Instancev5.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ Describe "SQL and Windows names match" -Tag ServerNameMatch, Medium, Instance -F
426426
}
427427
}
428428

429-
Describe "SQL Engine Service" -Tags SqlEngineServiceAccount, ServiceAccount, High, Instance -ForEach $InstancesToTest {
429+
Describe "SQL Engine Service" -Tag SqlEngineServiceAccount, ServiceAccount, High, Instance -ForEach $InstancesToTest {
430430
$skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.sqlengineserviceaccount' }).Value
431431
Context "Testing SQL Engine Service on <_.Name>" -Skip:$skip {
432432
It "SQL Engine service account should be <_.State> on <_.InstanceName>" -ForEach $PsItem.SqlEngineServiceAccount {

source/functions/Invoke-DbcCheck.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,18 +367,26 @@ function Invoke-DbcCheck {
367367
$configuration = New-PesterConfiguration
368368
$configuration.Output.Verbosity = $NewShow
369369
$configuration.Filter.Tag = $check + 'FailedConnections'
370-
$configuration.Filter.ExcludeTag = $ExcludeCheck
370+
# Exclude the excluded checks and the not converted checks
371+
$notv5 = (Get-PSFConfigValue -FullName 'dbachecks.checks.notv5ready')
372+
$configuration.Filter.ExcludeTag = $ExcludeCheck + $notv5
373+
371374
if ($PassThru) {
372375
$configuration.Run.PassThru = $true
373376
}
377+
# So that if the only check passed in is not yet converted - so that we dont get red.
378+
if ($check -in $notv5) {
379+
Write-PSFMessage -Message "You are running a single check that is not yet converted to v5." -Level Warning
380+
Return
381+
}
374382
} catch {
375383
Write-PSFMessage -Message 'Something Went wrong' -Level Warning -ErrorRecord $_
376384
Return
377385
}
378386
$null = $PSBoundParameters.Remove('legacy')
379387
$null = $PSBoundParameters.Remove('Show')
380388
$null = $PSBoundParameters.Remove('PassThru')
381-
Write-PSFMessage -Message ($PSBoundParameters | Out-String) -Level Significant
389+
Write-PSFMessage -Message ($PSBoundParameters | Out-String) -Level Verbose
382390
Invoke-DbcCheckv5 @PSBoundParameters -configuration $configuration
383391
}
384392
}

source/internal/configurations/configuration.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ $EmailValidationSb = {
1818
}
1919
Register-PSFConfigValidation -Name validation.EmailValidation -ScriptBlock $EmailValidationSb
2020

21+
$__dbachecksNotv5 = 'ADUser', 'BuiltInAdmin', 'EngineServiceAdmin', 'FullTextServiceAdmin', 'LocalWindowsGroup', 'PublicPermission', 'SqlBrowserServiceAccount', 'TempDbConfiguration'',CertificateExpiration', 'DatabaseExists', 'DatabaseGrowthEvent', 'DatabaseMailEnabled', 'DatabaseMailProfile', 'DatafileAutoGrowthType', 'DisabledIndex', 'DuplicateIndex', 'FileGroupBalanced', 'FKCKTrusted', 'FutureFileGrowth', 'IdentityUsage', 'LastDiffBackup', 'LastFullBackup', 'LastGoodCheckDb', 'LastLogBackup', 'LogfilePercentUsed', 'LogfileSize', 'MaxDopDatabase', 'OrphanedUser', 'PageVerify', 'SymmetricKeyEncryptionLevel', 'TestLastBackup', 'TestLastBackupVerifyOnly', 'UnusedIndex', 'DatabaseMailEnabled', 'AgentServiceAccount', 'DbaOperator', 'FailsafeOperator', 'DatabaseMailProfile', 'AgentMailProfile', 'FailedJob', 'ValidJobOwner', 'InValidJobOwner', 'AgentAlert', 'JobHistory', 'LongRunningJob', 'LastJobRunTime', 'PowerPlan', 'SPN', 'DiskCapacity', 'PingComputer', 'CPUPrioritisation', 'DiskAllocationUnit', 'NonStandardPort', 'ServerProtocol', 'OlaInstalled', 'SystemFull', 'UserFull', 'UserDiff', 'UserLog', 'CommandLog', 'SystemIntegrityCheck', 'UserIntegrityCheck', 'UserIndexOptimize', 'OutputFileCleanup', 'DeleteBackupHistory', 'PurgeJobHistory', 'DomainName', 'OrganizationalUnit', 'ClusterHealth', 'LogShippingPrimary', 'LogShippingSecondary'
22+
23+
Set-PSFConfig -Module dbachecks -Name checks.notv5ready -Value @($__dbachecksNotv5) -Initialize -Description "Checks that have not been converted to v5 yet"
24+
2125

2226
# some configs to help with autocompletes and other module level stuff
2327
#apps

0 commit comments

Comments
 (0)