Skip to content

Commit 687a6ce

Browse files
authored
chore: added more monitoring dashboards into the tests [skip-ci] (#209)
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 51f1027 commit 687a6ce

24 files changed

+3915
-27
lines changed

test/monitoring/aws-appsync/AppSyncMonitoring.test.ts

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

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

89
test("snapshot test: no alarms", () => {
@@ -14,12 +15,13 @@ test("snapshot test: no alarms", () => {
1415
name: "DummyApi",
1516
});
1617

17-
new AppSyncMonitoring(scope, {
18+
const monitoring = new AppSyncMonitoring(scope, {
1819
api: dummyApi,
1920
humanReadableName: "Dummy API for testing",
2021
alarmFriendlyName: "DummyApi",
2122
});
2223

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

@@ -34,7 +36,7 @@ test("snapshot test: all alarms", () => {
3436
name: "DummyApi",
3537
});
3638

37-
new AppSyncMonitoring(scope, {
39+
const monitoring = new AppSyncMonitoring(scope, {
3840
api: dummyApi,
3941
humanReadableName: "Dummy API for testing",
4042
alarmFriendlyName: "DummyApi",
@@ -90,6 +92,7 @@ test("snapshot test: all alarms", () => {
9092
},
9193
});
9294

95+
addMonitoringDashboardsToStack(stack, monitoring);
9396
expect(numAlarmsCreated).toStrictEqual(9);
9497
expect(Template.fromStack(stack)).toMatchSnapshot();
9598
});

test/monitoring/aws-appsync/__snapshots__/AppSyncMonitoring.test.ts.snap

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

test/monitoring/aws-kinesis/KinesisFirehoseMonitoring.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@ import { Stack } from "aws-cdk-lib";
22
import { Template } from "aws-cdk-lib/assertions";
33

44
import { KinesisFirehoseMonitoring } from "../../../lib";
5+
import { addMonitoringDashboardsToStack } from "../../utils/SnapshotUtil";
56
import { TestMonitoringScope } from "../TestMonitoringScope";
67

78
test("snapshot test: no alarms", () => {
89
const stack = new Stack();
910

1011
const scope = new TestMonitoringScope(stack, "Scope");
1112

12-
new KinesisFirehoseMonitoring(scope, {
13+
const monitoring = new KinesisFirehoseMonitoring(scope, {
1314
deliveryStreamName: "my-firehose-delivery-stream",
1415
});
1516

17+
addMonitoringDashboardsToStack(stack, monitoring);
1618
expect(Template.fromStack(stack)).toMatchSnapshot();
1719
});
1820

@@ -23,7 +25,7 @@ test("snapshot test: all alarms", () => {
2325

2426
let numAlarmsCreated = 0;
2527

26-
new KinesisFirehoseMonitoring(scope, {
28+
const monitoring = new KinesisFirehoseMonitoring(scope, {
2729
deliveryStreamName: "my-firehose-delivery-stream",
2830
addRecordsThrottledAlarm: {
2931
Critical: {
@@ -37,6 +39,7 @@ test("snapshot test: all alarms", () => {
3739
},
3840
});
3941

42+
addMonitoringDashboardsToStack(stack, monitoring);
4043
expect(numAlarmsCreated).toStrictEqual(1);
4144
expect(Template.fromStack(stack)).toMatchSnapshot();
4245
});

test/monitoring/aws-kinesis/__snapshots__/KinesisFirehoseMonitoring.test.ts.snap

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

test/monitoring/aws-kinesisanalytics/KinesisDataAnalyticsMonitoring.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@ import { Stack } from "aws-cdk-lib";
22
import { Template } from "aws-cdk-lib/assertions";
33

44
import { KinesisDataAnalyticsMonitoring } from "../../../lib";
5+
import { addMonitoringDashboardsToStack } from "../../utils/SnapshotUtil";
56
import { TestMonitoringScope } from "../TestMonitoringScope";
67

78
test("snapshot test: no alarms", () => {
89
const stack = new Stack();
910

1011
const scope = new TestMonitoringScope(stack, "Scope");
1112

12-
new KinesisDataAnalyticsMonitoring(scope, {
13+
const monitoring = new KinesisDataAnalyticsMonitoring(scope, {
1314
application: "DummyApplication",
1415
});
1516

17+
addMonitoringDashboardsToStack(stack, monitoring);
1618
expect(Template.fromStack(stack)).toMatchSnapshot();
1719
});
1820

@@ -23,7 +25,7 @@ test("snapshot test: all alarms", () => {
2325

2426
let numAlarmsCreated = 0;
2527

26-
new KinesisDataAnalyticsMonitoring(scope, {
28+
const monitoring = new KinesisDataAnalyticsMonitoring(scope, {
2729
application: "DummyApplication",
2830
addDowntimeAlarm: {
2931
Warning: {
@@ -42,6 +44,7 @@ test("snapshot test: all alarms", () => {
4244
},
4345
});
4446

47+
addMonitoringDashboardsToStack(stack, monitoring);
4548
expect(numAlarmsCreated).toStrictEqual(2);
4649
expect(Template.fromStack(stack)).toMatchSnapshot();
4750
});

0 commit comments

Comments
 (0)