Best Python code snippet using localstack_python
_fleets.py
Source:_fleets.py
...54 :return:55 Whether or not the capacity change was successfully assigned or not.56 """57 client = configs.session.client("ec2")58 response = client.modify_fleet(59 FleetId=fleet.identifier,60 TargetCapacitySpecification={61 "TotalTargetCapacity": target_capacity,62 },63 )...
test_grow_fleet.py
Source:test_grow_fleet.py
1import lobotomy2from manager import _expander3from manager import _types4from manager.tests import _utils5def _make_configs() -> "_types.ManagerConfigs":6 """Create a configs object for testing."""7 configs = _types.ManagerConfigs()8 fleet_requirements = _types.FleetRequirements(9 configs=configs,10 sector="foo",11 size_spec=_types.SMALL_MEMORY_SPEC,12 )13 configs.fleets.append(fleet_requirements)14 return configs15@lobotomy.patch()16def test_grow_fleet(lobotomized: lobotomy.Lobotomy):17 """Should grow the fleet from current 1 to target 10 capacity."""18 lobotomized.add_call("ec2", "modify_fleet", {"Return": True})19 configs = _make_configs()20 fleet = _utils.make_fleet(configs.fleets[0], 1)21 assert _expander.grow_fleet(configs, fleet, 10)22@lobotomy.patch()23def test_grow_fleet_failed(lobotomized: lobotomy.Lobotomy):24 """Should fail to grow the fleet from current 1 to target 10 capacity."""25 lobotomized.add_call("ec2", "modify_fleet", {"Return": False})26 configs = _make_configs()27 fleet = _utils.make_fleet(configs.fleets[0], 1)28 assert not _expander.grow_fleet(configs, fleet, 10)29@lobotomy.patch()30def test_grow_fleet_unneeded(lobotomized: lobotomy.Lobotomy):31 """Should abort because capacity already exists."""32 lobotomized.add_call("ec2", "modify_fleet", {"Return": True})33 configs = _make_configs()34 fleet = _utils.make_fleet(configs.fleets[0], 10)35 assert _expander.grow_fleet(configs, fleet, 10)...
lambda-handler.py
Source:lambda-handler.py
...11 'TotalTargetCapacity': int(target_capacity)12 },13 'ExcessCapacityTerminationPolicy': 'termination',14 }15 response = ec2.modify_fleet(**kwargs)...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!