How to use idle_container_destroyer method in localstack

Best Python code snippet using localstack_python

test_lambda_whitebox.py

Source:test_lambda_whitebox.py Github

copy

Full Screen

...249 self.assertEqual(0, len(executor.get_all_container_names()))250 self.lambda_client.invoke(FunctionName=func_name, Payload=b"{}")251 self.assertEqual(1, len(executor.get_all_container_names()))252 # try to destroy idle containers.253 executor.idle_container_destroyer()254 self.assertEqual(1, len(executor.get_all_container_names()))255 # simulate an idle container256 executor.function_invoke_times[func_arn] = (257 int(time.time() * 1000) - lambda_executors.MAX_CONTAINER_IDLE_TIME_MS258 )259 executor.idle_container_destroyer()260 def assert_container_destroyed():261 self.assertEqual(0, len(executor.get_all_container_names()))262 retry(assert_container_destroyed, retries=3)263 # clean up264 testutil.delete_lambda_function(func_name)265class TestLocalExecutors(unittest.TestCase):266 def test_python3_runtime_multiple_create_with_conflicting_module(self):267 lambda_client = aws_stack.create_external_boto_client("lambda")268 original_do_use_docker = lambda_api.DO_USE_DOCKER269 try:270 # always use the local runner271 lambda_api.DO_USE_DOCKER = False272 python3_with_settings1 = load_file(TEST_LAMBDA_PYTHON3_MULTIPLE_CREATE1, mode="rb")273 python3_with_settings2 = load_file(TEST_LAMBDA_PYTHON3_MULTIPLE_CREATE2, mode="rb")...

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