Skip to content

Commit ba04ec8

Browse files
authored
chore: extend dashboard snapshots to further components (#143)
Related #91 --- _By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_
1 parent b66685e commit ba04ec8

24 files changed

+6800
-67
lines changed

test/monitoring/aws-acm/CertificateManagerMonitoring.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Template } from "aws-cdk-lib/assertions";
33
import { Certificate } from "aws-cdk-lib/aws-certificatemanager";
44

55
import { CertificateManagerMonitoring } from "../../../lib";
6+
import { addMonitoringDashboardsToStack } from "../../utils/SnapshotUtil";
67
import { TestMonitoringScope } from "../TestMonitoringScope";
78

89
test("snapshot test: no alarms", () => {
@@ -14,11 +15,12 @@ test("snapshot test: no alarms", () => {
1415

1516
const scope = new TestMonitoringScope(stack, "Scope");
1617

17-
new CertificateManagerMonitoring(scope, {
18+
const monitoring = new CertificateManagerMonitoring(scope, {
1819
alarmFriendlyName: "Certificates",
1920
certificate,
2021
});
2122

23+
addMonitoringDashboardsToStack(stack, monitoring);
2224
expect(Template.fromStack(stack)).toMatchSnapshot();
2325
});
2426

@@ -33,7 +35,7 @@ test("snapshot test: all alarms", () => {
3335

3436
let numAlarmsCreated = 0;
3537

36-
new CertificateManagerMonitoring(scope, {
38+
const monitoring = new CertificateManagerMonitoring(scope, {
3739
alarmFriendlyName: "Certificates",
3840
certificate,
3941
addDaysToExpiryAlarm: {
@@ -48,6 +50,7 @@ test("snapshot test: all alarms", () => {
4850
},
4951
});
5052

53+
addMonitoringDashboardsToStack(stack, monitoring);
5154
expect(numAlarmsCreated).toStrictEqual(1);
5255
expect(Template.fromStack(stack)).toMatchSnapshot();
5356
});

test/monitoring/aws-acm/__snapshots__/CertificateManagerMonitoring.test.ts.snap

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/monitoring/aws-apigateway/ApiGatewayMonitoring.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Template } from "aws-cdk-lib/assertions";
33
import { RestApi } from "aws-cdk-lib/aws-apigateway";
44

55
import { AlarmWithAnnotation, ApiGatewayMonitoring } from "../../../lib";
6+
import { addMonitoringDashboardsToStack } from "../../utils/SnapshotUtil";
67
import { TestMonitoringScope } from "../TestMonitoringScope";
78

89
test("snapshot test: no alarms", () => {
@@ -12,12 +13,13 @@ test("snapshot test: no alarms", () => {
1213

1314
const scope = new TestMonitoringScope(stack, "Scope");
1415

15-
new ApiGatewayMonitoring(scope, {
16+
const monitoring = new ApiGatewayMonitoring(scope, {
1617
api,
1718
humanReadableName: "Dummy API Gateway for testing",
1819
alarmFriendlyName: "DummyApi",
1920
});
2021

22+
addMonitoringDashboardsToStack(stack, monitoring);
2123
expect(Template.fromStack(stack)).toMatchSnapshot();
2224
});
2325

@@ -30,7 +32,7 @@ test("snapshot test: all alarms", () => {
3032

3133
let numAlarmsCreated = 0;
3234

33-
new ApiGatewayMonitoring(scope, {
35+
const monitoring = new ApiGatewayMonitoring(scope, {
3436
api,
3537
humanReadableName: "Dummy API Gateway for testing",
3638
alarmFriendlyName: "DummyApi",
@@ -167,6 +169,7 @@ test("snapshot test: all alarms", () => {
167169
},
168170
});
169171

172+
addMonitoringDashboardsToStack(stack, monitoring);
170173
expect(numAlarmsCreated).toStrictEqual(22);
171174
expect(Template.fromStack(stack)).toMatchSnapshot();
172175
});

0 commit comments

Comments
 (0)