Skip to content

Commit a51edfd

Browse files
Merge pull request #998 from dataplat/instancecheckscontinued
Instancecheckscontinued
2 parents 2d98eb7 + b1a6883 commit a51edfd

File tree

3 files changed

+49
-16
lines changed

3 files changed

+49
-16
lines changed

containers/JessAndBeard.psm1

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,8 +2304,9 @@ New Code runs in {2} % of the time
23042304
Write-PSFMessage -Message $savingMessage -Level Output
23052305

23062306
##validate we got the right answers too
2307-
2308-
If (Compare-Object $v5code.Configuration.Filter.Tag.Value $v4code.TagFilter) {
2307+
[System.Collections.ArrayList]$v5CodeTags = $v5code.Configuration.Filter.Tag.Value
2308+
$v5CodeTags.Remove('FailedConnections')
2309+
If (Compare-Object $v5CodeTags $v4code.TagFilter) {
23092310
$Message = "
23102311
Uh-Oh - The Tag filters between v4 and v5 are not the same somehow.
23112312
For v4 We returned
@@ -2420,7 +2421,12 @@ For v4 We Passed
24202421
and
24212422
For v5 we Passed
24222423
{1} tests
2423-
{2}" -f $v4code.PassedCount, $v5Passed, $messageAppend
2424+
{2}
2425+
v4 TestNames
2426+
{3}
2427+
v5 TestNames
2428+
{4}
2429+
" -f $v4code.PassedCount, $v5Passed, $messageAppend, ($v4code.TestResult.Where{$_.Result -eq 'Passed'}.Name |Out-String),($v5code.Passed.ExpandedName |Out-String)
24242430
Write-PSFMessage -Message $Message -Level Warning
24252431
} else {
24262432
$message = "
@@ -2437,7 +2443,11 @@ For v4 We Failed
24372443
and
24382444
For v5 we Failed
24392445
{1} tests
2440-
" -f $v4code.FailedCount, $v5failed
2446+
v4 TestNames
2447+
{2}
2448+
v5 TestNames
2449+
{3}
2450+
" -f $v4code.FailedCount, $v5failed,($v4code.TestResult.Where{$_.Result -eq 'Failed'}.Name |Out-String),($v5code.Failed.ExpandedName |Out-String)
24412451
Write-PSFMessage -Message $Message -Level Warning
24422452
} else {
24432453
$message = "
@@ -2453,8 +2463,12 @@ For v4 We Skipped
24532463
{0} tests
24542464
and
24552465
For v5 we Skipped
2456-
{1} tests
2457-
{2}" -f $v4code.SkippedCount, $v5skipped, $messageAppend
2466+
{1}
2467+
v4 TestNames
2468+
{3}
2469+
v5 TestNames
2470+
{4}
2471+
{2}" -f $v4code.SkippedCount, $v5skipped, $messageAppend,($v4code.TestResult.Where{$_.Result -eq 'Skipped'}.Name |Out-String),($v5code.Skipped.ExpandedName |Out-String)
24582472
Write-PSFMessage -Message $Message -Level Warning
24592473
} else {
24602474
$message = "

containers/base/profile.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ function Load-Profile {
5959
)
6060
$global:__currentTheme = (Get-Random -InputObject $themes)
6161
function global:Get-CurrentPoshTheme { $__currentTheme }
62-
Set-PoshPrompt -Theme $__currentTheme
63-
62+
# Set-PoshPrompt -Theme $__currentTheme
63+
Set-PoshPrompt -Theme 'chips'
6464
if ($psstyle) {
6565
$psstyle.FileInfo.Directory = $psstyle.FileInfo.Executable = $psstyle.FileInfo.SymbolicLink = ""
6666
$PSStyle.FileInfo.Extension.Clear()

developing/Oslo Demo.ps1

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,47 @@ $cred = New-Object -TypeName System.Management.Automation.PSCredential -Argument
99
$show = 'All'
1010
#endregion
1111

12+
#region What do we have?
13+
14+
Get-DbaDatabase -SqlInstance $Sqlinstances -SqlCredential $cred -ExcludeSystem | Select-Object Sqlinstance, DatabaseName, Status
15+
16+
Get-DbaAgentJob -SqlInstance $Sqlinstances -SqlCredential $cred | Select-Object Sqlinstance, Name, Enabled
17+
#end region
18+
19+
Get-DbaLastBackup -SqlInstance $Sqlinstances -SqlCredential $cred | Select-Object Sqlinstance, Database, LastFullBackup | Format-Table
20+
1221
# lets run a couple of tests
1322

14-
Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check InstanceConnection, DatabaseStatus -legacy $true -Show $show
23+
# this one shows that the old existing code will work
24+
# the legacy switch is set to true by default
25+
26+
Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check InstanceConnection, DatabaseStatus -Show $show
1527

16-
# that failed but shouldnt have - set config
28+
# So lets show the shiny new faster code - legacy switch set to false
29+
30+
Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check InstanceConnection, DatabaseStatus -Show $show -legacy $false
31+
32+
33+
# The Authentication check failed but we would like to pass - lets set config
1734
Set-DbcConfig -Name policy.connection.authscheme -Value SQL
1835

1936
# run again
2037

21-
# what about skips?
38+
Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check InstanceConnection, DatabaseStatus -Show $show -legacy $false
39+
40+
# Hmmm, we know that we will never be able to remote onto these containers so let talk about skipping. No Claudio not that sort of skipping!!
2241
Set-DbcConfig -Name skip.connection.remoting -Value $true
2342

2443
# run again
2544

26-
# ok now in v5 mode
27-
Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check InstanceConnection, DatabaseStatus -legacy $false -Show $show
45+
Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check InstanceConnection, DatabaseStatus -Show $show -legacy $false
2846

29-
# So much quicker !!!
47+
# So much quicker !!! OK for one check it will be slower. For two it will probably be about the same but for 3 or more it will be quicker. Much quicket. Exrapolate that to 100 checks and a 1000 instances you can see the difference.
3048

31-
# show our perf test ????
49+
# This is how we know - We perf test our PowerShell code
50+
# This will take about 80-100 seconds to run so run first then talk!
3251

33-
$Checks = 'ErrorLogCount', 'XESessionExists', 'XESessionStopped', 'XpCmdShellDisabled', 'WhoIsActiveInstalled', 'CLREnabled', 'TwoDigitYearCutoff', 'MaxDopInstance', 'ErrorLogCount', 'ModelDbGrowth', 'DefaultBackupCompression', 'SaExist', 'SaDisabled', 'SaRenamed', 'DefaultFilePath', 'AdHocDistributedQueriesEnabled', 'AdHocWorkload', 'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation', 'ServerNameMatch', 'OrphanedFile', 'MaxMemory', 'NetworkLatency', 'PublicPermission'
52+
$Checks = 'ErrorLogCount', 'XpCmdShellDisabled', 'WhoIsActiveInstalled', 'CLREnabled', 'TwoDigitYearCutoff', 'MaxDopInstance', 'ErrorLogCount', 'ModelDbGrowth', 'DefaultBackupCompression', 'SaExist', 'SaDisabled', 'SaRenamed', 'DefaultFilePath', 'AdHocDistributedQueriesEnabled', 'AdHocWorkload', 'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation', 'ServerNameMatch', 'OrphanedFile', 'MaxMemory', 'PublicPermission'
3453

3554
Invoke-PerfAndValidateCheck -Checks $Checks
3655

0 commit comments

Comments
 (0)