Skip to content

Commit 4d344ad

Browse files
Merge branch 'BrentOzarULTD:dev' into dev
2 parents da110dc + 136de61 commit 4d344ad

15 files changed

Lines changed: 451 additions & 57 deletions
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: First Responder Kit Integration Tests
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
pull_request:
7+
types: [opened, review_requested, synchronize]
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Install SqlServer Module
19+
shell: pwsh
20+
run: |
21+
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
22+
Install-Module SqlServer
23+
24+
- name: Install SQL Server
25+
uses: potatoqualitee/mssqlsuite@v1.7
26+
with:
27+
install: sqlengine
28+
version: 2017
29+
collation: SQL_Latin1_General_CP1_CS_AS
30+
31+
- name: Check SQL Install
32+
run: |
33+
sqlcmd -S localhost -U sa -P dbatools.I0 -d tempdb -Q "SELECT @@version as Version;" -I -b -t 60
34+
sqlcmd -S localhost -U sa -P dbatools.I0 -d tempdb -Q "SELECT SERVERPROPERTY('Collation') AS Collation;" -I -b -t 60
35+
36+
- name: Deploy FRK
37+
run: |
38+
sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzCache.sql" -I -b -t 60
39+
sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzWho.sql" -I -b -t 60
40+
sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_Blitz.sql" -I -b -t 60
41+
sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzFirst.sql" -I -b -t 60
42+
sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzAnalysis.sql" -I -b -t 60
43+
sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzBackups.sql" -I -b -t 60
44+
sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzIndex.sql" -I -b -t 60
45+
sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzInMemoryOLTP.sql" -I -b -t 60
46+
sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzLock.sql" -I -b -t 60
47+
sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzQueryStore.sql" -I -b -t 60
48+
sqlcmd -S localhost -U sa -P dbatools.I0 -d master -Q "SELECT * FROM sys.procedures WHERE name LIKE 'sp_Blitz%';" -I -b -t 60
49+
50+
- name: Run Pester Tests
51+
shell: pwsh
52+
run: |
53+
cd tests
54+
./run-tests.ps1

SqlServerVersions.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ DELETE FROM dbo.SqlServerVersions;
4141
INSERT INTO dbo.SqlServerVersions
4242
(MajorVersionNumber, MinorVersionNumber, Branch, [Url], ReleaseDate, MainstreamSupportEndDate, ExtendedSupportEndDate, MajorVersionName, MinorVersionName)
4343
VALUES
44+
(16, 4100, 'CU10 GDR', 'https://support.microsoft.com/en-us/help/5033592', '2024-01-09', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 10 GDR'),
4445
(16, 4095, 'CU10', 'https://support.microsoft.com/en-us/help/5031778', '2023-11-16', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 10'),
4546
(16, 4085, 'CU9', 'https://support.microsoft.com/en-us/help/5030731', '2023-10-12', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 9'),
4647
(16, 4075, 'CU8', 'https://support.microsoft.com/en-us/help/5029666', '2023-09-14', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 8'),

sp_Blitz.sql

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ AS
201201
,@SkipModel bit = 0
202202
,@SkipTempDB bit = 0
203203
,@SkipValidateLogins bit = 0
204+
,@SkipGetAlertInfo bit = 0
204205

205206
DECLARE
206207
@db_perms table
@@ -226,6 +227,23 @@ AS
226227
/* End of declarations for First Responder Kit consistency check:*/
227228
;
228229

230+
/* Create temp table for check 73 */
231+
IF OBJECT_ID('tempdb..#AlertInfo') IS NOT NULL
232+
EXEC sp_executesql N'DROP TABLE #AlertInfo;';
233+
234+
CREATE TABLE #AlertInfo
235+
(
236+
FailSafeOperator NVARCHAR(255) ,
237+
NotificationMethod INT ,
238+
ForwardingServer NVARCHAR(255) ,
239+
ForwardingSeverity INT ,
240+
PagerToTemplate NVARCHAR(255) ,
241+
PagerCCTemplate NVARCHAR(255) ,
242+
PagerSubjectTemplate NVARCHAR(255) ,
243+
PagerSendSubjectOnly NVARCHAR(255) ,
244+
ForwardAlways INT
245+
);
246+
229247
/* Create temp table for check 2301 */
230248
IF OBJECT_ID('tempdb..#InvalidLogins') IS NOT NULL
231249
EXEC sp_executesql N'DROP TABLE #InvalidLogins;';
@@ -315,6 +333,20 @@ AS
315333
END CATCH;
316334
END; /*Need execute on sp_validatelogins*/
317335

336+
IF ISNULL(@SkipGetAlertInfo, 0) != 1 /*If @SkipGetAlertInfo hasn't been set to 1 by the caller*/
337+
BEGIN
338+
BEGIN TRY
339+
/* Try to fill the table for check 73 */
340+
INSERT INTO #AlertInfo
341+
EXEC [master].[dbo].[sp_MSgetalertinfo] @includeaddresses = 0;
342+
343+
SET @SkipGetAlertInfo = 0; /*We can execute sp_MSgetalertinfo*/
344+
END TRY
345+
BEGIN CATCH
346+
SET @SkipGetAlertInfo = 1; /*We have don't have execute rights or sp_MSgetalertinfo throws an error so skip it*/
347+
END CATCH;
348+
END; /*Need execute on sp_MSgetalertinfo*/
349+
318350
IF ISNULL(@SkipModel, 0) != 1 /*If @SkipModel hasn't been set to 1 by the caller*/
319351
BEGIN
320352
IF EXISTS
@@ -639,7 +671,13 @@ AS
639671
SELECT
640672
v.*
641673
FROM (VALUES(NULL, 2301, NULL)) AS v (DatabaseName, CheckID, ServerName) /*sp_validatelogins*/
642-
WHERE @SkipValidateLogins = 1
674+
WHERE @SkipValidateLogins = 1;
675+
676+
INSERT #SkipChecks (DatabaseName, CheckID, ServerName)
677+
SELECT
678+
v.*
679+
FROM (VALUES(NULL, 73, NULL)) AS v (DatabaseName, CheckID, ServerName) /*sp_validatelogins*/
680+
WHERE @SkipGetAlertInfo = 1;
643681

644682
IF @sa = 0
645683
BEGIN
@@ -4803,6 +4841,10 @@ AS
48034841
FROM sys.all_columns
48044842
WHERE name = 'is_memory_optimized_elevate_to_snapshot_on' AND object_id = OBJECT_ID('sys.databases')
48054843
AND SERVERPROPERTY('EngineEdition') <> 8; /* Hekaton is always enabled in Managed Instances per https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/1919 */
4844+
INSERT INTO #DatabaseDefaults
4845+
SELECT 'is_accelerated_database_recovery_on', 0, 145, 210, 'Acclerated Database Recovery Enabled', 'https://www.brentozar.com/go/dbdefaults', NULL
4846+
FROM sys.all_columns
4847+
WHERE name = 'is_accelerated_database_recovery_on' AND object_id = OBJECT_ID('sys.databases') AND SERVERPROPERTY('EngineEdition') NOT IN (5, 8) ;
48064848

48074849
DECLARE DatabaseDefaultsLoop CURSOR FOR
48084850
SELECT name, DefaultValue, CheckID, Priority, Finding, URL, Details
@@ -8194,20 +8236,6 @@ IF @ProductVersionMajor >= 10
81948236

81958237
IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 73) WITH NOWAIT;
81968238

8197-
DECLARE @AlertInfo TABLE
8198-
(
8199-
FailSafeOperator NVARCHAR(255) ,
8200-
NotificationMethod INT ,
8201-
ForwardingServer NVARCHAR(255) ,
8202-
ForwardingSeverity INT ,
8203-
PagerToTemplate NVARCHAR(255) ,
8204-
PagerCCTemplate NVARCHAR(255) ,
8205-
PagerSubjectTemplate NVARCHAR(255) ,
8206-
PagerSendSubjectOnly NVARCHAR(255) ,
8207-
ForwardAlways INT
8208-
);
8209-
INSERT INTO @AlertInfo
8210-
EXEC [master].[dbo].[sp_MSgetalertinfo] @includeaddresses = 0;
82118239
INSERT INTO #BlitzResults
82128240
( CheckID ,
82138241
Priority ,
@@ -8222,7 +8250,7 @@ IF @ProductVersionMajor >= 10
82228250
'No Failsafe Operator Configured' AS Finding ,
82238251
'https://www.brentozar.com/go/failsafe' AS URL ,
82248252
( 'No failsafe operator is configured on this server. This is a good idea just in-case there are issues with the [msdb] database that prevents alerting.' ) AS Details
8225-
FROM @AlertInfo
8253+
FROM #AlertInfo
82268254
WHERE FailSafeOperator IS NULL;
82278255
END;
82288256

@@ -10029,6 +10057,11 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
1002910057
EXEC sp_executesql N'DROP TABLE #InvalidLogins;';
1003010058
END;
1003110059

10060+
IF OBJECT_ID('tempdb..#AlertInfo') IS NOT NULL
10061+
BEGIN
10062+
EXEC sp_executesql N'DROP TABLE #AlertInfo;';
10063+
END;
10064+
1003210065
/*
1003310066
Reset the Nmumeric_RoundAbort session state back to enabled if it was disabled earlier.
1003410067
See Github issue #2302 for more info.
@@ -10048,4 +10081,4 @@ EXEC [dbo].[sp_Blitz]
1004810081
@OutputProcedureCache = 0 ,
1004910082
@CheckProcedureCacheFilter = NULL,
1005010083
@CheckServerInfo = 1
10051-
*/
10084+
*/

0 commit comments

Comments
 (0)