How to use modify_spot_fleet_request method in localstack

Best Python code snippet using localstack_python

test_spot_fleet.py

Source:test_spot_fleet.py Github

copy

Full Screen

...177 spot_fleet_res = conn.request_spot_fleet(178 SpotFleetRequestConfig=spot_config(subnet_id)179 )180 spot_fleet_id = spot_fleet_res["SpotFleetRequestId"]181 conn.modify_spot_fleet_request(SpotFleetRequestId=spot_fleet_id, TargetCapacity=20)182 instance_res = conn.describe_spot_fleet_instances(SpotFleetRequestId=spot_fleet_id)183 instances = instance_res["ActiveInstances"]184 len(instances).should.equal(10)185 spot_fleet_config = conn.describe_spot_fleet_requests(186 SpotFleetRequestIds=[spot_fleet_id]187 )["SpotFleetRequestConfigs"][0]["SpotFleetRequestConfig"]188 spot_fleet_config["TargetCapacity"].should.equal(20)189 spot_fleet_config["FulfilledCapacity"].should.equal(20.0)190@mock_ec2191def test_modify_spot_fleet_request_up_diversified():192 conn = boto3.client("ec2", region_name="us-west-2")193 subnet_id = get_subnet_id(conn)194 spot_fleet_res = conn.request_spot_fleet(195 SpotFleetRequestConfig=spot_config(subnet_id, allocation_strategy="diversified")196 )197 spot_fleet_id = spot_fleet_res["SpotFleetRequestId"]198 conn.modify_spot_fleet_request(SpotFleetRequestId=spot_fleet_id, TargetCapacity=19)199 instance_res = conn.describe_spot_fleet_instances(SpotFleetRequestId=spot_fleet_id)200 instances = instance_res["ActiveInstances"]201 len(instances).should.equal(7)202 spot_fleet_config = conn.describe_spot_fleet_requests(203 SpotFleetRequestIds=[spot_fleet_id]204 )["SpotFleetRequestConfigs"][0]["SpotFleetRequestConfig"]205 spot_fleet_config["TargetCapacity"].should.equal(19)206 spot_fleet_config["FulfilledCapacity"].should.equal(20.0)207@mock_ec2208def test_modify_spot_fleet_request_down_no_terminate():209 conn = boto3.client("ec2", region_name="us-west-2")210 subnet_id = get_subnet_id(conn)211 spot_fleet_res = conn.request_spot_fleet(212 SpotFleetRequestConfig=spot_config(subnet_id)213 )214 spot_fleet_id = spot_fleet_res["SpotFleetRequestId"]215 conn.modify_spot_fleet_request(216 SpotFleetRequestId=spot_fleet_id,217 TargetCapacity=1,218 ExcessCapacityTerminationPolicy="noTermination",219 )220 instance_res = conn.describe_spot_fleet_instances(SpotFleetRequestId=spot_fleet_id)221 instances = instance_res["ActiveInstances"]222 len(instances).should.equal(3)223 spot_fleet_config = conn.describe_spot_fleet_requests(224 SpotFleetRequestIds=[spot_fleet_id]225 )["SpotFleetRequestConfigs"][0]["SpotFleetRequestConfig"]226 spot_fleet_config["TargetCapacity"].should.equal(1)227 spot_fleet_config["FulfilledCapacity"].should.equal(6.0)228@mock_ec2229def test_modify_spot_fleet_request_down_odd():230 conn = boto3.client("ec2", region_name="us-west-2")231 subnet_id = get_subnet_id(conn)232 spot_fleet_res = conn.request_spot_fleet(233 SpotFleetRequestConfig=spot_config(subnet_id)234 )235 spot_fleet_id = spot_fleet_res["SpotFleetRequestId"]236 conn.modify_spot_fleet_request(SpotFleetRequestId=spot_fleet_id, TargetCapacity=7)237 conn.modify_spot_fleet_request(SpotFleetRequestId=spot_fleet_id, TargetCapacity=5)238 instance_res = conn.describe_spot_fleet_instances(SpotFleetRequestId=spot_fleet_id)239 instances = instance_res["ActiveInstances"]240 len(instances).should.equal(3)241 spot_fleet_config = conn.describe_spot_fleet_requests(242 SpotFleetRequestIds=[spot_fleet_id]243 )["SpotFleetRequestConfigs"][0]["SpotFleetRequestConfig"]244 spot_fleet_config["TargetCapacity"].should.equal(5)245 spot_fleet_config["FulfilledCapacity"].should.equal(6.0)246@mock_ec2247def test_modify_spot_fleet_request_down():248 conn = boto3.client("ec2", region_name="us-west-2")249 subnet_id = get_subnet_id(conn)250 spot_fleet_res = conn.request_spot_fleet(251 SpotFleetRequestConfig=spot_config(subnet_id)252 )253 spot_fleet_id = spot_fleet_res["SpotFleetRequestId"]254 conn.modify_spot_fleet_request(SpotFleetRequestId=spot_fleet_id, TargetCapacity=1)255 instance_res = conn.describe_spot_fleet_instances(SpotFleetRequestId=spot_fleet_id)256 instances = instance_res["ActiveInstances"]257 len(instances).should.equal(1)258 spot_fleet_config = conn.describe_spot_fleet_requests(259 SpotFleetRequestIds=[spot_fleet_id]260 )["SpotFleetRequestConfigs"][0]["SpotFleetRequestConfig"]261 spot_fleet_config["TargetCapacity"].should.equal(1)262 spot_fleet_config["FulfilledCapacity"].should.equal(2.0)263@mock_ec2264def test_modify_spot_fleet_request_down_no_terminate_after_custom_terminate():265 conn = boto3.client("ec2", region_name="us-west-2")266 subnet_id = get_subnet_id(conn)267 spot_fleet_res = conn.request_spot_fleet(268 SpotFleetRequestConfig=spot_config(subnet_id)269 )270 spot_fleet_id = spot_fleet_res["SpotFleetRequestId"]271 instance_res = conn.describe_spot_fleet_instances(SpotFleetRequestId=spot_fleet_id)272 instances = instance_res["ActiveInstances"]273 conn.terminate_instances(InstanceIds=[i["InstanceId"] for i in instances[1:]])274 conn.modify_spot_fleet_request(275 SpotFleetRequestId=spot_fleet_id,276 TargetCapacity=1,277 ExcessCapacityTerminationPolicy="noTermination",278 )279 instance_res = conn.describe_spot_fleet_instances(SpotFleetRequestId=spot_fleet_id)280 instances = instance_res["ActiveInstances"]281 len(instances).should.equal(1)282 spot_fleet_config = conn.describe_spot_fleet_requests(283 SpotFleetRequestIds=[spot_fleet_id]284 )["SpotFleetRequestConfigs"][0]["SpotFleetRequestConfig"]285 spot_fleet_config["TargetCapacity"].should.equal(1)286 spot_fleet_config["FulfilledCapacity"].should.equal(2.0)287@mock_ec2288def test_create_spot_fleet_without_spot_price():...

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