-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Expand file tree
/
Copy pathput-metric-alarm.integration.test.js
More file actions
33 lines (26 loc) · 1.05 KB
/
put-metric-alarm.integration.test.js
File metadata and controls
33 lines (26 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { describe, it, expect, beforeAll, afterAll } from "vitest";
import { deleteAlarms, describeAlarm } from "../libs/cloudwatch-helper.js";
import { runEC2Instance, terminateEC2Instance } from "../libs/ec2-helper.js";
describe("put-metric-alarm", () => {
/** @type {string} */
let instanceIdToTerminate;
beforeAll(async () => {
instanceIdToTerminate = await runEC2Instance();
});
afterAll(async () => {
await deleteAlarms([process.env.CLOUDWATCH_ALARM_NAME]);
await terminateEC2Instance(instanceIdToTerminate);
});
it("should create an alarm", async () => {
process.env.CLOUDWATCH_ALARM_NAME = "CreateAlarmTest";
process.env.EC2_INSTANCE_ID = instanceIdToTerminate;
const mod = await import("../actions/put-metric-alarm.js");
await mod.default;
const { AlarmName } = await describeAlarm(
process.env.CLOUDWATCH_ALARM_NAME,
);
expect(AlarmName).toBe(process.env.CLOUDWATCH_ALARM_NAME);
});
});