Skip to content

Commit 0fc35e6

Browse files
authored
remove permission from lambda function before deleting authorizer in e2e tests (#32)
Description of changes: * remove permission from lambda function before deleting authorizer in e2e tests * This issue was surfaced when soak tests ran for more than 3 hours and limit of resource policy per lambda was hit. This caused skewed results in soak tests. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent baa246d commit 0fc35e6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/e2e/tests/test_api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,17 @@ def authorizer_resource(api_resource):
114114
authorizer_id=authorizer_id
115115
)
116116
lambda_client = boto3.client("lambda")
117-
lambda_client.add_permission(FunctionName=get_bootstrap_resources().AuthorizerFunctionName,
118-
StatementId=random_suffix_name('invoke-permission', 25),
117+
function_name = get_bootstrap_resources().AuthorizerFunctionName
118+
statement_id = random_suffix_name('invoke-permission', 25)
119+
lambda_client.add_permission(FunctionName=function_name,
120+
StatementId=statement_id,
119121
Action='lambda:InvokeFunction',
120122
Principal='apigateway.amazonaws.com',
121123
SourceArn=authorizer_arn)
122124

123125
yield authorizer_ref, cr
124126

127+
lambda_client.remove_permission(FunctionName=function_name, StatementId=statement_id)
125128
k8s.delete_custom_resource(authorizer_ref)
126129

127130

0 commit comments

Comments
 (0)