Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion src/test/funcs-with-iam.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
],
"Resource": "*"
}
]
],
"iamManagedPolicies" : ["arn:aws:iam:*****:policy/some-managed-policy"]
},
"functions": {
"hello": {
Expand Down Expand Up @@ -106,6 +107,35 @@
"securityGroupIds": ["sg-xxxxxx"],
"subnetIds": ["subnet-xxxx", "subnet-yyyy"]
}
},
"helloInheritIamStatements": {
"handler": "handler.hello",
"iamRoleStatements": [],
"iamManagedPoliciesInherit":true,
"iamManagedPolicies" : ["arn:aws:iam:*****:policy/some-managed-policy"],
"events": [],
"name": "test-python-dev-hello",
"package": {},
"vpc": {
"securityGroupIds": ["sg-xxxxxx"],
"subnetIds": ["subnet-xxxx", "subnet-yyyy"]
}
},
"helloKinesis": {
"handler": "handler.hello",
"iamRoleStatements": [
{
"Effect": "Allow",
"Action": [
"kinesis:GetRecords"
],
"Resource": "arn:aws:kinesis:us-east-1:*:stream/test"
}
],
"events": [{"stream": "arn:aws:kinesis:us-east-1:1234567890:stream/test/stream/2017-10-09T19:39:15.151"}],
"name": "test-python-dev-hello",
"package": {},
"vpc": {}
}
},
"resources": {
Expand Down
5 changes: 3 additions & 2 deletions src/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,9 @@ describe('plugin tests', function(this: any) {
} catch (error) {
const msg: string = error.message;
assert.isString(msg);
console.log(msg)
assert.isTrue(msg.startsWith('serverless-iam-roles-per-function: ERROR:'));
assert.isTrue(msg.endsWith('testing'));
assert.isTrue(msg.includes('testing'));
}
});
});
Expand All @@ -270,7 +271,7 @@ describe('plugin tests', function(this: any) {
});

describe('#createRolesPerFunction', () => {
it('should create role per function', () => {
it('should create role per function', () => {
plugin.createRolesPerFunction();
const helloRole = serverless.service.provider.compiledCloudFormationTemplate.Resources.HelloIamRoleLambdaExecution;
assert.isNotEmpty(helloRole);
Expand Down