-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathcommon-stack.test.ts
63 lines (58 loc) · 1.53 KB
/
common-stack.test.ts
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { Match, Template } from "aws-cdk-lib/assertions";
import * as cdk from "aws-cdk-lib";
import * as dotenv from 'dotenv';
dotenv.config({ path: './test/.env-test' });
import * as config from "../lib/config/node-config";
import { SuiCommonStack } from "../lib/common-stack";
describe("SuiCommonStack", () => {
test("synthesizes the way we expect", () => {
const app = new cdk.App();
// Create the SuiCommonStack.
const suiCommonStack = new SuiCommonStack(app, "sui-common", {
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
stackName: `sui-nodes-common`,
});
// Prepare the stack for assertions.
const template = Template.fromStack(suiCommonStack);
// Has EC2 instance role.
template.hasResourceProperties("AWS::IAM::Role", {
AssumeRolePolicyDocument: {
Statement: [
{
Action: "sts:AssumeRole",
Effect: "Allow",
Principal: {
Service: "ec2.amazonaws.com"
}
}
]
},
ManagedPolicyArns: [
{
"Fn::Join": [
"",
[
"arn:",
{
Ref: "AWS::Partition"
},
":iam::aws:policy/AmazonSSMManagedInstanceCore"
]
]
},
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/CloudWatchAgentServerPolicy"
]
]
}
]
})
});
});