-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from capralifecycle/add-more-alarms
Add more alarms
- Loading branch information
Showing
8 changed files
with
777 additions
and
37 deletions.
There are no files selected for viewing
126 changes: 126 additions & 0 deletions
126
src/alarms/__tests__/__snapshots__/database-alarms.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
112 changes: 101 additions & 11 deletions
112
src/alarms/__tests__/__snapshots__/service-alarms.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import "@aws-cdk/assert/jest" | ||
import { App, Stack, Size } from "aws-cdk-lib" | ||
import * as cloudwatchActions from "aws-cdk-lib/aws-cloudwatch-actions" | ||
import * as sns from "aws-cdk-lib/aws-sns" | ||
import * as ec2 from "aws-cdk-lib/aws-ec2" | ||
import "jest-cdk-snapshot" | ||
import { DatabaseAlarms } from "../database-alarms" | ||
|
||
test("create alarms", () => { | ||
const app = new App() | ||
const supportStack = new Stack(app, "SupportStack") | ||
const stack = new Stack(app, "Stack") | ||
|
||
const topic = new sns.Topic(supportStack, "Topic") | ||
const action = new cloudwatchActions.SnsAction(topic) | ||
|
||
const alarms = new DatabaseAlarms(stack, "DatabaseAlarms", { | ||
instanceIdentifier: "database-name", | ||
instanceType: ec2.InstanceType.of( | ||
ec2.InstanceClass.BURSTABLE3, | ||
ec2.InstanceSize.MICRO, | ||
), | ||
allocatedStorage: Size.gibibytes(25), | ||
action, | ||
}) | ||
|
||
alarms.addCpuCreditsAlarm() | ||
alarms.addCpuUtilizationAlarm({ | ||
threshold: 75, | ||
}) | ||
|
||
alarms.addStorageSpaceAlarms() | ||
|
||
expect(stack).toMatchCdkSnapshot() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.