Lambda reserved concurrency (#3215)
* lambda-responses: add method to dispatch concurrency calls * lambda-resources: add route to handle concurrency requests * lambda-model: implement put_function_concurrency and concurrency attribute * put-concurrency-tests: add one simple test * get_function: add concurrency entry - with test * lambda-reserved-concurrency: cloudformation support * lambda-concurrency: implement delete_reserved with tests * lambda-concurrency: implement get_reserved with tests * lint * implementation-cov: mark delete_function_concurrency, put_function_concurrency and get_function_concurrency * botocore doesn't display concurrency entry for lambdas without it * lambda(refactor): improvements on response's handler
This commit is contained in:
parent
47a227921d
commit
f744356da7
6 changed files with 170 additions and 8 deletions
|
|
@ -489,7 +489,7 @@ def test_get_function():
|
|||
{"test_variable": "test_value"}
|
||||
)
|
||||
|
||||
# Test get function with
|
||||
# Test get function with qualifier
|
||||
result = conn.get_function(FunctionName="testFunction", Qualifier="$LATEST")
|
||||
result["Configuration"]["Version"].should.equal("$LATEST")
|
||||
result["Configuration"]["FunctionArn"].should.equal(
|
||||
|
|
@ -1721,6 +1721,82 @@ def test_remove_function_permission():
|
|||
policy["Statement"].should.equal([])
|
||||
|
||||
|
||||
@mock_lambda
|
||||
def test_put_function_concurrency():
|
||||
expected_concurrency = 15
|
||||
function_name = "test"
|
||||
|
||||
conn = boto3.client("lambda", _lambda_region)
|
||||
conn.create_function(
|
||||
FunctionName=function_name,
|
||||
Runtime="python3.8",
|
||||
Role=(get_role_name()),
|
||||
Handler="lambda_function.handler",
|
||||
Code={"ZipFile": get_test_zip_file1()},
|
||||
Description="test lambda function",
|
||||
Timeout=3,
|
||||
MemorySize=128,
|
||||
Publish=True,
|
||||
)
|
||||
result = conn.put_function_concurrency(
|
||||
FunctionName=function_name, ReservedConcurrentExecutions=expected_concurrency
|
||||
)
|
||||
|
||||
result["ReservedConcurrentExecutions"].should.equal(expected_concurrency)
|
||||
|
||||
|
||||
@mock_lambda
|
||||
def test_delete_function_concurrency():
|
||||
function_name = "test"
|
||||
|
||||
conn = boto3.client("lambda", _lambda_region)
|
||||
conn.create_function(
|
||||
FunctionName=function_name,
|
||||
Runtime="python3.8",
|
||||
Role=(get_role_name()),
|
||||
Handler="lambda_function.handler",
|
||||
Code={"ZipFile": get_test_zip_file1()},
|
||||
Description="test lambda function",
|
||||
Timeout=3,
|
||||
MemorySize=128,
|
||||
Publish=True,
|
||||
)
|
||||
conn.put_function_concurrency(
|
||||
FunctionName=function_name, ReservedConcurrentExecutions=15
|
||||
)
|
||||
|
||||
conn.delete_function_concurrency(FunctionName=function_name)
|
||||
result = conn.get_function(FunctionName=function_name)
|
||||
|
||||
result.doesnt.have.key("Concurrency")
|
||||
|
||||
|
||||
@mock_lambda
|
||||
def test_get_function_concurrency():
|
||||
expected_concurrency = 15
|
||||
function_name = "test"
|
||||
|
||||
conn = boto3.client("lambda", _lambda_region)
|
||||
conn.create_function(
|
||||
FunctionName=function_name,
|
||||
Runtime="python3.8",
|
||||
Role=(get_role_name()),
|
||||
Handler="lambda_function.handler",
|
||||
Code={"ZipFile": get_test_zip_file1()},
|
||||
Description="test lambda function",
|
||||
Timeout=3,
|
||||
MemorySize=128,
|
||||
Publish=True,
|
||||
)
|
||||
conn.put_function_concurrency(
|
||||
FunctionName=function_name, ReservedConcurrentExecutions=expected_concurrency
|
||||
)
|
||||
|
||||
result = conn.get_function_concurrency(FunctionName=function_name)
|
||||
|
||||
result["ReservedConcurrentExecutions"].should.equal(expected_concurrency)
|
||||
|
||||
|
||||
def create_invalid_lambda(role):
|
||||
conn = boto3.client("lambda", _lambda_region)
|
||||
zip_content = get_test_zip_file1()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue