How to use delete_function_concurrency method in localstack

Best Python code snippet using localstack_python

test_awslambda_actions.py

Source:test_awslambda_actions.py Github

copy

Full Screen

...52 with patch.object(client, "put_function_concurrency", FailedActivity):53 with pytest.raises(Exception):54 put_function_concurrency(lambda_function_name, concurrency)55@patch("chaosaws.awslambda.actions.aws_client", autospec=True)56def test_aws_lambda_delete_function_concurrency(aws_client):57 client = MagicMock()58 aws_client.return_value = client59 lambda_function_name = "my-lambda-function"60 delete_function_concurrency(lambda_function_name)61 client.delete_function_concurrency.assert_called_with(62 FunctionName=lambda_function_name63 )64@patch("chaosaws.awslambda.actions.aws_client", autospec=True)65def test_aws_lambda_invoke_no_args(aws_client):66 client = MagicMock()67 aws_client.return_value = client68 mock_payload = {"some": "response"}69 mock_response = {"Payload": MagicMock()}70 mock_response["Payload"].read.return_value = json.dumps(mock_payload).encode()71 client.invoke.return_value = mock_response72 lambda_function_name = "my-lambda-function"73 response = invoke_function(lambda_function_name)74 assert response["Payload"] == mock_payload...

Full Screen

Full Screen

actions.py

Source:actions.py Github

copy

Full Screen

...79 except Exception as x:80 raise FailedActivity(81 f"failed throttling lambda function '{function_name}': '{str(x)}'"82 )83def delete_function_concurrency(84 function_name: str, configuration: Configuration = None, secrets: Secrets = None85) -> AWSResponse:86 """87 Removes concurrency limit applied to the specified Lambda88 """89 client = aws_client("lambda", configuration, secrets)90 return client.delete_function_concurrency(FunctionName=function_name)91def put_function_timeout(92 function_name: str,93 timeout: int,94 configuration: Configuration = None,95 secrets: Secrets = None,96) -> AWSResponse:97 """98 Sets the function timeout.99 Input timeout argument is specified in seconds.100 """101 client = aws_client("lambda", configuration, secrets)102 return _update_function_configuration(103 function_name=function_name, client=client, timeout=timeout104 )...

Full Screen

Full Screen

dss-start-stop--think-before-you-invoke-me.py

Source:dss-start-stop--think-before-you-invoke-me.py Github

copy

Full Screen

...32 lambda_client.put_function_concurrency(FunctionName=name, ReservedConcurrentExecutions=0)33 print(f"halted {name}")34 35def enable_lambda(name):36 lambda_client.delete_function_concurrency(FunctionName=name)37 print(f"started {name}")38root, dirs, files = next(os.walk(os.path.join(pkg_root, 'daemons')))39functions = [f'{name}-{stage}' for name in dirs]40functions.append(f"dss-{stage}") 41for f in functions:42 try:43 resp = lambda_client.get_function(FunctionName=f)44 except lambda_client.exceptions.ResourceNotFoundException:45 print(f"{f} not deployed, or does not deploy a Lambda function")46 continue47 if "start" == args.action:48 enable_lambda(f)49 elif "stop" == args.action:50 disable_lambda(f)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful